semiotic 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +111 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +31 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +31 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +38 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +95 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +42 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +27 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +38 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +36 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +60 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +32 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +43 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +30 -1
- package/dist/components/charts/xy/CandlestickChart.d.ts +33 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +24 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +51 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +34 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +49 -1
- package/dist/components/export/selectionSerializer.d.ts +1 -1
- package/dist/components/realtime/types.d.ts +7 -9
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +2 -4
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +5 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/store/useSelection.d.ts +7 -4
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +18 -12
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +33 -8
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/keyboardNav.d.ts +18 -6
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +87 -21
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +47 -13
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +57 -10
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +40 -20
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
package/dist/xy.min.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-scale-chromatic"),a=require("d3-array"),l=require("d3-hierarchy"),c=require("d3-shape"),u=require("regression");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const g=h(t),p=d(u);function f(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function y(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function m({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:p,snapDuring:m,streaming:v}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>p?[...p].sort((e,t)=>e-t):void 0,[p]),A=t.useRef(j);A.current=j;const O=t.useRef(!1),S=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",n=>{if(O.current)return;const o=w.current;if(!o)return;if(!n.selection)return S.current=null,void k.current(null);let s,a;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],a=[o.y.invert(r),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(i)],a=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,r]]=n.selection;s=[o.x.invert(e),o.x.invert(i)],a=[o.y.invert(r),o.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===n.type||"brush"===n.type&&m)){const i=A.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[f(e[0],t),y(e[1],t)]}(s,i):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const r=o.x(s[0]),a=o.x(s[1]);if(O.current=!0,"x"===c)e.call(t.move,[r,a]);else if("xy"===c){const o=n.selection;e.call(t.move,[[r,o[0][1]],[a,o[1][1]]])}O.current=!1}const l={x:s,y:a};S.current=l,k.current(l)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,g,h,m]),t.useEffect(()=>{if(!(v&&u&&x.current&&S.current))return;if(!b.current)return;if("y"===c)return;const e=S.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,S.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===g){const e=A.current;e&&e.length>0?i=y(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,S.current=null,void k.current(null);r=!0}const s=u.x(i),a=u.x(e.x[1]);if(O.current=!0,"x"===c)o.call(x.current.move,[s,a]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[s,t],[a,n]])}if(O.current=!1,r){const t={x:[i,e.x[1]],y:e.y};S.current=t,k.current(t)}},[u,v,c,g,h]),e.jsx("svg",{ref:b,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}class v{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function b(n){const o=t.createContext(null),i=x(n);return[function({children:i}){const r=t.useMemo(()=>x(n),[]);return e.jsx(o.Provider,{value:r,children:i})},e=>{var n;const r=null!==(n=t.useContext(o))&&void 0!==n?n:i,s=t.useRef(e);s.current=e;const a=t.useCallback(()=>s.current(r.getState()),[r]),l=t.useCallback(()=>s.current(r.getState()),[r]);return t.useSyncExternalStore(r.subscribe,a,l)}]}function x(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 k(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function w(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:j})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const j=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],A={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},O={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},S={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:j,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[C,M]=b(e=>({theme:A,setTheme(t){e(e=>{if("light"===t)return{theme:A};if("dark"===t)return{theme:O};if("high-contrast"===t)return{theme:S};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?O:A;return{theme:w(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:w(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||{})}))}})}}));class _{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class P{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 L(e,t,n,o,i){const r=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=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function B(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function N(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function T(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function I(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const H={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},F=s.schemeCategory10,R=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],z=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function W(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||z.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):F[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+""))%F.length]}function $(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const s=H[n]||H.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:F;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function D(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}function E(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}function Y(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function G(e,t,n){return e+(t-e)*n}function q(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function X(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);null==e||null==r||Number.isNaN(e)||Number.isNaN(r)||s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function V(e,t,n,o,i,r,s,a){const l=[];for(const r of e){const e=n(r),s=o(r);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function U(e,t,n,o,i,r,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function Q(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function K(e,t,n,o,i,r,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function J(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],i=[];for(const n of t){const t=e.getX(n),r=e.getY(n);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(n),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(r+s)]),i.push([a,e.scales.y(r-s)]);else{const t=e.scales.y(r);o.push([a,t]),i.push([a,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:i,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function Z(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=U(s,e.scales,e.getX,r,a,o,l);c&&n.push(c)}}}const ee={blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,viridis:s.interpolateViridis,oranges:s.interpolateOranges,purples:s.interpolatePurples,greys:s.interpolateGreys,plasma:s.interpolatePlasma,inferno:s.interpolateInferno,magma:s.interpolateMagma,cividis:s.interpolateCividis,turbo:s.interpolateTurbo},te=new Map;class ne{constructor(e){if(this.xExtent=new P,this.yExtent=new P,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new _(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=N(e.timeAccessor||e.xAccessor,"time"),this.getY=N(e.valueAccessor||e.yAccessor,"value")):(this.getX=N(e.xAccessor,"x"),this.getY=N(e.yAccessor,"y")),this.getGroup=I(e.groupAccessor),this.getCategory=I(e.categoryAccessor),this.getSize=e.sizeAccessor?N(e.sizeAccessor,"size"):void 0,this.getColor=I(e.colorAccessor),this.getBounds=e.boundsAccessor?N(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?N(e.y0Accessor,"y0"):void 0,this.getPointId=I(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?N(e.openAccessor,"open"):void 0,this.getHigh=N(e.highAccessor,"high"),this.getLow=N(e.lowAccessor,"low"),this.getClose=n?N(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new _(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?N(this.config.timeAccessor||this.config.xAccessor,"time"):N(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)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)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);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)),this.getY0&&this.yExtent.push(this.getY0(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,s,a,l;const{config:c,buffer:u}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(u,this.getX),this.yExtent.dirty)if("candlestick"===c.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of u)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(u,this.getY);const d=this.getBufferArray(),h=this.xExtent.extent,g=this.yExtent.extent;let p=c.xExtent?[null!==(n=c.xExtent[0])&&void 0!==n?n:h[0],null!==(o=c.xExtent[1])&&void 0!==o?o:h[1]]:h,f=c.yExtent?[null!==(r=c.yExtent[0])&&void 0!==r?r:g[0],null!==(s=c.yExtent[1])&&void 0!==s?s:g[1]]:g;const y=c.yExtent&&null!=c.yExtent[0]&&null!=c.yExtent[1];if("stackedarea"===c.chartType&&!y&&u.size>0)if(c.normalize)f=[0,1+c.extentPadding];else{const e=`${u.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=this._stackExtentCache.yDomain;else{const t=this.groupData(d),n=new Map;let o=0;for(const e of t)for(const t of e.data){const e=this.getX(t),i=this.getY(t);if(null==e||null==i||Number.isNaN(e)||Number.isNaN(i))continue;const r=(n.get(e)||0)+i;n.set(e,r),r>o&&(o=r)}f=[0,o+(o>0?o*c.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===c.chartType&&c.binSize&&!y&&u.size>0){const[,e]=function(e,t,n,o,i){const r=L(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(u,this.getX,this.getY,c.binSize,this.getCategory);f=[0,e+e*c.extentPadding]}else if("waterfall"===c.chartType&&!y&&u.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(u,this.getY),n=t-e,o=n>0?n*c.extentPadding:1;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!y&&f[0]!==1/0){if(this.getBounds)for(const e of d){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*c.extentPadding:1,n=null===(a=c.yExtent)||void 0===a?void 0:a[0],o=null===(l=c.yExtent)||void 0===l?void 0:l[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===c.yScaleType&&0>=f[0]&&g[0]>0&&(f[0]=null!=n?f[0]:g[0]/(1+c.extentPadding))}if(p[0]===1/0||p[1]===-1/0)if("time"===c.xScaleType){const e=Date.now();p=[e-864e5,e]}else p=[0,1];f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]);const m="streaming"===c.runtimeMode,v=Math.max(0,Math.min(c.scalePadding||0,Math.min(e.width,e.height)/2-1));if(m)if("x"==("up"===(b=c.arrowOfTime)||"down"===b?"y":"x")){const t="right"===c.arrowOfTime?[v,e.width-v]:[e.width-v,v];this.scales={x:i.scaleLinear().domain(p).range(t),y:i.scaleLinear().domain(f).range([e.height-v,v])}}else{const t="down"===c.arrowOfTime?[v,e.height-v]:[e.height-v,v];this.scales={x:i.scaleLinear().domain(f).range([v,e.width-v]),y:i.scaleLinear().domain(p).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(c.xScaleType,p,[v,e.width-v]),y:t(c.yScaleType,f,[e.height-v,v])}}var b;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,d),this.config.decay&&this.applyDecay(this.scene,d),this.config.pulse&&this.applyPulse(this.scene,d),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,ne.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=r.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),s=this.scales.x.range(),a=this.scales.y.range(),l=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=a[1]>a[0];this.scales={x:l(this.config.xScaleType,o,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:l(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:i}=this;if(!i||0===t.length)return[];const r={scales:i,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=J(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=X(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Z(e,o,i),i}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=V(t.data,e.scales,e.getX,e.getY,i,n,t.key,r);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Z(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=V(t.data,e.scales,e.getX,e.getY,r,n,t.key,s);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=X(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Z(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:i,stackedTops:r}=function(e,t,n,o,i,r,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);null==t||null==r||Number.isNaN(t)||Number.isNaN(r)||e.set(t,(e.get(t)||0)+r)}u.set(t.key,e)}let d;if(r){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let i=e.get(n)||0;const s=p.get(n);r&&(i/=d.get(n));const c=s+i,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const f={type:"area",topPath:o,bottomPath:a,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(f.curve=s),h.push(f)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=i;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=r.get(o.key);if(n)for(const i of o.data){const o=e.getX(i),r=e.getY(i);null==o||Number.isNaN(o)||null==r||Number.isNaN(r)||!n.has(o)||t.set(i,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Z(e,n,s,o)}return s}(r,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t=Object.assign(Object.assign({},t),{fill:a.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=U(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=N(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),p=(d-u||1)/s,f=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/p),s-1),d=Math.min(Math.floor((r-h)/f),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,j=n.height/a,A=e.config.showValues,O=e.config.heatmapValueFormat,S=[];for(let e=0;a>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;S.push(K(n*w,(a-1-e)*j,w,j,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o]},A?{value:i,showValues:!0,valueFormat:O}:void 0))}}return S}(e,t,n);if(0===t.length)return[];const o=N(e.config.valueAccessor,"value"),i=T(e.config.xAccessor,"x"),r=T(e.config.yAccessor,"y"),a=new Map,l=new Map,c=Array(t.length),u=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),s=r(n);c[e]=o,u[e]=s,a.has(o)||a.set(o,a.size),l.has(s)||l.set(s,l.size)}const d=a.size,h=l.size;if(0===d||0===h)return[];const g=Array.from(a.keys()),p=Array.from(l.keys()),f=g.every(e=>"number"==typeof e&&!isNaN(e)),y=p.every(e=>"number"==typeof e&&!isNaN(e));if(f){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}if(y){p.sort((e,t)=>e-t),l.clear();for(let e=0;p.length>e;e++)l.set(p[e],e)}const m=new Float64Array(t.length),v=new Float64Array(t.length),b=Array(t.length),x=new Map;let k=0;for(let e=0;t.length>e;e++){const n=t[e],i=a.get(c[e]),r=l.get(u[e]);if(void 0===i||void 0===r)continue;const s=o(n),h=r*d+i,g=x.get(h);let p;void 0!==g?p=g:(p=k++,x.set(h,p)),m[p]=h,v[p]=s,b[p]=n}let w=1/0,j=-1/0;for(let e=0;k>e;e++){const t=v[e];isFinite(t)&&(w>t&&(w=t),t>j&&(j=t))}if(!isFinite(w)||!isFinite(j))return[];const A=function(e){const t=e in ee?e:"blues";let n=te.get(t);if(n)return n;n=Array(256);const o=ee[t]||s.interpolateBlues;for(let e=0;256>e;e++)n[e]=o(e/255);return te.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),O=255/(j-w||1),S=n.width/d,C=n.height/h,M=e.config.showValues,_=e.config.heatmapValueFormat,P=[];for(let e=0;k>e;e++){const t=v[e];if(!isFinite(t))continue;const n=m[e],o=n%d;P.push(K(o*S,(h-1-(n-o)/d)*C,S,C,A[Math.min((t-w)*O+.5|0,255)],b[e],M?{value:t,showValues:!0,valueFormat:_}:void 0))}return P}(r,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=L(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,p={};(null==u?void 0:u.stroke)&&(p.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(p.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(p.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=a.x(n),f=a.x(i),y=Math.abs(f-h),m=y>g+1?g:0,v=Math.min(h,f)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(n),c=a.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(Q(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},p),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=a.y(0),n=a.y(t.total);s.push(Q(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},p),{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of i.values())f.add(e.start),f.add(e.end);return{nodes:s,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=null!==(n=r.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,p=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:p},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(r,t);case"waterfall":return function(e,t,n){var o,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return u;const p=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",f=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const j=d.y(x),A=d.y(s),O=Math.min(j,A),S=Math.abs(j-A),C={fill:0>r?f:p,stroke:m,strokeWidth:v};null!=b&&(C.opacity=b),u.push(Q(k,O,w,S,C,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(r,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const a=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const p=h>=a,f={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:p,datum:n};i&&(f.isRange=!0),r.push(f)}return r}(r,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?E(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const a=s.get(t[n]);null!=a?(o[n]=E(e,a,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=E(e,o,r),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=E(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=E(e,t,r);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const a=Y(e,r,s);a>i&&(i=a)}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Y(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=a,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,a;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=q(e,c,l);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=q(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,j,A,O,S,C,M,_,P,L,B,N,T,I,H,F,R,z,W,$,D,E,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const U=new Set,Q=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=q(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(Q.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;continue}const L=o.get(P);if("point"===r.type)if(L){U.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,V=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("rect"===r.type)if(L){U.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(p=L.w)&&void 0!==p?p:r.w,r.h=null!==(f=L.h)&&void 0!==f?f:r.h,V=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),V=!0;else if("heatcell"===r.type)if(L){U.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,V=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){U.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(A=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(S=L.highY)&&void 0!==S?S:r.highY,r.lowY=null!==(C=L.lowY)&&void 0!==C?C:r.lowY,V=!0)}else r._targetOpacity=null!==(_=null===(M=r.style)||void 0===M?void 0:M.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!Q.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!U.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(B=t.r)&&void 0!==B?B:3,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(T=t.w)&&void 0!==T?T:0,h:null!==(I=t.h)&&void 0!==I?I:0,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(F=t.w)&&void 0!==F?F:0,h:null!==(R=t.h)&&void 0!==R?R:0,fill:"#999",datum:null,style:{opacity:null!==(z=t.opacity)&&void 0!==z?z:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==($=t.closeY)&&void 0!==$?$:o,highY:null!==(D=t.highY)&&void 0!==D?D:o,lowY:null!==(E=t.lowY)&&void 0!==E?E:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,a,l,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=G(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=G(n.x,e._targetX,d),e.y=G(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=G(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=G(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=G(n.x,e._targetX,d),e.y=G(n.y,e._targetY,d),void 0!==n.w&&(e.w=G(n.w,e._targetW,d)),void 0!==n.h&&(e.h=G(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:G(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=G(n.x,e._targetX,d),e.y=G(n.y,e._targetY,d),void 0!==n.w&&(e.w=G(n.w,e._targetW,d)),void 0!==n.h&&(e.h=G(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:G(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=G(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=G(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=G(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=G(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=G(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:G(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=G(t[o][0],n[o][0],d),e.path[o][1]=G(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:G(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=G(t[n][0],o[n][0],d),e.topPath[n][1]=G(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=G(n[t][0],i[t][0],d),e.bottomPath[t][1]=G(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||R,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||R;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ne.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const l=a||!B(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),c=a||!B(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=N(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=N(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=N(this.config.xAccessor,"x"),this.getY=N(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!B(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?I(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!B(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?I(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!B(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?N(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!B(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?I(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!B(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?N(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!B(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?I(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!B(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!B(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!B(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!B(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?N(this.config.openAccessor,"open"):void 0,this.getHigh=N(this.config.highAccessor,"high"),this.getLow=N(this.config.lowAccessor,"low"),this.getClose=t?N(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function oe(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function ie(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function re(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function se(e,t){const n=re(e);if(!n)return!1;const o=re(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ae(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);ie(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=ce(r,t,n,o);break;case"line":e=ue(r,t,n,o);break;case"rect":e=he(r,t,n);break;case"heatcell":e=ge(r,t,n);break;case"area":if(!1===r.interactive)break;e=fe(r,t,n);break;case"candlestick":e=pe(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function le(e,t,n){if(0===e.length)return null;const o=ye(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function ce(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>ie(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function ue(e,t,n,o=30){var i,r,s,a;if(0===e.path.length)return null;const l=ye(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const i=Math.max(0,l-1),r=Math.min(e.path.length-2,l);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=de(t,n,i,r,a,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(a=null!==(r=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==r?r:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==a?a:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function de(e,t,n,o,i,r){const s=i-n,a=r-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function he(e,t,n){const o=oe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ge(e,t,n){const o=oe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function pe(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function fe(e,t,n){if(0===e.topPath.length)return null;const o=ye(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,a=n-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function ye(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function me(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function ve(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}ne.GROUP_COLOR_MAP_CAP=1e3,ne.QUADTREE_THRESHOLD=500;const be={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function xe(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,be[n])(o(e,t)),i}function ke(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function we(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const je=(t,n,o,i,r,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let f=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=r;return g.forEach((t,u)=>{const v=xe(t,u,d,h),b=we(t,i,r),x=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===s&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(ke,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),f+=22}),p};function Ae({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+g.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function Oe(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=g.useState(0),[f,y]=g.useState(0),m=g.useCallback((e,t)=>{p(e),y(t)},[]),v="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:je(t,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const f=((t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,f=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=r;p.forEach((t,u)=>{const x=xe(t,u,h,g),k=we(t,i,r),w=r&&r.size>0&&r.has(t.label),j=26+7*t.label.length;d&&d>0&&y>0&&y+j>d&&(m++,y=0),f.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(ke,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=j});let x=0,k=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(t,i,r,s,a,l,c,n,u,d,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:t.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const f=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(f.push(e.jsx("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),f.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+i)),p+=o.offset+5,t[i+1]&&f.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e.jsx("g",{children:f})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:a}),b=!(!o&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function Se(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ce(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,f;return"left"===s?(p=4,f=r.top):"top"===s?(p=0,f=a?32:8):"bottom"===s?(p=0,f=i-r.bottom+50):(p=o-r.right+10,f=r.top),e.jsx("g",{transform:`translate(${p}, ${f})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(Ae,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Se(n)?e.jsx(Oe,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function Me(e){return"string"==typeof e?{type:e}:e}function _e({orient:n,config:o,values:i,scale:r,size:s,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),o=s-8;if("boxplot"===c.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)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:s,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*o,20),p=(o-g)/2+4;if(u){const t=r(s),o=r(l),i=r(a),u=r(d),f=r(h),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(p+g/2),x2:f,y2:m+y*(p+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*p,x2:u,y2:m+y*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:f,y1:m+y*p,x2:f,y2:m+y*(p+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-p-g:m+p,width:Math.abs(o-t),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-p-g:m+p,x2:i,y2:"top"===n?m-p:m+p+g,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),o=r(l),i=r(a),u=r(d),f=r(h),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(p+g/2),y1:u,x2:m+y*(p+g/2),y2:f,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*p,y1:u,x2:m+y*(p+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*p,y1:f,x2:m+y*(p+g),y2:f,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-p-g:m+p,y:Math.min(t,o),width:g,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-p-g:m+p,y1:i,x2:"left"===n?m-p:m+p+g,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=a.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/h*o;if(u){const o=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-s:4,width:Math.max(a,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===n?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(o/2),a=r((e.x0+e.x1)/2);i.push(u?`${a},${"top"===n?-(t-s):t-s}`:`${"left"===n?-(t-s):t-s},${a}`)}for(let e=d.length-1;e>=0;e--){const s=d[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(o/2),l=r((s.x0+s.x1)/2);i.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===n?-i-4:i+4}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,s=r((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${s}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,l,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Pe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function 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 Be(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("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 g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,f=s?u?[s]:Pe(s,c):[],y=r?u?[r]:Pe(r,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:f.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=f.length*p),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let k=null;if((s||r)&&(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),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+y.length-1)*p;let j=0;return"topBottom"===d?j=0>o?-(w+2):18:"leftRight"===d&&(j="middle"===h?-(w+p+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function Ne(t,n,o,i,r){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.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("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||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function Te(t,n,o,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;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=i+s*h,c=r+a*h}}}else if("bracket"===r&&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.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function Ie(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||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.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f,{children:[!m.has("connector")&&Te(v,b,c,h,x,u),!m.has("subject")&&Ne(x,u,h,n,o),!m.has("note")&&Be(l,v,b,h)]}))}function He(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(Ie,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Ie,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Fe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Re(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function ze(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Fe(e,n),c=Re(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function We(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const $e={linear:c.curveLinear,monotoneX:c.curveMonotoneX,monotoneY:c.curveMonotoneY,step:c.curveStep,stepAfter:c.curveStepAfter,stepBefore:c.curveStepBefore,basis:c.curveBasis,cardinal:c.curveCardinal,catmullRom:c.curveCatmullRom};let De={positions:new Map};const Ee=new Set;function Ye(){for(const e of Ee)e()}function Ge(e,t){const n=De.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(De.positions);o.delete(e),De={positions:o},Ye()}function qe(e,t){const n=De.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(De.positions);o.delete(e),De={positions:o},Ye()}function Xe(){return De}function Ve(e){return Ee.add(e),()=>Ee.delete(e)}const Ue={positions:new Map};function Qe(){return()=>{}}function Ke(){return Ue}function Je(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Ze(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function et(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=n,p=t.useMemo(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||tt,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=l.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,s)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return nt(a,Math.max(55,c+8))},[l,u,h,o]),f=t.useMemo(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||tt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nt(l.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,i]),y=d&&l,m=c&&l;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,j=(null==b?void 0:b.jaggedBase)||!1,A="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[y&&(()=>{var t,n;const r=Je(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=Je(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),f.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),x&&!w&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:A,strokeWidth:1}),w&&e.jsx("path",{d:Ze("bottom",o,i),fill:"none",stroke:A,strokeWidth:1}),k&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:A,strokeWidth:1}),j&&e.jsx("path",{d:Ze("left",o,i),fill:"none",stroke:A,strokeWidth:1})]})})}function tt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nt(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function ot(n){var o,i;const{width:r,height:s,totalWidth:a,totalHeight:u,margin:d,scales:h,showAxes:g,axes:f,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:j,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:C,legendPosition:M="right",foregroundGraphics:_,marginalGraphics:P,xValues:L,yValues:B,annotations:N,svgAnnotationRules:T,xAccessor:I,yAccessor:H,annotationData:F,pointNodes:R,curve:z,underlayRendered:W,linkedCrosshairName:$,linkedCrosshairSourceId:D,children:E}=n,Y=t.useMemo(()=>{var e;if(!g||!h)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=h.x.ticks(Math.min(o,Math.max(2,Math.floor(r/70)))),s=i.map(e=>e.valueOf()),a=i.map((e,t)=>({value:e,pixel:h.x(e),label:n(e,t,s)})),l=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=nt(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=h.x.domain()[1],t=h.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,s);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[g,h,f,b,r]),G=t.useMemo(()=>{var e;if(!g||!h)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=nt(h.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=h.y.domain()[1],t=h.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[g,h,f,x,s]),q=t.useMemo(()=>{var e;if(!g||!h)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nt(h.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[g,h,f,x,s]),X=t.useRef(new Map),V=t.useRef(null!==(o=null==N?void 0:N.length)&&void 0!==o?o:0),U=null!==(i=null==N?void 0:N.length)&&void 0!==i?i:0;V.current!==U&&(V.current=U,X.current=new Map);const Q=t.useMemo(()=>{if(!N||0===N.length)return null;const t=function(t,n,o){var i,r,s,a,u,d,h,g,f,y,m,v,b,x,k,w,j,A,O,S,C,M,_,P,L,B,N,T,I,H,F,R,z,W,$,D,E,Y,G,q,X,V,U,Q,K,J,Z,ee;switch(t.type){case"label":{const i=ze(t,n,o);if(!i)return null;const{x:r,y:s}=i;return We(r,s,o)?e.jsx(He,{noteData:{x:r,y:s,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}},"ann-"+n):null}case"callout":{const i=ze(t,n,o);if(!i)return null;const{x:r,y:s}=i;return We(r,s,o)?e.jsx(He,{noteData:{x:r,y:s,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}},"ann-"+n):null}case"x-threshold":{const i=Fe(t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=Re(t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Fe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Re(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Fe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Re(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=Fe(n,o),a=Re(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Fe(t,o),r=Re(t,o);return e.jsx(He,{noteData:{x:null!=i?i:0,y:null!=r?r: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}},"ann-"+n)}case"trend":{const l=o.data||[];if(2>l.length)return null;const c=o.xAccessor||"x",g=o.yAccessor||"y",f=l.map(e=>[e[c],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(s=o.scales)||void 0===s?void 0:s.time,m=null!==(u=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===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]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===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,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?p.default.polynomial(f,{order:t.order||2}):p.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(f=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=o.scales)||void 0===y?void 0:y.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.time,a=null!==(j=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=o.scales)||void 0===A?void 0:A.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[l]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=$e[o.curve||"linear"]||c.curveLinear,p=c.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[l])).curve(g)(h);if(!p)return null;const f=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:f,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][l])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(C=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==C?C:null===(M=o.scales)||void 0===M?void 0:M.time,a=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const l=i.map(e=>e[r]).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!==(B=t.threshold)&&void 0!==B?B:2,g=c-h*d,p=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(N=t.fillOpacity)&&void 0!==N?N:.1,m=t.anomalyColor||"#ef4444",v=null!==(T=t.anomalyRadius)&&void 0!==T?T:6,b=a(c+h*d),x=a(g),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),k.map((t,n)=>{const i=Fe(t,o),r=Re(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(H=null===(I=o.scales)||void 0===I?void 0:I.x)&&void 0!==H?H:null===(F=o.scales)||void 0===F?void 0:F.time,l=null!==(z=null===(R=o.scales)||void 0===R?void 0:R.y)&&void 0!==z?z:null===(W=o.scales)||void 0===W?void 0:W.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).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")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*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)),f=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==($=t.confidence)&&void 0!==$?$:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(D=t.steps)&&void 0!==D?D:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-f,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,C=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:C,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:C,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=ze(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!We(i,r,o))return null;const s=null!==(q=t.dx)&&void 0!==q?q:0,a=null!==(X=t.dy)&&void 0!==X?X:0,l=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(Q=t.content)&&void 0!==Q?Q:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=ze(t,n,o);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=null===(K=o.scales)||void 0===K?void 0:K.o,s=null===(J=o.scales)||void 0===J?void 0:J.x,a=null===(Z=o.scales)||void 0===Z?void 0:Z.y,l=(null==r?void 0:r.bandwidth)?r:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(i);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:l===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:I,yAccessor:H,width:r,height:s,data:F,frameType:"xy",pointNodes:R,curve:z,stickyPositionCache:X.current};return N.map((e,o)=>{if(T){const i=T(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[N,T,r,s,I,H,F,h,R,z]),K=function(e){var n;const o=t.useSyncExternalStore(e?Ve:Qe,e?Xe:Ke,e?Xe:Ke);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}($);return t.useEffect(()=>{if(!(null==K?void 0:K.locked)||!$)return;const e=e=>{"Escape"===e.key&&qe($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==K?void 0:K.locked,$]),g||w||j||_||P||Q&&Q.length>0||k||E||K?e.jsxs("svg",{role:"img",width:a,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[k&&h&&!W&&(()=>{var t,n;const o=Je(null===(t=null==f?void 0:f.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Je(null===(n=null==f?void 0:f.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[Y.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),G.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&h&&(()=>{const t=null==f?void 0:f.find(e=>"left"===e.orient),n=null==f?void 0:f.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&Y.length>1&&(()=>{const e=r/Math.max(Y.length-1,1);return Y.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!W&&i&&!l&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:h,strokeWidth:1}),!W&&l&&e.jsx("path",{d:Ze("bottom",r,s),fill:"none",stroke:h,strokeWidth:1}),Y.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):se(t.value,n>0?Y[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fontSize:12,fill:p,style:{userSelect:"none"},children:y}),!W&&o&&!a&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:h,strokeWidth:1}),!W&&a&&e.jsx("path",{d:Ze("left",r,s),fill:"none",stroke:h,strokeWidth:1}),G.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):se(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-d.left,y:s/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(-90, ${15-d.left}, ${s/2})`,style:{userSelect:"none"},children:n}):null})(),(()=>{const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.jsxs(e.Fragment,{children:[!1!==t.baseline&&e.jsx("line",{x1:r,y1:0,x2:r,y2:s,stroke:h,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):se(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-r-"+o)}),o&&e.jsx("text",{x:r+d.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(90, ${r+d.right-15}, ${s/2})`,style:{userSelect:"none"},children:o})]})})()]})})(),Q,P&&h&&L&&B&&e.jsxs(e.Fragment,{children:[P.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(_e,{orient:"top",config:Me(P.top),values:L,scale:h.x,size:d.top,length:r})}),P.bottom&&e.jsx("g",{transform:`translate(0, ${s})`,children:e.jsx(_e,{orient:"bottom",config:Me(P.bottom),values:L,scale:h.x,size:d.bottom,length:r})}),P.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(_e,{orient:"left",config:Me(P.left),values:B,scale:h.y,size:d.left,length:s})}),P.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(_e,{orient:"right",config:Me(P.right),values:B,scale:h.y,size:d.right,length:s})})]}),_,K&&K.sourceId!==D&&(null==h?void 0:h.x)&&(()=>{const t=h.x(K.xValue);if(null==t||0>t||t>r)return null;const n=K.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),E]}),w&&e.jsx("text",{x:a/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),Ce({legend:j,totalWidth:a,totalHeight:u,margin:d,legendPosition:M,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:C})]}):null}function it(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const rt="undefined"==typeof window||"undefined"==typeof document,st=g.createContext(null),at={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function lt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const ct=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ut={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},dt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ht={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},gt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},pt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},ft={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},yt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function mt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=g.useState(!1),l=g.useContext(st),c=null!==(r=null==l?void 0:l.visible)&&void 0!==r&&r,u=s||c,d=g.useRef(null),h=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=g.useCallback(()=>{s||c||a(!0)},[s,c]),f=g.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:at}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:at,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,j,A,O;const S=[];if(!Array.isArray(e))return S;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":S.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=C.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=C.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(p=C.cy)&&void 0!==p?p:C.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(f=C.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=C.cx)&&void 0!==m?m:C.x,y:null!==(v=C.cy)&&void 0!==v?v:C.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=C.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(O=null===(A=C.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ct(e.min)} to ${ct(e.max)}, mean ${ct(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:f,style:ut,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:ht,children:"×"}),e.jsx("div",{role:"note",style:dt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:gt,children:[e.jsxs("caption",{style:yt,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:pt,children:"type"}),k.map(t=>e.jsx("th",{style:pt,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:ft,children:t.label}),k.map(n=>{return e.jsx("td",{style:ft,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ct(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function vt({summary:t}){return t?e.jsx("div",{role:"note",style:at,children:t}):null}function bt({tableId:t}){return e.jsx("a",{href:"#"+t,style:at,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,at)},children:"Skip to data table"})}function xt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:at,children:n})}const kt="var(--semiotic-focus, #005fcc)";function wt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:kt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:kt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:kt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function jt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=g.useRef(null),[u,d]=g.useState(null);g.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,i]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:r.left+t,top:r.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"},children:s})}function At(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}const Ot=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,St=new WeakMap;let Ct=0,Mt=!1,_t=null,Pt=null,Lt=null;function Bt(e,t){var n,o;if(!t)return t;const i=Ot.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Mt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Mt=!0;const e=()=>{Ct++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(_t=new MutationObserver(e),_t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Pt=window.matchMedia("(prefers-color-scheme: dark)"),Lt=e,"function"==typeof Pt.addEventListener?Pt.addEventListener("change",Lt):"function"==typeof Pt.addListener&&Pt.addListener(Lt)}catch(e){}}();let s=St.get(r);s&&s.version===Ct||(s={version:Ct,map:new Map},St.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Nt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Tt(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=At(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=Nt(e.foregroundGraphics,r,s),u=Nt(e.backgroundGraphics,r,s),d=M(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+g.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const S=e.themeDirtyRef;return t.useEffect(()=>{S&&(Ct++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function It(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function Ht(e){switch(e){case"monotoneX":return c.curveMonotoneX;case"monotoneY":return c.curveMonotoneY;case"cardinal":return c.curveCardinal;case"catmullRom":return c.curveCatmullRom;case"step":return c.curveStep;case"stepBefore":return c.curveStepBefore;case"stepAfter":return c.curveStepAfter;case"basis":return c.curveBasis;case"natural":return c.curveNatural;default:return null}}function Ft(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Rt(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;l>o&&(r*=o/l),l>a-o&&(r*=(a-o)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const zt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const u=a.style.stroke||"#007bff",d=Bt(e,u)||u,h=a.style.strokeWidth||2,g=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Rt(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Ht(a.curve),y=g&&g.length>0&&p&&p.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function C(){O&&(e.stroke(),O=!1)}for(let M=0;a.path.length>M;M++){const[_,P]=a.path[M],L=p[M],B=Ft(L,g,d);if(null!==k&&null!==A&&null!==j){if(B===A)e.lineTo(_,P);else{const N=[];for(const T of g){const I=T.value;(j>I||I>L)&&(I>j||L>I)||j===I||L===I||N.push({t:(I-j)/(L-j)})}N.sort((e,t)=>e.t-t.t);for(const H of N){const F=k+(_-k)*H.t,R=w+(P-w)*H.t,z=Ft(j+(L-j)*Math.min(H.t+1e-4,1),g,d);e.lineTo(F,R),C(),S(z,F,R)}e.lineTo(_,P)}k=_,w=P,j=L,A=B}else S(B,_,P),k=_,w=P,j=L,A=B}C()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=d;else{const W=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const $ of a.strokeGradient.colorStops)W.addColorStop(Math.max(0,Math.min(1,$.offset)),$.color);e.strokeStyle=W}if(f)c.line().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[D,E]=a.path[0];e.moveTo(D,E);for(let Y=1;a.path.length>Y;Y++)e.lineTo(a.path[Y][0],a.path[Y][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?Bt(e,a.style.fill):a.style.fill)||a.style.fill,f&&!y)c.line().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[q,X]=a.path[0];e.moveTo(q,X);for(let V=1;a.path.length>V;V++)e.lineTo(a.path[V][0],a.path[V][1])}const G=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(G,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Wt(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function $t(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dt(e,t,n=.3){$t(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Et(e,t,n=.6){var o,i,r,s,a;if(!$t(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Yt(e,t,n,o=.35){$t(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Gt(e){switch(e){case"monotoneX":return c.curveMonotoneX;case"monotoneY":return c.curveMonotoneY;case"cardinal":return c.curveCardinal;case"catmullRom":return c.curveCatmullRom;case"step":return c.curveStep;case"stepBefore":return c.curveStepBefore;case"stepAfter":return c.curveStepAfter;case"basis":return c.curveBasis;case"natural":return c.curveNatural;default:return null}}function qt(e,t){const n=Gt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=c.area().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Xt=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const a=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Bt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(l[n]+l[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(qt(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=e.createLinearGradient(0,n,0,o);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const[n,o,r]=Wt(e,"string"==typeof a?a:"#4e79a7");i.addColorStop(0,`rgba(${n},${o},${r},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${n},${o},${r},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=u}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*u,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(qt(e,t),Yt(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=u,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=Bt(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Gt(t.curve);if(e.beginPath(),n)c.line().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1}},Vt=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Bt(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Bt(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Et(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Ut(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=Wt(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const Qt=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Kt(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?Bt(e,t.style.fill):t.style.fill)||Bt(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ut(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Bt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?Bt(e,t.style.fill):t.style.fill)||Bt(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ut(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Bt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dt(e,t),e.globalAlpha=1}};function Kt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Jt(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function Zt(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function en(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const tn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function nn(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${tn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${tn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const on={line:[Xt,zt,Vt],area:[Xt,Vt],stackedarea:[Xt,Vt],scatter:[Vt],bubble:[Vt],heatmap:[(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Bt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Dt(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):en(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Zt(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}}],bar:[Qt],swarm:[Vt],waterfall:[(e,t,n,o)=>{var i,r,s;Qt(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=Bt(e,c)||c,e.lineWidth=null!==(i=null==l?void 0:l._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],i=a[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=Bt(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=Bt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}}],mixed:[Xt,zt,Vt]},rn={top:20,right:20,bottom:30,left:40},sn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function an(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const ln={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 cn({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.jsxs("div",{className:"semiotic-tooltip",style:ln,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n(t.value)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:n(t.time)})]})}const un=t.forwardRef(function(n,o){var i,r,s,a,l,c,u,d,h,p,f;const{chartType:y,runtimeMode:b,data:x,chunkThreshold:w,chunkSize:j,xAccessor:A,yAccessor:O,colorAccessor:S,sizeAccessor:C,groupAccessor:M,lineDataAccessor:_,curve:P,normalize:L,binSize:B,valueAccessor:N,arrowOfTime:T="right",windowMode:I="sliding",windowSize:H=200,timeAccessor:F,xExtent:R,yExtent:z,extentPadding:W=.1,scalePadding:$,sizeRange:D,size:E=[500,300],responsiveWidth:Y,responsiveHeight:G,margin:q,className:X,background:V,lineStyle:U,pointStyle:Q,areaStyle:K,barStyle:J,waterfallStyle:Z,swarmStyle:ee,barColors:te,colorScheme:oe,boundsAccessor:ie,boundsStyle:re,y0Accessor:se,gradientFill:ce,lineGradient:ue,areaGroups:de,openAccessor:he,highAccessor:ge,lowAccessor:pe,closeAccessor:fe,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:Oe,yFormat:Se,tickFormatTime:Ce,tickFormatValue:Me,hoverAnnotation:_e,tooltipContent:Pe,customHoverBehavior:Le,customClickBehavior:Be,enableHover:Ne,hoverRadius:Te=30,tooltipMode:Ie,annotations:He,svgAnnotationRules:Fe,showGrid:Re,legend:ze,legendHoverBehavior:We,legendClickBehavior:$e,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Ye,backgroundGraphics:Ge,foregroundGraphics:qe,canvasPreRenderers:Xe,svgPreRenderers:Ve,title:Ue,categoryAccessor:Qe,brush:Ke,onBrush:Je,decay:Ze,pulse:tt,transition:nt,animate:st,staleness:at,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ht,heatmapValueFormat:gt,marginalGraphics:pt,pointIdAccessor:ft,xScaleType:yt,yScaleType:kt,accessibleTable:At=!0,description:Ot,summary:St,linkedCrosshairName:Ct,linkedCrosshairSourceId:Mt}=n,_t=t.useRef(!1),Pt=Tt({sizeProp:E,responsiveWidth:Y,responsiveHeight:G,userMargin:q,marginDefault:rn,animate:st,transitionProp:nt,themeDirtyRef:_t}),{reducedMotionRef:Lt,responsiveRef:Bt,size:Nt,currentTheme:Ht,transition:Ft,introEnabled:Rt,tableId:zt,rafRef:Wt,renderFnRef:$t,scheduleRender:Dt}=Pt;let Et=Pt.margin;if(pt){const e=60,t=Object.assign({},Pt.margin);pt.top&&e>t.top&&(t.top=e),pt.bottom&&e>t.bottom&&(t.bottom=e),pt.left&&e>t.left&&(t.left=e),pt.right&&e>t.right&&(t.right=e),Et=t}const Yt="function"==typeof qe?qe({size:Nt,margin:Et}):qe,Gt="function"==typeof Ge?Ge({size:Nt,margin:Et}):Ge,qt=Nt[0]-Et.left-Et.right,Xt=Nt[1]-Et.top-Et.bottom,Vt=null!=_e?_e:Ne,Ut=t.useRef(null),Qt=t.useRef(null),[Kt,Zt]=t.useState(0),[en,tn]=t.useState(null),ln=t.useRef(null),un=t.useRef(null),[dn,hn]=t.useState(null),gn=t.useRef(sn.primary),[pn,fn]=t.useState(!1),[yn,mn]=t.useState([]),[vn,bn]=t.useState([]),xn="streaming"===b||["bar","swarm","waterfall"].includes(y),kn=t.useMemo(()=>{var e,t,n;return{chartType:y,runtimeMode:xn?"streaming":"bounded",windowSize:H,windowMode:I,arrowOfTime:xn?T:"right",extentPadding:W,scalePadding:$,xAccessor:xn?void 0:A,yAccessor:xn?void 0:O,timeAccessor:xn?F:void 0,valueAccessor:N,colorAccessor:S,sizeAccessor:C,groupAccessor:M||(_?"_lineGroup":void 0),categoryAccessor:Qe,lineDataAccessor:_,xScaleType:yt,yScaleType:kt,xExtent:R,yExtent:z,sizeRange:D,binSize:B,normalize:L,boundsAccessor:ie,boundsStyle:re,y0Accessor:se,gradientFill:!0===ce?{topOpacity:.8,bottomOpacity:.05}:!1===ce?void 0:ce,areaGroups:de?new Set(de):void 0,lineGradient:ue,openAccessor:he,highAccessor:ge,lowAccessor:pe,closeAccessor:fe,candlestickStyle:be,lineStyle:U,pointStyle:Q,areaStyle:K,swarmStyle:ee,waterfallStyle:Z,colorScheme:oe,barColors:te,barStyle:J,annotations:He,decay:Ze,pulse:tt,transition:Ft,introAnimation:Rt,staleness:at,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ht,heatmapValueFormat:gt,pointIdAccessor:ft,curve:P,themeCategorical:null===(e=null==Ht?void 0:Ht.colors)||void 0===e?void 0:e.categorical,themeSemantic:k(Ht),themeSequential:null===(t=null==Ht?void 0:Ht.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Ht?void 0:Ht.colors)||void 0===n?void 0:n.diverging}},[y,H,I,T,W,$,A,O,F,N,yt,kt,S,C,M,Qe,_,R,z,D,B,L,ie,re,se,ce,ue,de,he,ge,pe,fe,be,U,Q,K,ee,Z,J,oe,te,He,Ze,tt,null==Ft?void 0:Ft.duration,null==Ft?void 0:Ft.easing,Rt,at,ct,ut,dt,ht,gt,xn,ft,P,Ht]),wn=t.useRef(null);wn.current||(wn.current=new ne(kn)),t.useEffect(()=>{var e;null===(e=wn.current)||void 0===e||e.updateConfig(kn),_t.current=!0,Dt()},[kn,Dt]);const jn=t.useRef(null);jn.current||(jn.current=new v(e=>{const t=wn.current;t&&t.ingest(e)&&(_t.current=!0,Dt())},{chunkThreshold:w,chunkSize:j})),t.useEffect(()=>{var e;null===(e=jn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:w,chunkSize:j})},[w,j]);const An=t.useCallback(e=>{var t;null===(t=jn.current)||void 0===t||t.push(e)},[]),On=t.useCallback(e=>{var t;null===(t=jn.current)||void 0===t||t.pushMany(e)},[]),Sn=t.useCallback(()=>{var e,t;null===(e=jn.current)||void 0===e||e.clear(),null===(t=wn.current)||void 0===t||t.clear(),_t.current=!0,Dt()},[Dt]);t.useImperativeHandle(o,()=>({push:An,pushMany:On,remove:e=>{var t,n,o;null===(t=jn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=wn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(ln.current&&i.some(e=>{var t;return e===(null===(t=ln.current)||void 0===t?void 0:t.data)})&&(ln.current=null,hn(null)),_t.current=!0,Dt()),i},update:(e,t)=>{var n,o,i;null===(n=jn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=wn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(_t.current=!0,Dt()),r},clear:Sn,getData:()=>{var e,t,n;return null===(e=jn.current)||void 0===e||e.flush(),null!==(n=null===(t=wn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=wn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=wn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[An,On,Sn,Dt]),t.useEffect(()=>{var e,t;if(x){if(_&&x.length>0&&"object"==typeof x[0]&&null!==x[0]){const t="string"==typeof _?_:"coordinates";if(Array.isArray(x[0][t])){const n=[];for(const e of x){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=jn.current)||void 0===e||e.setBoundedData(n))}}null===(t=jn.current)||void 0===t||t.setBoundedData(x)}},[x,_]);const{hoverHandlerRef:Cn,hoverLeaveRef:Mn,onPointerMove:_n,onPointerLeave:Pn}=Pt;Cn.current=e=>{if(!Vt)return;const t=Ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Et.left,i=e.clientY-n.top-Et.top;if(0>o||o>qt||0>i||i>Xt)return void(ln.current&&(ln.current=null,un.current=null,hn(null),Le&&(Le(null),_t.current=!0),Dt()));const r=wn.current;if(!r||0===r.scene.length)return;const s=ae(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);if(!s)return void(ln.current&&(ln.current=null,un.current=null,hn(null),Le&&Le(null),Dt()));const a=Jt(s.datum||{},s.x,s.y);if("multi"===Ie&&r.scene.length>0&&r.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=le(e.path,t,n);if(null===r)continue;const s=ye(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=le(e.topPath,t,n);if(null===r)continue;const s=ye(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:r,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(r.scene,s.x,Te),t=r.scales.y.invert,n=r.scales.x.invert;if(e.length>0){const o=n?n(s.x):s.x;a.xValue=o,a.xPx=s.x;const i=gn.current;a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||i,datum:e.datum}))}}ln.current=a,un.current=s.node,hn(a),Le&&(Le(a),_t.current=!0),Dt()},Mn.current=()=>{ln.current&&(ln.current=null,un.current=null,hn(null),Le&&(Le(null),_t.current=!0),Dt())};const Ln=t.useRef(()=>{});Ln.current=e=>{if(!Be)return;const t=Ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Et.left,i=e.clientY-n.top-Et.top;if(0>o||o>qt||0>i||i>Xt)return void Be(null);const r=wn.current;if(!r||0===r.scene.length)return void Be(null);const s=ae(r.scene,o,i,Te,r.quadtree,r.maxPointRadius);Be(s?Jt(s.datum||{},s.x,s.y):null)};const Bn=t.useCallback(e=>Ln.current(e),[]),Nn=t.useRef(-1),Tn=t.useRef(null),In=t.useRef(null),Hn=t.useCallback(e=>{const t=wn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(In.current&&In.current.version===n)o=In.current.graph;else{const e=function(e){var t,n,o,i;const r=[];for(const s of e)switch(s.type){case"point":r.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(t=s.group)&&void 0!==t?t:"_default"});break;case"line":{const e=s,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)r.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=s,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)r.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":r.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(i=s.group)&&void 0!==i?i:"_default"});break;case"heatcell":r.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:"_default"})}return r.sort((e,t)=>e.x-t.x||e.y-t.y),r}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),In.current={version:n,graph:o}}const i=Nn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Nn.current=0;const t=o.flat[0];Tn.current={shape:t.shape,w:t.w,h:t.h};const n=ve(t);return ln.current=n,hn(n),Le&&Le(n),void Dt()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?me(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?me(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Nn.current=-1,Tn.current=null,ln.current=null,un.current=null,hn(null),Le&&Le(null),void Dt();Nn.current=s;const a=o.flat[s];Tn.current={shape:a.shape,w:a.w,h:a.h};const l=ve(a);ln.current=l,hn(l),Le&&Le(l),Dt()},[Le,Dt]),Fn=t.useCallback(e=>{Nn.current=-1,Tn.current=null,_n(e)},[_n]);$t.current=()=>{var e,t;Wt.current=0;const n=Ut.current,o=Qt.current;if(!n||!o)return;const i=wn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Lt.current?r+1e6:r),a=!Lt.current&&s,l=_t.current||s;l&&!a&&i.computeScene({width:qt,height:Xt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return sn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||r?{axisStroke:l||sn.axisStroke,tickText:s||sn.tickText,crosshair:s?an(s,"66"):sn.crosshair,hoverFill:c?an(c,"4D"):sn.hoverFill,hoverStroke:s?an(s,"99"):sn.hoverStroke,pointRing:c||sn.pointRing,primary:r||sn.primary}:sn}(n);gn.current=u.primary;const d=null!==(e=null==at?void 0:at.threshold)&&void 0!==e?e:5e3,h=at&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=It(n,Nt,Et,c);if(e){if(e.clearRect(-Et.left,-Et.top,Nt[0],Nt[1]),h&&(e.globalAlpha=null!==(t=null==at?void 0:at.dimOpacity)&&void 0!==t?t:.5),"transparent"!==V&&!Ge){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=V||(t&&"transparent"!==t?t:null);o&&(e.fillStyle=o,e.fillRect(-Et.left,-Et.top,Nt[0],Nt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,qt,Xt),e.clip()),Xe&&i.scales)for(const t of Xe)e.save(),t(e,i.scene,i.scales,{width:qt,height:Xt}),e.restore();const o=on[y];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:qt,height:Xt});e.restore(),h&&(e.globalAlpha=1)}}{const e=It(o,Nt,Et,c);if(e&&(e.clearRect(-Et.left,-Et.top,Nt[0],Nt[1]),Vt&&ln.current&&i.scales&&function(e,t,n,o,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,ln.current,qt,Xt,"object"==typeof Vt?Vt:{},un.current,u),un.current&&Array.isArray(_e))){const t=_e.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s=n.group;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,un.current,t,u)}}l&&n&&n.setAttribute("aria-label",lt(i.scene,y+" chart"));const g=_t.current;if(_t.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!en||e(en.x.domain()[0])!==e(i.scales.x.domain()[0])||e(en.x.domain()[1])!==e(i.scales.x.domain()[1])||e(en.y.domain()[0])!==e(i.scales.y.domain()[0])||e(en.y.domain()[1])!==e(i.scales.y.domain()[1])||en.x.range()[0]!==i.scales.x.range()[0]||en.x.range()[1]!==i.scales.x.range()[1]||en.y.range()[0]!==i.scales.y.range()[0]||en.y.range()[1]!==i.scales.y.range()[1])&&tn(i.scales),pt){const e=i.getData(),t="function"==typeof A?A:e=>e[A||"x"],n="function"==typeof O?O:e=>e[O||"y"];mn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),bn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&He&&He.length>0&&Zt(e=>e+1),(null==at?void 0:at.showBadge)&&fn(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Wt.current=requestAnimationFrame(()=>$t.current()))},t.useEffect(()=>(Dt(),()=>{var e;null===(e=jn.current)||void 0===e||e.clear()}),[Dt]),t.useEffect(()=>{_t.current=!0,Dt()},[y,qt,Xt,xe,V,U,Xe,Dt]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(at,wn,_t,Dt,pn,fn);const Rn=t.useMemo(()=>{if(Oe||Ce)return;const e=wn.current;return(null==e?void 0:e.xIsDate)&&en?nn(en.x.domain()):void 0},[Oe,Ce,en]),zn=Oe||Ce||Rn,Wn=Vt&&dn?Pe?Pe(dn):e.jsx(cn,{hover:dn}):null,$n=Wn?e.jsx(jt,{x:dn.x,y:dn.y,containerWidth:qt,containerHeight:Xt,margin:Et,className:"stream-frame-tooltip",children:Wn}):null,Dn=Tn.current,En=e.jsx(wt,{active:Nn.current>=0,hoverPoint:dn,margin:Et,size:Nt,shape:null==Dn?void 0:Dn.shape,width:null==Dn?void 0:Dn.w,height:null==Dn?void 0:Dn.h}),Yn=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},Gn=Yn(A,F,"__semiotic_resolvedX","__semiotic_resolvedTime"),qn=Yn(O,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),Xn=Gn.key,Vn=qn.key,Un=He&&He.length>0,Qn=e=>{if(!e||!Un||!Gn.fn&&!qn.fn)return e;let t=!1;const n=e.map(e=>{const n=Gn.fn&&Gn.key&&!(Gn.key in e),o=qn.fn&&qn.key&&!(qn.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[Gn.key]=Gn.fn(e)),o&&(i[qn.key]=qn.fn(e)),i});return t?n:e};if(rt){const t=wn.current;t&&x&&(t.ingest({inserts:x,bounded:!0}),t.computeScene({width:qt,height:Xt}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,s=zn||(()=>{if((null==t?void 0:t.xIsDate)&&o)return nn(o.x.domain())})();return e.jsxs("div",{className:"stream-xy-frame"+(X?" "+X:""),role:"img","aria-label":Ot||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:Nt[0],height:Nt[1]},children:[e.jsx(vt,{summary:St}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Nt[0],height:Nt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Et.left},${Et.top})`,children:Gt}),e.jsxs("g",{transform:`translate(${Et.left},${Et.top})`,children:[V&&e.jsx("rect",{x:0,y:0,width:qt,height:Xt,fill:V}),Ve&&o&&Ve.map((t,i)=>e.jsx(g.Fragment,{children:t(n,o,{width:qt,height:Xt})},"svgpre-"+i)),n.map((t,n)=>function(t,n){var o,i,r;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const r=t;if(0===r.topPath.length)return null;const s=r.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:`M${s}L${a}Z`,fill:it(r.style.fill),fillOpacity:null!==(i=null!==(o=r.style.fillOpacity)&&void 0!==o?o:r.style.opacity)&&void 0!==i?i:.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:it(o.style.fill),opacity:null!==(r=o.style.opacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:it(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[i,r,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),a=.299*i+.587*r+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n)).filter(Boolean)]})]}),e.jsx(ot,{width:qt,height:Xt,totalWidth:Nt[0],totalHeight:Nt[1],margin:Et,scales:o,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:s,yFormat:Se||Me,showGrid:Re,title:Ue,legend:ze,legendHoverBehavior:We,legendClickBehavior:$e,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Ye,foregroundGraphics:Yt,marginalGraphics:pt,xValues:[],yValues:[],annotations:He,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:Xn,yAccessor:Vn,annotationData:Qn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof P?P:void 0,linkedCrosshairName:Ct,linkedCrosshairSourceId:Mt})]})}return e.jsxs("div",{ref:Bt,className:"stream-xy-frame"+(X?" "+X:""),role:"group","aria-label":Ot||("string"==typeof Ue?Ue:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Nt[0],height:G?"100%":Nt[1],overflow:"visible"},onKeyDown:Hn,children:[At&&e.jsx(bt,{tableId:zt}),At&&e.jsx(mt,{scene:null!==(a=null===(s=wn.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:y+" chart",tableId:zt,chartTitle:"string"==typeof Ue?Ue:void 0}),e.jsx(vt,{summary:St}),e.jsxs("div",{role:"img","aria-label":Ot||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Vt?Fn:void 0,onMouseLeave:Vt?Pn:void 0,onClick:Be?Bn:void 0,children:[Gt&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Nt[0],height:Nt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Et.left},${Et.top})`,children:Gt})}),e.jsx(et,{width:qt,height:Xt,totalWidth:Nt[0],totalHeight:Nt[1],margin:Et,scales:en,showAxes:xe,axes:ke,showGrid:Re,xFormat:zn,yFormat:Se||Me}),e.jsx("canvas",{ref:Ut,"aria-label":lt(null!==(c=null===(l=wn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],y+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:Qt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(xt,{hoverPoint:dn}),e.jsx(ot,{width:qt,height:Xt,totalWidth:Nt[0],totalHeight:Nt[1],margin:Et,scales:en,showAxes:xe,axes:ke,xLabel:we,yLabel:je,yLabelRight:Ae,xFormat:zn,yFormat:Se||Me,showGrid:Re,title:Ue,legend:ze,legendHoverBehavior:We,legendClickBehavior:$e,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Ye,foregroundGraphics:Yt,marginalGraphics:pt,xValues:yn,yValues:vn,annotations:He,svgAnnotationRules:Fe,annotationFrame:Kt,xAccessor:Xn,yAccessor:Vn,annotationData:Qn(null===(u=wn.current)||void 0===u?void 0:u.getData()),pointNodes:null===(d=wn.current)||void 0===d?void 0:d.scene.filter(e=>"point"===e.type),curve:"string"==typeof P?P:void 0,underlayRendered:!0,linkedCrosshairName:Ct,linkedCrosshairSourceId:Mt}),(Ke||Je)&&e.jsx(m,{width:qt,height:Xt,totalWidth:Nt[0],totalHeight:Nt[1],margin:Et,dimension:null!==(h=null==Ke?void 0:Ke.dimension)&&void 0!==h?h:"xy",scales:en,onBrush:null!=Je?Je:()=>{},binSize:B,snap:null==Ke?void 0:Ke.snap,binBoundaries:null!==(p=null==Ke?void 0:Ke.binBoundaries)&&void 0!==p?p:"bar"===y?null===(f=wn.current)||void 0===f?void 0:f.getBinBoundaries():void 0,snapDuring:null==Ke?void 0:Ke.snapDuring,streaming:"streaming"===b}),(null==at?void 0:at.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===at.badgePosition?{top:4,left:4}:"bottom-left"===at.badgePosition?{bottom:4,left:4}:"bottom-right"===at.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:pn?"#dc3545":"#28a745",color:"white"}),children:pn?"STALE":"LIVE"}),En,$n]})]})});un.displayName="StreamXYFrame";const dn=t.createContext(null);function hn(){return t.useContext(dn)}function gn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[fn,yn]=b(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[mn,vn]=b(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function bn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=yn(e=>e.selections.get(i)),s=yn(e=>e.setClause),a=yn(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function xn(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=bn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}function kn(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=bn({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&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])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}const wn=t.createContext(!1);function jn({selections:e}){const n=yn(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function An({categoryColors:n,interaction:o,selectionName:i,field:r}){const s=Object.entries(n);if(0===s.length)return null;const a=s.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=xn({name:i,fields:[r]}),u=bn({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[g,p]=t.useState(null),f=t.useRef(u.selectPoints);f.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(d.size>0?f.current({[r]:Array.from(d)}):y.current())},[o,d,r]);const m=t.useCallback(e=>{"highlight"===o&&(e?(p(e.label),c.onHover({[r]:e.label})):(p(null),c.onHover(null)))},[o,r,c]),v=t.useCallback(e=>{"isolate"===o&&h(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===a.length?new Set:n})},[o,a.length]),[b,[x]]=At([0,0],!0,!1),k=t.useMemo(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(s.map(([e])=>e),x),[s,x]);return e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(Oe,{legendGroups:l,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:g,isolatedCategories:d})})})}function On({children:t,selections:n,showLegend:o,legendPosition:i="top",legendInteraction:r="none",legendSelectionName:s="legend",legendField:a="category"}){const l=hn(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.jsx(fn,{children:e.jsxs(mn,{children:[n&&e.jsx(jn,{selections:n}),e.jsxs(wn.Provider,{value:c,children:[c&&"top"===i&&l&&e.jsx(An,{categoryColors:l,interaction:r,selectionName:s,field:a}),t,c&&"bottom"===i&&l&&e.jsx(An,{categoryColors:l,interaction:r,selectionName:s,field:a})]})]})})}function Sn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):R[r%R.length];return{label:i+"",color:a}}),label:""}]}}function Cn(e){return e?"string"==typeof e?{name:e}:e:null}function Mn(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function _n(){return M(e=>e.theme)}g.createContext(void 0);const Pn="#007bff";function Ln(){var e;const t=_n(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Bn(e,n,o){const i=hn(),r=Ln();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=$(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return $(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=$(e,n,s);return e=>i[e]||t(e)}return $(e,n,s)}if(i&&Object.keys(i).length>0){const e=$([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}function Nn({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),g=bn({name:(null==e?void 0:e.name)||"__unused__"}),p=xn({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),f=vn(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=De.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(De={positions:new Map(De.positions).set(e,{xValue:t,sourceId:n})},Ye())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Ge(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||f){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),f&&f(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),f&&f(e)}}},[n,p,h,d,r,s,a,f,c,b]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=De.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(De.positions);return t.delete(e),De={positions:t},Ye(),!1}De={positions:new Map(De.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ye()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||f){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),f&&f(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),f&&f(e)}}},[l,r,f,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{qe(e,d),Ge(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Tn(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function In({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(wn),u=void 0!==i?i:!c&&!!n,d=t.useMemo(()=>{if(!u||!n)return;const t=Sn({data:e,colorBy:n,colorScale:o,getColor:W,categories:l});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[u,n,e,o,l]),h=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return d&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[a,s,d,r]);return{legend:d,margin:h,legendPosition:r}}function Hn(e,n,o){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const Fn={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 Rn(e,t,n){var o,i,r,s,a,l,c;const u=Fn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:zn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function zn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Wn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const $n={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Dn(e,t){return"function"==typeof t?t(e):e[t]}function En(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Yn(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Dn(t,o);a=En(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=Dn(t,o);l.push({label:n,value:En(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=En(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=En(t[e[0]],i))}}const c=Object.assign(Object.assign({},$n),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Gn(t){if(!0===t)return Yn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.jsx("div",{className:"semiotic-tooltip",style:$n,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Yn(t):Yn())}function qn(e){return"string"==typeof e?e:"value"}function Xn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Vn(e,t){if(!t)return Xn(e);try{const n=t(e);return null==n?Xn(e):n}catch(t){return Xn(e)}}function Un(e,t){return"function"==typeof t?t(e):e[t]}function Qn(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=n?Vn(Un(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:$n,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((t,n)=>{const o=Vn(Un(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function Kn({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,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"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class Jn extends g.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.jsx(Kn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Zn(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function eo(e,t,n=3){let o,i=n+1;for(const n of t){const t=Zn(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function to(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function no(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=eo(e,t,3))&&void 0!==n?n:null)}function oo({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=to(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=no(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const io={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:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},ro={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},so={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},ao=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],lo=["vertical","horizontal"],co={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},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({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},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({},io),ro),{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({},io),ro),{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({},io),ro),{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"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},io),ro),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:lo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},io),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},io),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},io),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},io),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},io),{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({},io),{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:lo},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({},io),{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({},io),{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({},io),{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({},io),{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"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},io),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},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"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},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"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},io),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},io),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},io),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},io),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},io),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},io),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function uo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ho=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),go=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),po=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),fo=new Set(["LineChart","AreaChart","StackedAreaChart"]),yo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function mo(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function vo(e,t){const n=mo(e),o=mo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const bo=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function xo(e,t){const n=[],o=function(e,t){const n=[],o=co[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(co).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!uo(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=eo(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=oo({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=to(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=no(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return co[e]?(function(e,t,n){const o=co[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=co[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ho.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){go.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=co[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!po.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!fo.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=co[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!yo.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=vo(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=vo(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of bo)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var ko;const wo="undefined"!=typeof process&&"production"!==(null===(ko=process.env)||void 0===ko?void 0:ko.NODE_ENV);function jo({componentName:t,width:n,height:o,chartProps:i,children:r}){return e.jsx(Jn,{fallback:r=>{let s="";if(wo&&i)try{const e=xo(t,i);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.jsx(Kn,{componentName:t,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const Ao={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Oo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function So(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Ao),{width:n,height:o}),children:i||"No data available"}):null}function Co(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),a=Math.floor((o-(i*(r+s)-s))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Oo),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Mo(e,t,n,o){if(!wo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function _o(e){const n=M(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Po(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Lo="__forecastSegment";let Bo=null;function No(){return Po(this,void 0,void 0,function*(){return Bo||(Bo=yield Promise.resolve().then(function(){return di})),Bo})}const To=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:p="y",lineBy:f,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:v,curve:b="linear",showPoints:x=!1,pointRadius:k=3,fillArea:w=!1,areaOpacity:j=.3,lineWidth:A=2,lineGradient:O,tooltip:S,pointIdAccessor:C,annotations:M,directLabel:_,gapStrategy:P="break",anomaly:L,forecast:B,frameProps:N={},selection:T,linkedHover:I,onObservation:H,onClick:F,hoverHighlight:R,hoverRadius:z,chartId:$,loading:D,emptyContent:E,legendInteraction:Y,legendPosition:G,xScaleType:q,yScaleType:X,color:V,stroke:U,strokeWidth:Q,opacity:K}=n,J=a.width,Z=a.height,ee=a.enableHover,te=a.showGrid,ne=a.showLegend,oe=a.title,ie=a.description,re=a.summary,se=a.accessibleTable,ae=a.xLabel,le=a.yLabel,ce=Co(D,J,Z),ue=ce?null:So(l,J,Z,E),de=l||[];Mo("LineChart",de,"xAccessor",g),Mo("LineChart",de,"yAccessor",p);const he="string"==typeof g?g:"__semiotic_resolvedX",ge="string"==typeof p?p:"__semiotic_resolvedY",[pe,fe]=t.useState(null),[ye,me]=t.useState([]),ve=t.useMemo(()=>{if(!B&&!L)return de;const e="function"==typeof g,t="function"==typeof p;return e||t?de.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=g(n)),t&&(o.__semiotic_resolvedY=p(n)),o}):de},[de,B,L,g,p]),be=t.useRef(B),xe=t.useRef(L);t.useEffect(()=>{if(!B&&!L)return void((be.current||xe.current)&&(fe(null),me([]),be.current=B,xe.current=L));let e=!1;const t=B!==be.current||L!==xe.current;if(be.current=B,xe.current=L,t&&(fe(null),me([])),B){const t=f&&"string"==typeof f&&"object"==typeof B?Object.assign(Object.assign({},B),{_groupBy:f}):B;(function(...e){return Po(this,void 0,void 0,function*(){return(yield No()).buildForecast(...e)})})(ve,he,ge,t,L).then(t=>{e||(fe(t),me(t.annotations))}).catch(()=>{e||(fe(null),me([]))})}else L&&function(...e){return Po(this,void 0,void 0,function*(){return(yield No()).buildAnomalyAnnotations(...e)})}(L).then(t=>{e||(fe(null),me(t))}).catch(()=>{e||me([])});return()=>{e=!0}},[ve,B,L,he,ge]);const ke=pe?pe.processedData:de,we="__compoundGroup",je=!(!B||!f),Ae=je?we:B?Lo:f,Oe=t.useMemo(()=>{if(!je)return ke;const e="function"==typeof f?f:e=>e[f];return ke.map(t=>{const n=Object.assign({},t);return n[we]=`${e(t)}__${t[Lo]||"observed"}`,n})},[ke,je,f]),Se=je?Oe:ke,Ce=t.useMemo(()=>{if(!B)return;const e=B.upperBounds,t=B.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=pe?pe.processedData:de;for(const e of s){const t="function"==typeof p?p(e):+e[p];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[B,pe,de,p]),{activeSelectionHook:Me,hoverSelectionHook:_e,customHoverBehavior:Pe,customClickBehavior:Le,crosshairSourceId:Be}=Nn({selection:T,linkedHover:I,fallbackFields:m?["string"==typeof m?m:""]:[],onObservation:H,onClick:F,chartType:"LineChart",chartId:$,hoverHighlight:R,colorByField:"string"==typeof m?m:void 0}),Ne=_o(T),Te=Tn(I,Be),Ie=t.useCallback(e=>{const t="function"==typeof g?g(e):e[g],n="function"==typeof p?p(e):e[p];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[g,p]),He=void 0!==(null===(i=Se[0])||void 0===i?void 0:i[y]),Fe=t.useMemo(()=>{if(He)return Se;if(Ae){const e=Se.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[y]:[]};"string"==typeof Ae&&(o[Ae]=n),je&&(o[Lo]=t[Lo],"string"==typeof f&&(o[f]=t[f])),e[n]=o}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:Se}]},[Se,Ae,y,He]),{gapProcessedLineData:Re,hasGaps:ze}=t.useMemo(()=>{if("interpolate"===P){let e=!1;const t=[];for(const n of Fe){const o=(n[y]||[]).filter(t=>!Ie(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===P){let e=!1;const t=[];for(const n of Fe){const o=n[y]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const a of o)if(Ie(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[y]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===P){let e=!1;const t="string"==typeof p?p:"y",n=[];for(const o of Fe){const i=o[y]||[],r=[];for(const n of i)Ie(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[y]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Fe,hasGaps:!1}},[Fe,P,y,Ie,Ae,p]),We=Bn(ke,m,v),$e=t.useMemo(()=>{if(!m)return[];const e=new Set;for(const t of ke){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[ke,m]),De=Hn(Y,m,$e),Ee=t.useMemo(()=>_e||(De.legendSelectionHook?De.legendSelectionHook:Me),[_e,De.legendSelectionHook,Me]),Ye=t.useMemo(()=>(e,t)=>{const n={strokeWidth:A},o=!0===w||Array.isArray(w)&&null!=t&&w.includes(t);return m?We&&(n.stroke=W(e,m,We),o&&(n.fill=n.stroke,n.fillOpacity=j)):(n.stroke=V||Pn,o&&(n.fill=V||Pn,n.fillOpacity=j)),n},[m,We,A,w,j,V]),[Ge,qe]=t.useState(null);t.useEffect(()=>{if(!B)return void qe(null);let e=!1;return function(...e){return Po(this,void 0,void 0,function*(){return(yield No()).createSegmentLineStyle(...e)})}(Ye,B).then(t=>{e||qe(()=>t)}).catch(()=>{e||qe(null)}),()=>{e=!0}},[Ye,B]);const Xe=Ge||Ye,Ve=t.useMemo(()=>Wn(Xe,{stroke:U,strokeWidth:Q,opacity:K}),[Xe,U,Q,K]),Ue=t.useMemo(()=>Mn(Ve,Ee,Ne),[Ve,Ee,Ne]),Qe=t.useMemo(()=>{if(x)return e=>{const t={r:k,fillOpacity:1};return m?We&&(t.fill=W(e.parentLine||e,m,We)):t.fill=V||Pn,t}},[x,k,m,We,V]),Ke=Array.isArray(w)?"mixed":w?"area":"line",Je="object"==typeof _?_:{},Ze=Je.position||"end",et=Je.fontSize||11,tt=t.useMemo(()=>{var e,t;if(!_||!m)return[];const n="function"==typeof g?g:e=>e[g],o="function"==typeof p?p:e=>e[p],i="function"==typeof m?m:e=>e[m],r=new Map;for(const n of Re){const o=n[y]||[];if(0===o.length)continue;const s="end"===Ze?o[o.length-1]:o[0],a=null!==(t=null!==(e=i(s))&&void 0!==e?e:i(n))&&void 0!==t?t:"";a&&!r.has(a+"")&&r.set(a+"",s)}const s=Array.from(r.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof g?g:"x"]:n(t),["string"==typeof p?p:"y"]:o(t),dx:"end"===Ze?6:-6,dy:0,color:We?We(e):Pn,fontSize:et}));s.sort((e,t)=>{const n="string"==typeof p?p:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof p?p:"y",n=s[e-1],o=s[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return s},[_,m,We,Re,y,g,p,Ze,et]),nt=(!_||void 0!==ne)&&ne,ot=t.useMemo(()=>{if(!_)return a.marginDefaults;const e=tt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*et);return Math.max(e,o)},0),t=e+10,n="end"===Ze?"right":"left";return Object.assign(Object.assign({},a.marginDefaults),{[n]:Math.max(a.marginDefaults[n]||0,t)})},[_,tt,et,Ze,a.marginDefaults]),{legend:it,margin:rt,legendPosition:st}=In({data:Re,colorBy:m,colorScale:We,showLegend:nt,legendPosition:G,userMargin:c,defaults:ot}),at=f||m,lt=t.useMemo(()=>Qn([{label:ae||qn(g),accessor:g,role:"x",format:d},{label:le||qn(p),accessor:p,role:"y",format:h},...at?[{label:qn(at),accessor:at,role:"group"}]:[]]),[g,p,ae,le,at,d,h]),ct=oo({componentName:"LineChart",data:He?(null===(r=ke[0])||void 0===r?void 0:r[y])||[]:l,accessors:{xAccessor:g,yAccessor:p}}),ut=t.useMemo(()=>He||Ae||ze?Re.flatMap(e=>{const t=e[y]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Se,[Re,y,He,Ae,Se,ze]),dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ke},Array.isArray(w)&&{areaGroups:w}),O&&{lineGradient:O}),null!=z&&{hoverRadius:z}),null!=l&&{data:ut}),{xAccessor:g,yAccessor:p,xScaleType:q,yScaleType:X}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===P&&ze?"_gapSegment":Ae||void 0,curve:b,lineStyle:Ue}),x&&{pointStyle:Qe}),{size:[J,Z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:rt,showAxes:a.showAxes,xLabel:ae,yLabel:le,xFormat:d,yFormat:h,enableHover:ee,showGrid:te}),it&&{legend:it,legendPosition:st}),Y&&"none"!==Y&&{legendHoverBehavior:De.onLegendHover,legendClickBehavior:De.onLegendClick,legendHighlightedCategory:De.highlightedCategory,legendIsolatedCategories:De.isolatedCategories}),oe&&{title:oe}),ie&&{description:ie}),re&&{summary:re}),void 0!==se&&{accessibleTable:se}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===S?()=>null:"multi"===S?t=>{var n,o,i,r,s,a,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const a=null!==(s=null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y)&&void 0!==r?r:t.value)&&void 0!==s?s:t.y;return e.jsx("div",{className:"semiotic-tooltip",style:$n,children:e.jsx("div",{children:En(a)})})}const g=null!==(d=null!==(c=null!==(a=t.xValue)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.jsxs("div",{className:"semiotic-tooltip",style:$n,children:[null!=g&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:En(g)}),h.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:En(t.value)})]},n))]})}:Gn(S)||lt}),"multi"===S&&{tooltipMode:"multi"}),(I||H||F||R)&&{customHoverBehavior:Pe}),(H||F||I)&&{customClickBehavior:Le}),C&&{pointIdAccessor:C}),((null==M?void 0:M.length)||ye.length||tt.length)&&{annotations:[...M||[],...ye,...tt]}),Te),N);return ce||ue||(ct?e.jsx(Kn,{componentName:"LineChart",message:ct,width:J,height:Z}):e.jsx(jo,{componentName:"LineChart",width:J,height:Z,children:e.jsx(un,Object.assign({ref:s},dt))}))});To.displayName="LineChart";const Io=t.forwardRef(function(n,o){var i;const r=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=Rn(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:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:p,y0Accessor:f,gradientFill:y=!1,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="monotoneX",areaOpacity:k=.7,lineGradient:w,showLine:j=!0,lineWidth:A=2,showPoints:O=!1,pointRadius:S=3,tooltip:C,annotations:M,frameProps:_={},selection:P,linkedHover:L,onObservation:B,onClick:N,hoverHighlight:T,chartId:I,loading:H,emptyContent:F,legendInteraction:R,legendPosition:z,color:$,stroke:D,strokeWidth:E,opacity:Y}=n,G=s.width,q=s.height,X=s.enableHover,V=s.showGrid,U=s.showLegend,Q=s.title,K=s.description,J=s.summary,Z=s.accessibleTable,ee=s.xLabel,te=s.yLabel,ne=Co(H,G,q),oe=ne?null:So(a,G,q,F),ie=a||[];Mo("AreaChart",ie,"xAccessor",h),Mo("AreaChart",ie,"yAccessor",g);const{activeSelectionHook:re,hoverSelectionHook:se,customHoverBehavior:ae,customClickBehavior:le,crosshairSourceId:ce}=Nn({selection:P,linkedHover:L,fallbackFields:v?["string"==typeof v?v:""]:[],onObservation:B,onClick:N,chartType:"AreaChart",chartId:I,hoverHighlight:T,colorByField:"string"==typeof v?v:void 0}),ue=_o(P),de=Tn(L,ce),he=void 0!==(null===(i=ie[0])||void 0===i?void 0:i[m]),ge=t.useMemo(()=>{if(he)return ie;if(p){const e=ie.reduce((e,t)=>{const n="function"==typeof p?p(t):t[p];if(!e[n]){const t={[m]:[]};"string"==typeof p&&(t[p]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:ie}]},[ie,p,m,he]),pe=Bn(ie,v,b),fe=t.useMemo(()=>{if(!v)return[];const e=new Set;for(const t of ie){const n="function"==typeof v?v(t):t[v];null!=n&&e.add(n+"")}return Array.from(e)},[ie,v]),ye=Hn(R,v,fe),me=t.useMemo(()=>se||(ye.legendSelectionHook?ye.legendSelectionHook:re),[se,ye.legendSelectionHook,re]),ve=t.useMemo(()=>e=>{const t={};if(v){if(pe){const n=W(e,v,pe);t.fill=n,j?(t.stroke=n,t.strokeWidth=A):t.stroke="none"}}else{const e=$||Pn;t.fill=e,j?(t.stroke=e,t.strokeWidth=A):t.stroke="none"}return t.fillOpacity=k,t},[v,pe,$,k,j,A]),be=t.useMemo(()=>Wn(ve,{stroke:D,strokeWidth:E,opacity:Y}),[ve,D,E,Y]),xe=t.useMemo(()=>Mn(be,me,ue),[be,me,ue]),ke=t.useMemo(()=>{if(O)return e=>{const t={r:S,fillOpacity:1};return v?pe&&(t.fill=W(e.parentLine||e,v,pe)):t.fill=Pn,t}},[O,S,v,pe]),{legend:we,margin:je,legendPosition:Ae}=In({data:ge,colorBy:v,colorScale:pe,showLegend:U,legendPosition:z,userMargin:l,defaults:s.marginDefaults}),Oe=p||v,Se=t.useMemo(()=>Qn([{label:ee||qn(h),accessor:h,role:"x",format:u},{label:te||qn(g),accessor:g,role:"y",format:d},...Oe?[{label:qn(Oe),accessor:Oe,role:"group"}]:[]]),[h,g,ee,te,Oe,u,d]),Ce=oo({componentName:"AreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),Me=t.useMemo(()=>he||p?ge.flatMap(e=>{const t=e[m]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):ie,[ge,m,he,p,ie]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=a&&{data:Me}),{xAccessor:h,yAccessor:g,groupAccessor:p||void 0}),f&&{y0Accessor:f}),y&&{gradientFill:y}),w&&{lineGradient:w}),{curve:x,lineStyle:xe}),O&&ke&&{pointStyle:ke}),{size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:je,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:d,enableHover:X}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:V}),we&&{legend:we,legendPosition:Ae}),R&&"none"!==R&&{legendHoverBehavior:ye.onLegendHover,legendClickBehavior:ye.onLegendClick,legendHighlightedCategory:ye.highlightedCategory,legendIsolatedCategories:ye.isolatedCategories}),Q&&{title:Q}),K&&{description:K}),J&&{summary:J}),void 0!==Z&&{accessibleTable:Z}),c&&{className:c}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===C?()=>null:Gn(C)||Se}),(L||B||N||T)&&{customHoverBehavior:ae}),(B||N||L)&&{customClickBehavior:le}),M&&M.length>0&&{annotations:M}),de),_);return ne||oe||(Ce?e.jsx(Kn,{componentName:"AreaChart",message:Ce,width:G,height:q}):e.jsx(jo,{componentName:"AreaChart",width:G,height:q,children:e.jsx(un,Object.assign({ref:r},_e))}))});function Ho({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=t.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,u]),h=t.useCallback(e=>t=>{d([t]),e(t)},[d]),g=t.useCallback(e=>t=>{d(t),e(t)},[d]),p=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]),f=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)?o:R,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],r[e%r.length]);const l="string"==typeof n?n:"__streamCat";return Sn({data:t.map(e=>({[l]:e})),colorBy:l,colorScale:e=>s.get(e)||"#999",getColor:W})},[e,n,i,o,l]),y=t.useMemo(()=>{if(f)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[f,r]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:f,streamingMarginAdjust:y}}Io.displayName="AreaChart";const Fo=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=Rn(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:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:p,lineDataAccessor:f="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:j=3,normalize:A=!1,tooltip:O,annotations:S,frameProps:C={},selection:M,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:B,chartId:N,loading:T,emptyContent:I,legendInteraction:H,legendPosition:F,color:R,stroke:z,strokeWidth:$,opacity:D}=n,E=s.width,Y=s.height,G=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,Q=s.summary,K=s.accessibleTable,J=s.xLabel,Z=s.yLabel,ee=Co(T,E,Y),te=ee?null:So(a,E,Y,I),ne=a||[],oe=Ho({isPushMode:void 0===a,colorBy:y||p,colorScheme:m,showLegend:X,legendPosition:F}),ie=t.useCallback(oe.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[oe.wrapPush]),re=t.useCallback(oe.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[oe.wrapPushMany]);t.useImperativeHandle(o,()=>({push:ie,pushMany:re,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;oe.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ie,re,oe.resetCategories]);const{activeSelectionHook:se,hoverSelectionHook:ae,customHoverBehavior:le,customClickBehavior:ce,crosshairSourceId:ue}=Nn({selection:M,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:P,onClick:L,chartType:"StackedAreaChart",chartId:N,hoverHighlight:B,colorByField:"string"==typeof y?y:void 0}),de=_o(M),he=Tn(_,ue),ge=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[f]),pe=t.useMemo(()=>{if(ge)return ne;if(p){const e=ne.reduce((e,t)=>{const n="function"==typeof p?p(t):t[p];if(!e[n]){const t={[f]:[]};"string"==typeof p&&(t[p]=n),e[n]=t}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:ne}]},[ne,p,f,ge]),fe=Bn(ne,y,m),ye=t.useMemo(()=>{if(!y)return[];const e=new Set;for(const t of ne){const n="function"==typeof y?y(t):t[y];null!=n&&e.add(n+"")}return Array.from(e)},[ne,y]),me=Hn(H,y,ye),ve=t.useMemo(()=>ae||(me.legendSelectionHook?me.legendSelectionHook:se),[ae,me.legendSelectionHook,se]),be=t.useMemo(()=>e=>{const t={};if(y&&fe){const n=W(e,y,fe);t.fill=n,x?(t.stroke=n,t.strokeWidth=k):t.stroke="none"}else if(!y){const e=R||Pn;t.fill=e,t.stroke=x?e:"none",x&&(t.strokeWidth=k)}return t.fillOpacity=b,t},[y,fe,b,x,k,R]),xe=t.useMemo(()=>Wn(be,{stroke:z,strokeWidth:$,opacity:D}),[be,z,$,D]),ke=t.useMemo(()=>Mn(xe,ve,de),[xe,ve,de]),we=t.useMemo(()=>{if(w)return e=>{const t={r:j,fillOpacity:1};return y?fe&&(t.fill=W(e.parentLine||e,y,fe)):t.fill=R||Pn,t}},[w,j,y,fe,R]),{legend:je,margin:Ae,legendPosition:Oe}=In({data:pe,colorBy:y,colorScale:fe,showLegend:X,legendPosition:F,userMargin:l,defaults:s.marginDefaults}),Se=oe.streamingLegend||je,Ce=F||Oe,Me=t.useMemo(()=>{if(oe.streamingMarginAdjust){const e=Object.assign({},Ae);for(const[t,n]of Object.entries(oe.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ae},[Ae,oe.streamingMarginAdjust]),_e=p||y,Pe=t.useMemo(()=>Qn([{label:J||qn(h),accessor:h,role:"x",format:u},{label:Z||qn(g),accessor:g,role:"y",format:d},..._e?[{label:qn(_e),accessor:_e,role:"group"}]:[]]),[h,g,J,Z,_e,u,d]),Le=oo({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),Be=t.useMemo(()=>ge||p?pe.flatMap(e=>{const t=e[f]||[];return p&&"string"==typeof p?t.map(t=>Object.assign(Object.assign({},t),{[p]:e[p]})):t}):ne,[pe,f,ge,p,ne]),Ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=a&&{data:Be}),{xAccessor:h,yAccessor:g,groupAccessor:p||void 0,curve:v,normalize:A,lineStyle:ke}),w&&we&&{pointStyle:we}),{size:[E,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Me,showAxes:s.showAxes,xLabel:J,yLabel:Z,xFormat:u,yFormat:d,enableHover:G}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:q}),Se&&{legend:Se,legendPosition:Ce}),H&&"none"!==H&&{legendHoverBehavior:me.onLegendHover,legendClickBehavior:me.onLegendClick,legendHighlightedCategory:me.highlightedCategory,legendIsolatedCategories:me.isolatedCategories}),V&&{title:V}),U&&{description:U}),Q&&{summary:Q}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===O?()=>null:Gn(O)||Pe}),(_||P||L||B)&&{customHoverBehavior:le}),(P||L||_)&&{customClickBehavior:ce}),S&&S.length>0&&{annotations:S}),he),C);return ee||te||(Le?e.jsx(Kn,{componentName:"StackedAreaChart",message:Le,width:E,height:Y}):e.jsx(jo,{componentName:"StackedAreaChart",width:E,height:Y,children:e.jsx(un,Object.assign({ref:r},Ne))}))});function Ro(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:f,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:j}=e,A="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:S,customHoverBehavior:C,customClickBehavior:M,crosshairSourceId:_}=Nn({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v,hoverHighlight:b,colorByField:A}),P=Tn(c,_),L=Bn(n,i,r),B=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of n){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[n,i]),N=Hn(s,i,B),T=t.useMemo(()=>S||(N.legendSelectionHook?N.legendSelectionHook:O),[S,N.legendSelectionHook,O]),I=_o(l),{legend:H,margin:F,legendPosition:R}=In({data:n,colorBy:i,colorScale:L,showLegend:f,legendPosition:a,userMargin:y,defaults:m}),z=t.useMemo(()=>{const e={};return H&&(e.legend=H,e.legendPosition=R),s&&"none"!==s&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[H,R,s,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),W=Co(x,w,j),$=W?null:So(o,w,j,k);return{colorScale:L,allCategories:B,legendState:N,effectiveSelectionHook:T,activeSelectionHook:O,customHoverBehavior:C,customClickBehavior:M,legend:H,margin:F,legendPosition:R,earlyReturn:W||$||null,legendBehaviorProps:z,crosshairProps:P,resolvedSelection:I}}Fo.displayName="StackedAreaChart";const zo=t.forwardRef(function(n,o){const i=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const r=Rn(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",colorBy:p,colorScheme:f,sizeBy:y,sizeRange:m=[3,15],pointRadius:v=5,pointOpacity:b=.8,tooltip:x,marginalGraphics:k,pointIdAccessor:w,annotations:j,frameProps:A={},selection:O,linkedHover:S,linkedBrush:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:B,emptyContent:N,legendInteraction:T,legendPosition:I,color:H,stroke:F,strokeWidth:R,opacity:z}=n,$=r.width,E=r.height,Y=r.enableHover,G=r.showGrid,q=r.title,X=r.description,V=r.summary,U=r.accessibleTable,Q=r.xLabel,K=r.yLabel,J=s||[],Z=Ro({data:J,rawData:s,colorBy:p,colorScheme:f,legendInteraction:T,legendPosition:I,selection:O,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:M,onClick:_,hoverHighlight:P,chartType:"Scatterplot",chartId:L,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:B,emptyContent:N,width:$,height:E}),ee=Cn(C),te=kn({name:(null==ee?void 0:ee.name)||"__unused_brush__",xField:(null==ee?void 0:ee.xField)||("string"==typeof d?d:void 0),yField:(null==ee?void 0:ee.yField)||("string"==typeof h?h:void 0)}),ne=ee?"xyBrush"===te.brushInteraction.brush?"xy":"xBrush"===te.brushInteraction.brush?"x":"y":void 0,oe=g.useRef(te.brushInteraction);oe.current=te.brushInteraction;const ie=t.useCallback(e=>{const t=oe.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(Z.earlyReturn)return Z.earlyReturn;Mo("Scatterplot",J,"xAccessor",d),Mo("Scatterplot",J,"yAccessor",h);const re=t.useMemo(()=>{if(!y||0===J.length)return;const e=J.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[J,y]),se=t.useMemo(()=>e=>{const t={fillOpacity:b};return p?Z.colorScale&&(t.fill=W(e,p,Z.colorScale)):t.fill=H||Pn,t.r=y?D(e,y,m,re):v,t},[p,Z.colorScale,y,m,re,v,b,H]),ae=t.useMemo(()=>Wn(se,{stroke:F,strokeWidth:R,opacity:z}),[se,F,R,z]),le=t.useMemo(()=>Mn(ae,Z.effectiveSelectionHook,Z.resolvedSelection),[ae,Z.effectiveSelectionHook,Z.resolvedSelection]),ce=t.useMemo(()=>Qn([{label:Q||qn(d),accessor:d,role:"x",format:c},{label:K||qn(h),accessor:h,role:"y",format:u},...p?[{label:qn(p),accessor:p,role:"color"}]:[],...y?[{label:qn(y),accessor:y,role:"size"}]:[]]),[d,h,Q,K,p,y,c,u]),ue=oo({componentName:"Scatterplot",data:s,accessors:{xAccessor:d,yAccessor:h}});if(ue)return e.jsx(Kn,{componentName:"Scatterplot",message:ue,width:$,height:E});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:J}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:y||void 0,sizeRange:m,pointStyle:le,colorScheme:f,size:[$,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,showAxes:r.showAxes,xLabel:Q,yLabel:K,xFormat:c,yFormat:u,enableHover:Y,showGrid:G}),Z.legendBehaviorProps),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Gn(x)||ce}),(S||M||_||P)&&{customHoverBehavior:Z.customHoverBehavior}),(M||_||S)&&{customClickBehavior:Z.customClickBehavior}),k&&{marginalGraphics:k}),w&&{pointIdAccessor:w}),j&&j.length>0&&{annotations:j}),ee&&{brush:{dimension:ne},onBrush:ie}),Z.crosshairProps),A);return e.jsx(jo,{componentName:"Scatterplot",width:$,height:E,children:e.jsx(un,Object.assign({ref:i},de))})});function Wo(e,t){return s.interpolateViridis(1===t?.5:e/(t-1))}zo.displayName="Scatterplot";const $o=t.forwardRef(function(n,o){var i;const r=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",orderAccessor:g,orderLabel:p,pointRadius:f=4,tooltip:y,pointIdAccessor:m,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:j,hoverHighlight:A,chartId:O,loading:S,emptyContent:C,legendInteraction:M,stroke:_,strokeWidth:P,opacity:L}=n,B=s.width,N=s.height,T=s.enableHover,I=s.showGrid,H=s.title,F=s.description,R=s.summary,z=s.accessibleTable,W=s.xLabel,$=s.yLabel,D=a||[],{safeData:E,orderMap:Y}=t.useMemo(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof h?h:e=>e[h];let n=D;if(g&&D.length>0){const e="function"==typeof g?g:e=>e[g];n=[...D].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[D,g,d,h]);Mo("ConnectedScatterplot",E,"xAccessor",d),Mo("ConnectedScatterplot",E,"yAccessor",h);const{activeSelectionHook:G,hoverSelectionHook:q,customHoverBehavior:X,customClickBehavior:V,crosshairSourceId:U}=Nn({selection:x,linkedHover:k,fallbackFields:[],onObservation:w,onClick:j,chartType:"ConnectedScatterplot",chartId:O,hoverHighlight:A,colorByField:void 0}),Q=_o(x),K=Tn(k,U),J=Hn(M,void 0,[]),Z=t.useMemo(()=>q||(J.legendSelectionHook?J.legendSelectionHook:G),[q,J.legendSelectionHook,G]),ee=null!==(i=null==Q?void 0:Q.unselectedOpacity)&&void 0!==i?i:.5,te=t.useMemo(()=>(e,t)=>{var n,o;const i=t.filter(e=>"point"===e.type);if(2>i.length)return;const r=null==Z?void 0:Z.isActive,s=null==Z?void 0:Z.predicate,a=100>i.length,l=i.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=i[t],u=i[t+1],d=Wo(t,l),h=!r||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=r?h?1:ee:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=f+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,Z,ee]),ne=t.useMemo(()=>[te],[te]),oe=t.useMemo(()=>(t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const n=s[t],o=s[t+1],u=Wo(t,a),d="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,h="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:f+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:f,strokeLinecap:"round",opacity:g},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[f]),ie=t.useMemo(()=>[oe],[oe]),re=t.useMemo(()=>e=>{var t,n;const o=Y.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?Wo(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}},[f,Y]),se=t.useMemo(()=>Wn(re,{stroke:_,strokeWidth:P,opacity:L}),[re,_,P,L]),ae=t.useMemo(()=>Mn(se,Z,Q),[se,Z,Q]),le=Object.assign({top:50,right:40,bottom:60,left:70},"number"==typeof n.margin?{top:n.margin,bottom:n.margin,left:n.margin,right:n.margin}:n.margin),ce=p||("string"==typeof g?g:"Order"),ue=t.useMemo(()=>Qn([{label:W||qn(d),accessor:d,role:"x",format:c},{label:$||qn(h),accessor:h,role:"y",format:u},...g?[{label:ce,accessor:g,role:"group"}]:[]]),[d,h,W,$,g,ce,c,u]),de=oo({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:d,yAccessor:h}}),he=Co(S,B,N),ge=he?null:So(a,B,N,C),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:E}),{xAccessor:d,yAccessor:h,pointStyle:ae,size:[B,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,showAxes:s.showAxes,xLabel:W,yLabel:$,xFormat:c,yFormat:u,enableHover:T,showGrid:I}),H&&{title:H}),F&&{description:F}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===y?()=>null:Gn(y)||ue}),(k||w||j||A)&&{customHoverBehavior:X}),(w||j||k)&&{customClickBehavior:V}),m&&{pointIdAccessor:m}),{canvasPreRenderers:ne,svgPreRenderers:ie}),v&&v.length>0&&{annotations:v}),K),b);return he||ge||(de?e.jsx(Kn,{componentName:"ConnectedScatterplot",message:de,width:B,height:N}):e.jsx(jo,{componentName:"ConnectedScatterplot",width:B,height:N,children:e.jsx(un,Object.assign({ref:r},pe))}))});$o.displayName="ConnectedScatterplot";const Do=t.forwardRef(function(n,o){const i=t.useRef(null),r=Rn(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:g,sizeRange:p=[5,40],colorBy:f,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:v=1,bubbleStrokeColor:b="white",tooltip:x,marginalGraphics:k,pointIdAccessor:w,annotations:j,frameProps:A={},selection:O,linkedHover:S,linkedBrush:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:B,emptyContent:N,legendInteraction:T,legendPosition:I,color:H,stroke:F,strokeWidth:R,opacity:z}=n,$=r.width,E=r.height,Y=r.enableHover,G=r.showGrid,q=r.showLegend,X=r.title,V=r.description,U=r.summary,Q=r.accessibleTable,K=r.xLabel,J=r.yLabel,Z=Co(B,$,E),ee=Z?null:So(s,$,E,N),te=s||[],ne=void 0===s,oe=t.useRef(null),[ie,re]=t.useState(0),se=t.useCallback(e=>{if(!ne)return;let t=!1;for(const n of e){const e="function"==typeof g?g(n):n[g];null!=e&&isFinite(e)&&(oe.current?(oe.current[0]>e&&(oe.current[0]=e,t=!0),e>oe.current[1]&&(oe.current[1]=e,t=!0)):(oe.current=[e,e],t=!0))}t&&re(e=>e+1)},[ne,g]),ae=Ho({isPushMode:ne,colorBy:f,colorScheme:y,showLegend:q,legendPosition:I}),le=t.useCallback(ae.wrapPush(e=>{var t;se([e]),null===(t=i.current)||void 0===t||t.push(e)}),[ae.wrapPush,se]),ce=t.useCallback(ae.wrapPushMany(e=>{var t;se(e),null===(t=i.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,se]);t.useImperativeHandle(o,()=>({push:le,pushMany:ce,remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.resetCategories(),oe.current=null,re(e=>e+1),null===(e=i.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[le,ce,ae.resetCategories]);const{activeSelectionHook:ue,hoverSelectionHook:de,customHoverBehavior:he,customClickBehavior:ge,crosshairSourceId:pe}=Nn({selection:O,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:[],onObservation:M,onClick:_,chartType:"BubbleChart",chartId:L,hoverHighlight:P,colorByField:"string"==typeof f?f:void 0}),fe=_o(O),ye=Tn(S,pe),me=Cn(C);kn({name:(null==me?void 0:me.name)||"__unused_brush__",xField:(null==me?void 0:me.xField)||("string"==typeof d?d:void 0),yField:(null==me?void 0:me.yField)||("string"==typeof h?h:void 0)});const ve=Bn(te,f,y),be=t.useMemo(()=>{if(!f)return[];const e=new Set;for(const t of te){const n="function"==typeof f?f(t):t[f];null!=n&&e.add(n+"")}return Array.from(e)},[te,f]),xe=Hn(T,f,be),ke=t.useMemo(()=>de||(xe.legendSelectionHook?xe.legendSelectionHook:ue),[de,xe.legendSelectionHook,ue]),we=t.useMemo(()=>{if(ne)return oe.current||[0,1];const e=te.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[te,g,ne,ie]),je=t.useMemo(()=>e=>{const t={fillOpacity:m,strokeWidth:v,stroke:b};return f?ve&&(t.fill=W(e,f,ve)):t.fill=H||Pn,t.r=D(e,g,p,we),t},[f,ve,g,p,we,m,v,b,H]),Ae=t.useMemo(()=>Wn(je,{stroke:F,strokeWidth:R,opacity:z}),[je,F,R,z]),Oe=t.useMemo(()=>Mn(Ae,ke,fe),[Ae,ke,fe]),{legend:Se,margin:Ce,legendPosition:Me}=In({data:te,colorBy:f,colorScale:ve,showLegend:q,legendPosition:I,userMargin:a,defaults:r.marginDefaults}),_e=ae.streamingLegend||Se,Pe=I||Me,Le=t.useMemo(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Ce);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ce},[Ce,ae.streamingMarginAdjust]),Be=t.useMemo(()=>Qn([{label:K||qn(d),accessor:d,role:"x",format:c},{label:J||qn(h),accessor:h,role:"y",format:u},{label:qn(g),accessor:g,role:"size"},...f?[{label:qn(f),accessor:f,role:"color"}]:[]]),[d,h,K,J,g,f,c,u]),Ne=oo({componentName:"BubbleChart",data:s,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:g}});if(Ne)return e.jsx(Kn,{componentName:"BubbleChart",message:Ne,width:$,height:E});const Te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:te}),{xAccessor:d,yAccessor:h,colorAccessor:f||void 0,sizeAccessor:g,sizeRange:p,pointStyle:Oe,colorScheme:y,size:[$,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Le,showAxes:r.showAxes,xLabel:K,yLabel:J,xFormat:c,yFormat:u,enableHover:Y,showGrid:G}),_e&&{legend:_e,legendPosition:Pe}),T&&"none"!==T&&{legendHoverBehavior:xe.onLegendHover,legendClickBehavior:xe.onLegendClick,legendHighlightedCategory:xe.highlightedCategory,legendIsolatedCategories:xe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Gn(x)||Be}),(S||M||_||P)&&{customHoverBehavior:he}),(M||_||S)&&{customClickBehavior:ge}),k&&{marginalGraphics:k}),w&&{pointIdAccessor:w}),j&&j.length>0&&{annotations:j}),ye),A);return Z||ee||e.jsx(jo,{componentName:"BubbleChart",width:$,height:E,children:e.jsx(un,Object.assign({ref:i},Te))})});Do.displayName="BubbleChart";const Eo=t.forwardRef(function(n,o){var r;const a=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=Rn(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:c,margin:u,className:d,xAccessor:h="x",yAccessor:g="y",valueAccessor:p="value",xFormat:f,yFormat:y,colorScheme:m,customColorScale:v,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:C,hoverHighlight:M,chartId:_,loading:P,emptyContent:L,showLegend:B,legendPosition:N,legendInteraction:T}=n,I=l.width,H=l.height,F=l.enableHover,R=l.title,z=l.description,W=l.summary,$=l.accessibleTable,D=l.xLabel,E=l.yLabel,Y=Co(P,I,H),G=Y?null:So(c,I,H,L),q=c||[],X=function(){var e;const t=_n();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),V=null!==(r=null!=m?m:X)&&void 0!==r?r:"blues",U=null!=B&&B,Q=null!=N?N:"right",{margin:K}=In({data:q,colorBy:U?"value":void 0,colorScale:void 0,showLegend:U,legendPosition:Q,userMargin:u,defaults:l.marginDefaults}),{customHoverBehavior:J,customClickBehavior:Z,crosshairSourceId:ee}=Nn({selection:A,linkedHover:O,fallbackFields:[],onObservation:S,onClick:C,chartType:"Heatmap",chartId:_,hoverHighlight:M,colorByField:void 0});_o(A);const te=Tn(O,ee);Hn(T,void 0,[]);const ne=t.useMemo(()=>"function"==typeof p?e=>p(e):e=>e[p],[p]),oe=t.useMemo(()=>{const e=q.map(ne);return[Math.min(...e),Math.max(...e)]},[q,ne]),ie=t.useMemo(()=>"custom"===V&&v?v:i.scaleSequential({blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,viridis:s.interpolateViridis,oranges:s.interpolateOranges,purples:s.interpolatePurples,greys:s.interpolateGreys,plasma:s.interpolatePlasma,inferno:s.interpolateInferno,magma:s.interpolateMagma,cividis:s.interpolateCividis,turbo:s.interpolateTurbo}[V]||s.interpolateBlues).domain(oe),[V,v,oe]),re=t.useMemo(()=>Qn([{label:D||qn(h),accessor:h,role:"x",format:f},{label:E||qn(g),accessor:g,role:"y",format:y},{label:qn(p),accessor:p,role:"value",format:x}]),[h,g,D,E,p,f,y,x]),se=oo({componentName:"Heatmap",data:c,accessors:{xAccessor:h,yAccessor:g,valueAccessor:p}}),ae=t.useMemo(()=>{if(U)return{gradient:{colorFn:e=>ie(e),domain:oe,label:"string"==typeof p?p:"value",format:x}}},[U,ie,oe,p,x]),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=c&&{data:q}),{xAccessor:h,yAccessor:g,valueAccessor:p,colorScheme:"custom"!==V?V:void 0,showValues:b,heatmapValueFormat:x,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K,showAxes:l.showAxes,xLabel:D,yLabel:E,xFormat:f,yFormat:y,enableHover:F}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),ae&&{legend:ae,legendPosition:Q}),R&&{title:R}),z&&{description:z}),W&&{summary:W}),void 0!==$&&{accessibleTable:$}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===k?()=>null:Gn(k)||re}),(O||S||C||M)&&{customHoverBehavior:J}),(S||C||O)&&{customClickBehavior:Z}),w&&w.length>0&&{annotations:w}),te),j);return Y||G||(se?e.jsx(Kn,{componentName:"Heatmap",message:se,width:I,height:H}):e.jsx(jo,{componentName:"Heatmap",width:I,height:H,children:e.jsx(un,Object.assign({ref:a},le))}))});Eo.displayName="Heatmap";const Yo="__splomIdx",Go={top:4,bottom:4,left:4,right:4};function qo({frameRef:i,cellSize:r,onBrush:s}){const a=t.useRef(null),l=r-Go.left-Go.right,c=r-Go.top-Go.bottom;return t.useEffect(()=>{if(!a.current)return;const e=n.select(a.current).select(".brush-g"),t=o.brush().extent([[0,0],[l,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void s(null);const[[o,r],[a,l]]=e.selection,c=[[n.x.invert(o),n.y.invert(r)],[n.x.invert(a),n.y.invert(l)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,c,i,s]),e.jsx("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${Go.left},${Go.top})`})})}function Xo({data:n,xField:o,yField:i,cellSize:r,pointRadius:s,pointOpacity:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:g,onPointHover:p}){const f=t.useRef(null),y=bn({name:u,clientId:`splom-${o}-${i}`}),m=kn({name:u,xField:o,yField:i}),v=bn({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[Yo];void 0!==n&&(b({[Yo]:[n]}),null==p||p(t,e.x+Go.left,e.y+Go.top))},[b,p]),w=t.useCallback(e=>{const t={opacity:a,r:s};return t.fill=l?W(e,l,c):Pn,"hover"===g?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*a):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[l,c,a,s,g,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(un,{ref:f,chartType:"scatter",data:n,size:[r,r],xAccessor:o,yAccessor:i,pointStyle:w,margin:Go,showAxes:!1,enableHover:"hover"===g,customHoverBehavior:"hover"===g?k:void 0,tooltipContent:"hover"===g?()=>null:void 0}),"brush"===g&&e.jsx(qo,{frameRef:f,cellSize:r,xField:o,yField:i,onBrush:x})]})}function Vo({data:n,field:o,label:i,cellSize:r,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=bn({name:c,clientId:"splom-diag-"+o}),g=bn({name:u,clientId:`splom-diag-${o}-hover`}),p="hover"===d?g:h,f=p.isActive,y=p.predicate,m=t.useMemo(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(n.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),p=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const r=Math.min(Math.floor((n-t)/i),s-1);if(d[r]++,f&&!y(e)||h[r]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[r][t]++,f&&!y(e)||p[r][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,a})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,a})});return{bars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[n,o,s,r,f,y,a]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Pn,opacity:f?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Pn,opacity:f?.3:.6},"bg-"+n)),f&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Pn,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Pn,opacity:.7},"sel-"+n)))]})}function Uo({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Qo(n){const{data:o,fields:i,fieldLabels:r={},colorBy:s,colorScheme:a,cellSize:l=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:h="histogram",histogramBins:p=20,brushMode:f="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=n,O="splom",S="splom-hover",C=y?"hover":f?"brush":"hover",M=yn(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{M(S),P(null)},[M,S]),B=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[Yo]?e:Object.assign(Object.assign({},e),{[Yo]:t})),[o]),N=Bn(B,s,a),T=void 0!==x?x:!!s,I=t.useMemo(()=>{if(!T||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Pn})):null},[T,s,B,N]),H=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>l+"px").join(" "),gridTemplateRows:i.map(()=>l+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,l,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[I&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:I.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:H,onMouseLeave:"hover"===C?L:void 0,children:[i.map((t,n)=>e.jsxs(g.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((o,i)=>n===i?"label"===h?e.jsx(Uo,{label:r[t]||t,cellSize:l},"diag-"+t):e.jsx(Vo,{data:B,field:t,label:r[t]||t,cellSize:l,bins:p,colorBy:s,colorScale:N,brushSelectionName:O,hoverSelectionName:S,unselectedOpacity:m,mode:C},"diag-"+t):e.jsx(Xo,{data:B,xField:o,yField:t,fieldLabels:r,cellSize:l,pointRadius:u,pointOpacity:d,colorBy:s,colorScale:N,brushSelectionName:O,hoverSelectionName:S,unselectedOpacity:m,showGrid:v,tooltip:b,mode:C,onPointHover:"hover"===C?(e,r,s)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===C&&(()=>{const t=_.datum,n=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,a=k?"function"==typeof k?k(t):t[k]:"Row "+t[Yo];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(l+c)+_.px,top:_.rowIndex*(l+c)+_.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function Ko(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(On,{selections:i,children:e.jsx(Qo,Object.assign({},t))})}function Jo({width:i,height:r,margin:s,scales:a,brushDirection:l,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(!1),p=i+s.left+s.right,f=r+s.top+s.bottom;return t.useEffect(()=>{if(!d.current||!a)return;const e=n.select(d.current).select(".brush-group"),t="x"===l?o.brushX().extent([[0,0],[i,r]]):o.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(g.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===l?a.x:a.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,i,r,l,u]),t.useEffect(()=>{if(!h.current||!a||!d.current)return;const e=n.select(d.current).select(".brush-group"),t="x"===l?a.x:a.y;if(g.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(h.current.move,n)}else e.call(h.current.move,null);g.current=!1},[c,a,l]),e.jsx("svg",{ref:d,width:p,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function Zo(n){var o,i;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,description:d,summary:h,xLabel:g,yLabel:p,xFormat:f,yFormat:y,xAccessor:m="x",yAccessor:v="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:k,colorScheme:w,curve:j="linear",lineWidth:A=2,fillArea:O=!1,areaOpacity:S=.3,showPoints:C=!1,pointRadius:M=3,enableHover:_=!0,showGrid:P=!1,showLegend:L,legendPosition:B,tooltip:N,minimap:T={},renderBefore:I=!1,onBrush:H,brushExtent:F,frameProps:R={},loading:z,emptyContent:$}=n,D=Co(z,s,a),E=D?null:So(r,s,a,$),Y=r||[],[G,q]=t.useState(null),X=null!=F?F:G,V=t.useCallback(e=>{F||q(e),null==H||H(e)},[F,H]),U=t.useRef(null),[Q,K]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=U.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?K(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const J=void 0!==(null===(o=Y[0])||void 0===o?void 0:o[x]),Z=t.useMemo(()=>{if(J)return Y;if(b){const e=Y.reduce((e,t)=>{const n="function"==typeof b?b(t):t[b];if(!e[n]){const t={[x]:[]};"string"==typeof b&&(t[b]=n),e[n]=t}return e[n][x].push(t),e},{});return Object.values(e)}return[{[x]:Y}]},[Y,b,x,J]),ee=t.useMemo(()=>J||b?Z.flatMap(e=>{const t=e[x]||[];return b&&"string"==typeof b?t.map(t=>Object.assign(Object.assign({},t),{[b]:e[b]})):t}):Y,[Z,x,J,b,Y]),te=Bn(Y,k,w),ne=t.useMemo(()=>e=>{const t={strokeWidth:A};return t.stroke=k?W(e,k,te):Pn,O&&(t.fill=t.stroke,t.fillOpacity=S),t},[k,te,A,O,S]),oe=t.useMemo(()=>T.lineStyle?T.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=k?W(e,k,te):Pn,t},[k,te,T.lineStyle]),ie=t.useMemo(()=>{if(C)return e=>{const t={r:M,fillOpacity:1};return t.fill=k?W(e.parentLine||e,k,te):Pn,t}},[C,M,k,te]),{legend:re,margin:se,legendPosition:ae}=In({data:Z,colorBy:k,colorScale:te,showLegend:L,legendPosition:B,userMargin:l}),le=T.height||60,ce=t.useMemo(()=>{var e,t,n,o,i,r,s,a;return{top:null!==(t=null===(e=T.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=T.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=T.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:se.left,right:null!==(a=null===(s=T.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:se.right}},[T.margin,se]),ue=T.brushDirection||"x",de=oo({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:v}});if(de)return e.jsx(Kn,{componentName:"MinimapChart",message:de,width:s,height:a});const he=O?"area":"line",ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:he,data:ee,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:ne},C&&{pointStyle:ie}),{size:[s,a],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se,showAxes:!0,xLabel:g,yLabel:p,xFormat:f,yFormat:y,enableHover:_,showGrid:P}),re&&{legend:re,legendPosition:ae}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),N&&{tooltipContent:Gn(N)||void 0}),X&&{xExtent:X}),R),pe={chartType:he,data:ee,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:oe,size:[s,le+ce.top+ce.bottom],margin:ce,showAxes:null!==(i=T.showAxes)&&void 0!==i&&i,background:T.background,enableHover:!1},fe=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(un,Object.assign({ref:U},pe)),e.jsx(Jo,{width:s-ce.left-ce.right,height:le,margin:ce,scales:Q,brushDirection:ue,extent:X,onBrush:V})]},"minimap"),ye=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(un,Object.assign({},ge))},"main");return D||E||e.jsx(jo,{componentName:"MinimapChart",width:s,height:a,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[I?fe:ye,I?ye:fe]})})}Ko.displayName="ScatterplotMatrix",Zo.displayName="MinimapChart";const ei=t.forwardRef(function(n,o){const i=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const r=Rn(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:g,yCenter:p,quadrants:f,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:v=12,colorBy:b,colorScheme:x,sizeBy:k,sizeRange:w=[3,15],pointRadius:j=5,pointOpacity:A=.8,tooltip:O,pointIdAccessor:S,annotations:C,frameProps:M={},selection:_,linkedHover:P,onObservation:L,onClick:B,hoverHighlight:N,chartId:T,loading:I,emptyContent:H,legendInteraction:F,legendPosition:R,color:z,stroke:$,strokeWidth:E,opacity:Y}=n,G=r.width,q=r.height,X=r.enableHover,V=r.showGrid,U=r.showLegend,Q=r.title,K=r.description,J=r.summary,Z=r.accessibleTable,ee=r.xLabel,te=r.yLabel,ne=Co(I,G,q),oe=ne?null:So(s,G,q,H),ie=s||[];Mo("QuadrantChart",ie,"xAccessor",d),Mo("QuadrantChart",ie,"yAccessor",h);const{activeSelectionHook:re,hoverSelectionHook:se,customHoverBehavior:ae,customClickBehavior:le,crosshairSourceId:ce}=Nn({selection:_,linkedHover:P,fallbackFields:"string"==typeof b?[b]:[],onObservation:L,onClick:B,chartType:"QuadrantChart",chartId:T,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ue=_o(_),de=Tn(P,ce),he=Bn(ie,b,x),ge=t.useMemo(()=>{if(!b)return[];const e=new Set;for(const t of ie){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ie,b]),pe=Hn(F,b,ge),fe=t.useMemo(()=>se||(pe.legendSelectionHook?pe.legendSelectionHook:re),[se,pe.legendSelectionHook,re]),ye=t.useMemo(()=>{if(!ie.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of ie){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=g&&isFinite(g)&&(n>g&&(n=g),g>o&&(o=g)),null!=p&&isFinite(p)&&(i>p&&(i=p),p>r&&(r=p)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-a,r+a]}},[ie,d,h,g,p]),me=t.useMemo(()=>{if(!k||0===ie.length)return;const e=ie.map(e=>"function"==typeof k?k(e):e[k]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ie,k]),ve=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),be=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),xe=t.useMemo(()=>e=>{const t={fillOpacity:A};if(b)he&&(t.fill=W(e,b,he));else{const n=ve(e),o=be(e),i=null!=g?n>=g:void 0,r=null!=p?o>=p:void 0;t.fill=void 0===r||void 0===i?z||Pn:r&&i?f.topRight.color:r&&!i?f.topLeft.color:!r&&i?f.bottomRight.color:f.bottomLeft.color}return t.r=k?D(e,k,w,me):j,t},[b,he,k,w,me,j,A,ve,be,g,p,f,z]),ke=t.useMemo(()=>Wn(xe,{stroke:$,strokeWidth:E,opacity:Y}),[xe,$,E,Y]),we=t.useMemo(()=>Mn(ke,fe,ue),[ke,fe,ue]),{legend:je,margin:Ae,legendPosition:Oe}=In({data:ie,colorBy:b,colorScale:he,showLegend:U,legendPosition:R,userMargin:a,defaults:r.marginDefaults}),Se=t.useMemo(()=>{if(!ie.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof b&&e.add(b),"string"==typeof k&&e.add(k);const t=ie[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ie,d,h,b,k]),Ce=t.useMemo(()=>Qn([...Se?[{label:Se,accessor:Se,role:"title"}]:[],{label:ee||qn(d),accessor:d,role:"x",format:c},{label:te||qn(h),accessor:h,role:"y",format:u},...b?[{label:qn(b),accessor:b,role:"color"}]:[],...k?[{label:qn(k),accessor:k,role:"size"}]:[]]),[Se,d,h,ee,te,b,k,c,u]),Me=oo({componentName:"QuadrantChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),_e=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,a=i.height,l=null!=g?o.x(g):s/2,c=null!=p?o.y(p):a/2;if(null!=g&&!isFinite(l))return;if(null!=p&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:f.topLeft,x:0,y:0,w:u,h:d},{config:f.topRight,x:u,y:0,w:s-u,h:d},{config:f.bottomLeft,x:0,y:d,w:u,h:a-d},{config:f.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[g,p,f,y]),Pe=t.useMemo(()=>m?[..._e,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=g?n.x(g):i/2,a=null!=p?n.y(p):r/2;(null==g||isFinite(s))&&(null==p||isFinite(a))&&(e.font=`600 ${v}px sans-serif`,e.globalAlpha=.5,e.fillStyle=f.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(f.topLeft.label,8,8),e.fillStyle=f.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(f.topRight.label,i-8,8),e.fillStyle=f.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(f.bottomLeft.label,8,r-8),e.fillStyle=f.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(f.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:_e,[_e,m,v,f,g,p]),Le=t.useMemo(()=>{const e=M.canvasPreRenderers||[];return[...Pe,...e]},[Pe,M.canvasPreRenderers]),Be=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const r=i.width,s=i.height,a=null!=g?o.x(g):r/2,l=null!=p?o.y(p):s/2;if(null!=g&&!isFinite(a))return null;if(null!=p&&!isFinite(l))return null;const c=Math.max(0,Math.min(r,a)),u=Math.max(0,Math.min(s,l));return e.jsxs(e.Fragment,{children:[[{config:f.topLeft,x:0,y:0,w:c,h:u},{config:f.topRight,x:c,y:0,w:r-c,h:u},{config:f.bottomLeft,x:0,y:u,w:c,h:s-u},{config:f.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+v,fill:f.topLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:f.topLeft.label}),e.jsx("text",{x:r-8,y:8+v,fill:f.topRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:f.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:f.bottomLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:f.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:f.bottomRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:f.bottomRight.label})]})]})}]},[g,p,f,y,m,v]),Ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:ie}),{xAccessor:d,yAccessor:h,colorAccessor:b||void 0,sizeAccessor:k||void 0,sizeRange:w,pointStyle:we,colorScheme:x,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Ae,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ye&&{xExtent:ye.xExtent,yExtent:ye.yExtent}),je&&{legend:je,legendPosition:Oe}),F&&"none"!==F&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),Q&&{title:Q}),K&&{description:K}),J&&{summary:J}),void 0!==Z&&{accessibleTable:Z}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===O?()=>null:!0===O||void 0===O?Ce:Gn(O)||Ce}),(P||L||B||N)&&{customHoverBehavior:ae}),(L||B||P)&&{customClickBehavior:le}),S&&{pointIdAccessor:S}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:Le}),de),M),Le.length>0&&{canvasPreRenderers:Le}),{svgPreRenderers:Be});return ne||oe||(Me?e.jsx(Kn,{componentName:"QuadrantChart",message:Me,width:G,height:q}):e.jsx(jo,{componentName:"QuadrantChart",width:G,height:q,children:e.jsx(un,Object.assign({ref:i},Ne))}))});ei.displayName="QuadrantChart";const ti="__ma_unitized",ni="__ma_series";function oi(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function ii(e,t){return t[0]+e*(t[1]-t[0])}const ri=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null),a=t.useRef([]);t.useImperativeHandle(o,()=>({push:e=>{if(!s.current)return;const t=e;for(let e=0;n.series.length>e&&2>e;e++){const o=n.series[e],i=o.extent||a.current[e];if(!i)continue;const r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(t);null!=r&&isFinite(r)&&s.current.push(Object.assign(Object.assign({},t),{[ti]:oi(r,i),[ni]:o.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.current)return;const t=[];for(const o of e)for(let e=0;n.series.length>e&&2>e;e++){const i=n.series[e],r=i.extent||a.current[e];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=s&&isFinite(s)&&t.push(Object.assign(Object.assign({},o),{[ti]:oi(s,r),[ni]:i.label||"Series "+(e+1)}))}s.current.pushMany(t)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const l=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:h,xAccessor:p="x",series:f,colorScheme:y,curve:m="monotoneX",lineWidth:v=2,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:C,loading:M,emptyContent:_,legendInteraction:P,legendPosition:L,stroke:B,strokeWidth:N,opacity:T}=n,I=l.width,R=l.height,z=l.enableHover,W=l.showGrid,$=null===(i=l.showLegend)||void 0===i||i,D=l.title,E=l.description,Y=l.summary,G=l.accessibleTable,q=l.xLabel,X=2===f.length;"undefined"==typeof process||"production"===(null===(r=process.env)||void 0===r?void 0:r.NODE_ENV)||X||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${f.length}. Rendering as a standard multi-line chart.`);const V=Co(M,I,R),U=V?null:So(c,I,R,_),Q=c||[],K=Ln(),J=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(K&&K.length>0)e=K;else{const t=H[y];e=Array.isArray(t)?t:F}return f.map((t,n)=>t.color||e[n%e.length])},[f,y,K]),Z=t.useMemo(()=>f.map((e,t)=>e.label||"Series "+(t+1)),[f]),{unitizedData:ee,extents:te}=t.useMemo(()=>{if(0===Q.length){const e=f.map(e=>e.extent||null).filter(Boolean);return e.length===f.length&&(a.current=e),{unitizedData:[],extents:e.length===f.length?e:[]}}const e=f.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(Q,e.yAccessor));if(a.current=e,!X){const t=[];for(const e of Q)for(let n=0;f.length>n;n++){const o=f[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[ti]:i,[ni]:Z[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of Q)for(let o=0;2>o;o++){const i=f[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[ti]:oi(r,e[o]),[ni]:Z[o]}))}return{unitizedData:t,extents:e}},[Q,f,X,Z]),ne=t.useMemo(()=>{if(X&&te.length>=2)return[{orient:"left",label:Z[0],tickFormat:f[0].format||(e=>{const t=ii(e,te[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Z[1],tickFormat:f[1].format||(e=>{const t=ii(e,te[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[X,te,f,Z]),oe=Ro({data:t.useMemo(()=>ee.length>0?ee:Z.map(e=>({[ni]:e})),[ee,Z]),rawData:c,colorBy:ni,colorScheme:J,legendInteraction:P,legendPosition:L,selection:w,linkedHover:j,fallbackFields:[ni],unwrapData:!1,onObservation:A,onClick:O,hoverHighlight:S,chartType:"MultiAxisLineChart",chartId:C,showLegend:$,userMargin:u,marginDefaults:X?Object.assign(Object.assign({},l.marginDefaults),{left:70,right:70}):l.marginDefaults,loading:M,emptyContent:_,width:I,height:R});if(oe.earlyReturn)return oe.earlyReturn;const ie=t.useMemo(()=>{const e=new Map;return Z.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[ni])||J[0],strokeWidth:v,fill:"none"})},[Z,J,v]),re=t.useMemo(()=>Wn(ie,{stroke:B,strokeWidth:N,opacity:T}),[ie,B,N,T]),se=t.useMemo(()=>Mn(re,oe.effectiveSelectionHook,oe.resolvedSelection),[re,oe.effectiveSelectionHook,oe.resolvedSelection]),ae=t.useMemo(()=>{if(!1===b)return()=>null;return Gn(b)||(e=>{var t;const n=e.data||e,o=n[ni],i=Z.indexOf(o),r=n[ti],s=X&&i>=0&&te[i]?ii(r,te[i]):r,a=i>=0&&(null===(t=f[i])||void 0===t?void 0:t.format)?f[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),l="function"==typeof p?p(n):n[p];return g.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},g.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[i]||"inherit"}},o),g.createElement("div",null,`${"string"==typeof p?p:"x"}: ${l}`),g.createElement("div",null,`${o}: ${a(s)}`))})},[b,Z,J,te,X,f,p]),le=oo({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:p}}),ce=X?[0,1]:void 0,ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:ee}),{xAccessor:p,yAccessor:ti,groupAccessor:ni,lineStyle:se,colorScheme:J,size:[I,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:oe.margin,showAxes:l.showAxes}),ne&&{axes:ne}),{xLabel:q}),X?{}:{yLabel:Z[0]}),{xFormat:h}),X&&ce&&{yExtent:ce}),{enableHover:z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:W,curve:m}),oe.legendBehaviorProps),D&&{title:D}),E&&{description:E}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:ae}),x&&{annotations:x}),(j||A||O||S)&&{customHoverBehavior:oe.customHoverBehavior}),(A||O||j)&&{customClickBehavior:oe.customClickBehavior}),oe.crosshairProps),k);return V||U||(le?e.jsx(Kn,{componentName:"MultiAxisLineChart",message:le,width:I,height:R}):e.jsx(jo,{componentName:"MultiAxisLineChart",width:I,height:R,children:e.jsx(un,Object.assign({ref:s},ue))}))});ri.displayName="MultiAxisLineChart";const si=t.forwardRef(function(n,o){const i=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const r=Rn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:g="low",openAccessor:p,closeAccessor:f,candlestickStyle:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:j,chartId:A,loading:O,emptyContent:S}=n,C=r.width,M=r.height,_=r.enableHover,P=r.showGrid,L=r.title,B=r.description,N=r.summary,T=r.accessibleTable,I=r.xLabel,H=r.yLabel,F=Co(O,C,M),R=F?null:So(s,C,M,S),z=s||[],W=null==p||null==f;Mo("CandlestickChart",z,"xAccessor",d),Mo("CandlestickChart",z,"highAccessor",h),Mo("CandlestickChart",z,"lowAccessor",g),W||(Mo("CandlestickChart",z,"openAccessor",p),Mo("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:$,customClickBehavior:D,crosshairSourceId:E}=Nn({selection:x,linkedHover:k,onObservation:w,onClick:j,chartType:"CandlestickChart",chartId:A}),Y=Tn(k,E),G=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?t:"number"==typeof a?{top:a,bottom:a,left:a,right:a}:Object.assign(Object.assign({},t),a)},[a,r.marginDefaults,n.mode]),q=t.useMemo(()=>{const e=[{label:I||qn(d),accessor:d,role:"x",format:c}];return W?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:g,format:u})):(e.push({label:"Open",accessor:p,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:g,format:u}),e.push({label:"Close",accessor:f,format:u})),Qn(e)},[d,I,c,u,h,g,p,f,W]),X=oo({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:g},!W&&{openAccessor:p,closeAccessor:f})}),V=Math.max(2,Math.min(12,Math.round(C/40))),U=C>200?.1:.02,Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=s&&{data:z}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:g}),!W&&{openAccessor:p,closeAccessor:f}),y&&{candlestickStyle:y}),{scalePadding:V,extentPadding:U,size:[C,M],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G,showAxes:r.showAxes,xLabel:I,yLabel:H,xFormat:c,yFormat:u,enableHover:_,showGrid:P}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),L&&{title:L}),B&&{description:B}),N&&{summary:N}),void 0!==T&&{accessibleTable:T}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:Gn(m)||q}),(k||w||j)&&{customHoverBehavior:$}),(w||j||k)&&{customClickBehavior:D}),v&&v.length>0&&{annotations:v}),Y),b);return F||R||(X?e.jsx(Kn,{componentName:"CandlestickChart",message:X,width:C,height:M}):e.jsx(jo,{componentName:"CandlestickChart",width:C,height:M,children:e.jsx(un,Object.assign({ref:i},Q))}))});function ai(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),r=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function li(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),r=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}si.displayName="CandlestickChart";const ci="__forecastSegment";function ui(e,t){return"function"==typeof t?t(e):!!e[t]}const di=Object.freeze({__proto__:null,SEGMENT_FIELD:ci,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(r=o).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,n,o,i){var r,s,a,l;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:g,color:p="#6366f1",bandOpacity:f=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&ui(e,u)?t="forecast":c&&ui(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[ci]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][ci]!==n[e+1][ci]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[ci]:n[e][ci]})),t.push(Object.assign(Object.assign({},n[e]),{[ci]:n[e+1][ci]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][ci]!==b[e+1][ci]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[ci]:b[e][ci]})),k.push(Object.assign(Object.assign({},b[e]),{[ci]:b[e+1][ci]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[ci]&&e.push(Object.assign(Object.assign({},t),{[ci]:"training-base"}));k.unshift(...e)}const w=[];if(h&&g){const e="string"==typeof h?h:"__envUpper",t="string"==typeof g?g:"__envLower";if("function"==typeof h||"function"==typeof g)for(const n of k)"function"==typeof h&&(n[e]=h(n)),"function"==typeof g&&(n[t]=g(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:p,fillOpacity:f,label:v})}if(d){const e=o.anomalyStyle,t={type:"highlight",filter:e=>ui(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(a=i.bandOpacity)&&void 0!==a?a:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var r,s,a;const{trainEnd:l,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:g}=o;if(null==l)return{processedData:e,annotations:[]};const p=[],f=[];for(const n of e)n[t]>l?f.push(Object.assign(Object.assign({},n),{[ci]:"observed"})):p.push(Object.assign(Object.assign({},n),{[ci]:"training"}));const y=p.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const o=y.length;let i=0,r=0,s=0,a=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,a+=e*t;const l=o*s-i*i;if(Math.abs(l)>1e-12){const s=(o*a-i*r)/l,p=(r-s*i)/o,f=e=>p+s*e,b=y.map(([e,t])=>t-f(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(o-2,1)),k=y.reduce((e,t)=>e+t[0],0)/o,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),O=Math.max(...A),S=y.length>1?(y[o-1][0]-y[0][0])/(o-1):1;for(let e=1;c>=e;e++){const i=O+e*S,r=f(i),s=x*Math.sqrt(1+1/o+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[n]:r,[ci]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:g})}}m.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label});const b=[];if(b.push(...p),p.length>0&&f.length>0&&b.push(Object.assign(Object.assign({},p[p.length-1]),{[ci]:"observed"})),b.push(...f),v.length>0){const e=f.length>0?f[f.length-1]:p[p.length-1];e&&b.push(Object.assign(Object.assign({},e),{[ci]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var r},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",r=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",s=t.color||"#6366f1",a=t.trainOpacity,l=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const n=e(t),o=t[ci];if("training"===o){let e=n.stroke;return"darken"===c?e=ai(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=a&&{strokeOpacity:a})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===d&&(e=li(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}return"forecast"===o?Object.assign(Object.assign(Object.assign({},n),{stroke:s,strokeDasharray:r}),null!=l&&{strokeOpacity:l}):n}},darkenColor:ai,lightenColor:li});exports.AreaChart=Io,exports.BubbleChart=Do,exports.CandlestickChart=si,exports.ConnectedScatterplot=$o,exports.Heatmap=Eo,exports.LineChart=To,exports.MinimapChart=Zo,exports.MultiAxisLineChart=ri,exports.QuadrantChart=ei,exports.Scatterplot=zo,exports.ScatterplotMatrix=Ko,exports.StackedAreaChart=Fo,exports.StreamXYFrame=un;
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),l=require("d3-array"),a=require("d3-hierarchy"),c=require("regression");function u(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const d=h(t),f=u(c);function g(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function p(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function y({width:i,height:r,totalWidth:s,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:h,binSize:d,snap:f,binBoundaries:y,snapDuring:m,streaming:v}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(h);k.current=h;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>y?[...y].sort((e,t)=>e-t):void 0,[y]),A=t.useRef(j);A.current=j;const O=t.useRef(!1),M=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",n=>{if(O.current)return;const o=w.current;if(!o)return;if(!n.selection)return M.current=null,void k.current(null);let s,l;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],l=[o.y.invert(r),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(i)],l=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,r]]=n.selection;s=[o.x.invert(e),o.x.invert(i)],l=[o.y.invert(r),o.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===n.type||"brush"===n.type&&m)){const i=A.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[g(e[0],t),p(e[1],t)]}(s,i):d&&d>0&&(s=[Math.floor(s[0]/d)*d,Math.ceil(s[1]/d)*d]);const r=o.x(s[0]),l=o.x(s[1]);if(O.current=!0,"x"===c)e.call(t.move,[r,l]);else if("xy"===c){const o=n.selection;e.call(t.move,[[r,o[0][1]],[l,o[1][1]]])}O.current=!1}const a={x:s,y:l};M.current=a,k.current(a)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,f,d,m]),t.useEffect(()=>{if(!(v&&u&&x.current&&M.current))return;if(!b.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===f){const e=A.current;e&&e.length>0?i=p(t,e):d&&d>0&&(i=Math.ceil(t/d)*d)}if(i>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,M.current=null,void k.current(null);r=!0}const s=u.x(i),l=u.x(e.x[1]);if(O.current=!0,"x"===c)o.call(x.current.move,[s,l]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[s,t],[l,n]])}if(O.current=!1,r){const t={x:[i,e.x[1]],y:e.y};M.current=t,k.current(t)}},[u,v,c,f,d]),e.jsx("svg",{ref:b,width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const m=Object.freeze([]);function v(e){if(!e)return m;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class b{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=v(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=v(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function x(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=k(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>k(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(s.getState()),[s]),c=t.useCallback(()=>l.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,c)}]}function k(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function w(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function j(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:A})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const A=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],O={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},M={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},S={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:A,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function C(e,t){if("light"===t)return O;if("dark"===t)return M;if("high-contrast"===t)return S;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?M:O;return j(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return j(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_,P]=x(e=>({theme:O,setTheme(t){e(e=>({theme:C(e.theme,t)}))}}));class L{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class B{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function T(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),l=n(s);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=r.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},r.set(a,c)),c.total+=l,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+l)}}return r}function R(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const l=Array(s.length),a=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];l[e]=[t.px,t.py],a[e]=t.rawY,c[e]=t.d}return{type:"line",path:l,rawValues:a,style:i,datum:c,group:r}}function F(e,t,n,o,i,r,s,l){const a=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=l?l(r):i;a.push({px:c,topY:t.y(s),botY:t.y(u)})}a.sort((e,t)=>e.px-t.px);const c=Array(a.length),u=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function H(e,t,n,o){var i,r,s;const l=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;l.set(o,-e/2)}else if("wiggle"===o){e.length>0&&l.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,s)||0;a+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const h=null!==(i=l.get(r))&&void 0!==i?i:0;l.set(s,h-(c>0?a/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=l.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(s=l.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)l.set(t,0);return l}function I(e,t,n,o,i,r,s){const l=n(e),a=o(e);if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c={type:"point",x:t.x(l),y:t.y(a),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function N(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function z(e,t,n,o,i,r,s){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(l.showValues=!0,l.value=s.value,s.valueFormat&&(l.valueFormat=s.valueFormat)),l}function W(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function D(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function E(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function Y(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function G(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function X(e){const t=e.map(Y),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return G(e,n,o)}if(e>=1){const[e,o,i]=t[n];return G(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,h]=t[i+1];return G(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(h-a)*r))}}const q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],V=X(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),U=X(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),K=X(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Q=X(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Z=X(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),J=X(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ee=X(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),te=X(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ne=X(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),oe=X(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ie=X(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),re=X(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);X(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),X(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),X(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),X(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),X(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),X(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const se={category10:q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:V,reds:U,greens:K,oranges:Q,purples:Z,viridis:ee,plasma:te},le=q,ae=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ue(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ce.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):le[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))%le.length]}function he(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const s=se[n]||se.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:le;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function de(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[l,a]=n;return s===r?(l+a)/2:l+(i-r)/(s-r)*(a-l)}function fe(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function ge(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function pe(e,t,n){return e+(t-e)*n}function ye(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function me(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],i=[];for(const n of t){const t=e.getX(n),r=e.getY(n);if(null==t||null==r||Number.isNaN(t)||Number.isNaN(r))continue;const s=e.getBounds(n),l=e.scales.x(t);if(s&&0!==s)o.push([l,e.scales.y(r+s)]),i.push([l,e.scales.y(r-s)]);else{const t=e.scales.y(r);o.push([l,t]),i.push([l,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:i,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function ve(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const l=null!==(i=o.r)&&void 0!==i?i:3,a=e.getPointId?e.getPointId(s)+"":void 0,c=I(s,e.scales,e.getX,r,l,o,a);c&&n.push(c)}}}const be={blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:re},xe=new Map;class ke{constructor(e){if(this.xExtent=new B,this.yExtent=new B,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new L(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=D(e.timeAccessor||e.xAccessor,"time"),this.getY=D(e.valueAccessor||e.yAccessor,"value")):(this.getX=D(e.xAccessor,"x"),this.getY=D(e.yAccessor,"y")),this.getGroup=E(e.groupAccessor),this.getCategory=E(e.categoryAccessor),this.getSize=e.sizeAccessor?D(e.sizeAccessor,"size"):void 0,this.getColor=E(e.colorAccessor),this.getBounds=e.boundsAccessor?D(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?D(e.y0Accessor,"y0"):void 0,this.getPointId=E(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?D(e.openAccessor,"open"):void 0,this.getHigh=D(e.highAccessor,"high"),this.getLow=D(e.lowAccessor,"low"),this.getClose=n?D(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new L(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?D(this.config.timeAccessor||this.config.xAccessor,"time"):D(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)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)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);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)),this.getY0&&this.yExtent.push(this.getY0(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)),this.getY0&&this.yExtent.evict(this.getY0(e))))}return!0}computeScene(e){var t,n,o,r,s,l,a,c,u,h,d,f,g,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:b[0],null!==(o=y.xExtent[1])&&void 0!==o?o:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1];if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(a=y.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let l=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),l+=s;const a=(r.get(e)||0)+s;r.set(e,a),a>i&&(i=a)}n.set(e.key,t),s.set(e.key,l)}const l=null!==(c=y.stackOrder)&&void 0!==c?c:"key",a=(e,t)=>t>e?-1:e>t?1:0;let g;if("insideOut"===l){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u:0):(o.push(t),r+=null!==(h=s.get(t))&&void 0!==h?h:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):t.map(e=>e.key).sort(a);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=H(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},y.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(f=r.get(n))&&void 0!==f?f:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const l=s-i,a=l>0?l*y.extentPadding:1;w=[i-a,s+a]}else w=[0,i+(i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,n,o,i){const r=T(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(m,this.getY),n=t-e,o=n>0?n*y.extentPadding:1;w=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!j&&w[0]!==1/0){if(this.getBounds)for(const e of v){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>w[1]&&(w[1]=t+n),w[0]>t-n&&(w[0]=t-n))}const e=w[1]-w[0],t=e>0?e*y.extentPadding:1,n=null===(g=y.yExtent)||void 0===g?void 0:g[0],o=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=n?w[0]:w[0]-t,null!=o?w[1]:w[1]+t],"log"===y.yScaleType&&0>=w[0]&&x[0]>0&&(w[0]=null!=n?w[0]:x[0]/(1+y.extentPadding))}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const A="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(A)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,ke.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=r.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),s=this.scales.x.range(),l=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=l[1]>l[0];this.scales={x:a(this.config.xScaleType,o,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:a(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,l,a;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const a=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},h={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:a,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ae},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let d;try{d=c.customLayout(h)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=d.overlays)&&void 0!==s?s:null,null!==(l=d.nodes)&&void 0!==l?l:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const h={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=me(e,t.data,t.key);n&&i.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=R(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return ve(e,o,i),i}(h,t);case"area":return function(e,t){const n=e.groupData(t),o=[],i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=F(t.data,e.scales,e.getX,e.getY,i,n,t.key,r);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ve(e,n,o),o}(h,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set,r=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=F(t.data,e.scales,e.getX,e.getY,r,n,t.key,s);e.config.gradientFill&&(i.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=R(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return ve(e,n,o),o}(h,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===l)a();else if("asc"===l||"desc"===l||"insideOut"===l){const t=new Map;for(const n of s){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===l)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],l=[];let a=0,c=0;for(const n of e)c>a?(r.push(n),a+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(l.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...l.reverse(),...r)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:h,stackedTops:d}=function(e,t,n,o,i,r,s,l="zero"){var a,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const h=Array.from(u).sort((e,t)=>e-t),d=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}d.set(t.key,e)}let f;if(r){f=new Map;for(const t of h){let n=0;for(const o of e)n+=(null===(a=d.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=H(h,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=d.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of h)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=d.get(n.key),o=[],l=[],a=new Map;for(const n of h){let i=e.get(n)||0;const s=m.get(n);r&&(i/=f.get(n));const c=s+i,u=t.x(n);l.push([u,t.y(s)]),o.push([u,t.y(c)]),m.set(n,c),a.set(n,c)}y.set(n.key,a);const c={type:"area",topPath:o,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=h;if(e.config.pointStyle){const t=new WeakMap;for(const n of s){const o=d.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};ve(e,s,f,n)}return f}(h,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(l&&e.getColor&&!t.fill){const o=e.getColor(n);o&&l.has(o)&&(t=Object.assign(Object.assign({},t),{fill:l.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=I(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(h,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),a=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=D(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,h]=e.scales.x.domain(),[d,f]=e.scales.y.domain(),g=(h-u||1)/s,p=(f-d||1)/l,y=s*l;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const a=Math.min(Math.floor((i-u)/g),s-1),h=Math.min(Math.floor((r-d)/p),l-1);if(0>a||0>h)continue;const f=h*s+a;m[f]++;const y=c(o);v[f]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(a){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,j=n.height/l,A=e.config.showValues,O=e.config.heatmapValueFormat,M=[];for(let e=0;l>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(a){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;M.push(z(n*w,(l-1-e)*j,w,j,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o]},A?{value:i,showValues:!0,valueFormat:O}:void 0))}}return M}(e,t,n);if(0===t.length)return[];const o=D(e.config.valueAccessor,"value"),i=$(e.config.xAccessor,"x"),r=$(e.config.yAccessor,"y"),s=new Map,l=new Map,a=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);a[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),l.has(u)||l.set(u,l.size)}const u=s.size,h=l.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(l.keys()),g=d.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){d.sort((e,t)=>e-t),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(p){f.sort((e,t)=>e-t),l.clear();for(let e=0;f.length>e;e++)l.set(f[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(a[e]),r=l.get(c[e]);if(void 0===i||void 0===r)continue;const h=o(n),d=r*u+i,f=b.get(d);let g;void 0!==f?g=f:(g=x++,b.set(d,g)),y[g]=d,m[g]=h,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const j=function(e){const t=e in be?e:"blues";let n=xe.get(t);if(n)return n;n=Array(256);const o=be[t]||V;for(let e=0;256>e;e++)n[e]=o(e/255);return xe.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),O=n.width/u,M=n.height/h,S=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;_.push(z(o*O,(h-1-(n-o)/u)*M,O,M,j[Math.min((t-k)*A+.5|0,255)],v[e],S?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(h,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=T(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),s=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?r=e.barCategoryCache.order:(r=[...l,...s],e.barCategoryCache={key:a,order:r})}const s=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,h=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,d=null==u?void 0:u.gap,f="number"!=typeof d||0>d?1:d,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,a),i=Math.min(t.end,c);if(n>=i)continue;const d=l.x(n),p=l.x(i),y=Math.abs(p-d),m=y>f+1?f:0,v=Math.min(d,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const a=l.y(n),c=l.y(n+r),d=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||h||"#4e79a7";s.push(N(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:d},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=l.y(0),n=l.y(t.total);s.push(N(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||h||"#007bff"},g),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(h,t);return this._barCategoryCache=null!==(a=h.barCategoryCache)&&void 0!==a?a:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,h=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",d=null!==(s=c.opacity)&&void 0!==s?s:.7,f=c.stroke,g=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let s=h;if(e.getCategory){const t=e.getCategory(n);s=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:d,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(h,t);case"waterfall":return function(e,t,n){var o,i,r,s,l,a,c;const u=[],h=e.scales,d=e.config.waterfallStyle,f=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===f.length)return u;const g=null!==(r=null!==(o=null==d?void 0:d.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(a=null!==(s=null==d?void 0:d.negativeColor)&&void 0!==s?s:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==d?void 0:d.gap)&&void 0!==c?c:1,m=null==d?void 0:d.stroke,v=null==d?void 0:d.strokeWidth,b=null==d?void 0:d.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),r=e.getY(o),s=x+r;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=h.x(i),c=0!==l?h.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=s;continue}const j=h.y(x),A=h.y(s),O=Math.min(j,A),M=Math.abs(j-A),S={fill:0>r?p:g,stroke:m,strokeWidth:v};null!=b&&(S.opacity=b),u.push(N(k,O,w,M,S,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==d?void 0:d.connectorStroke,_connectorWidth:null==d?void 0:d.connectorWidth}))),x=s}return u}(h,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},l=s.rangeColor||"#6366f1",a=i?l:s.upColor||"#28a745",c=i?l:s.downColor||"#dc3545",u=i?l:s.wickColor||"#333",h=s.wickWidth||(i?2:1),d=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.bodyWidth)if(d.length>1){let t=1/0;for(let n=1;d.length>n;n++){const o=Math.abs(e.scales.x(d[n])-e.scales.x(d[n-1]));o>0&&t>o&&(t=o)}f=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else f=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const l=i?o:e.getOpen(n),d=i?s:e.getClose(n);if(!i&&[l,d].some(e=>null==e||Number.isNaN(e)))continue;const g=d>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(d),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:h,isUp:g,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(h,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?fe(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const l=s.get(t[n]);null!=l?(o[n]=fe(e,l,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let l=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=fe(e,o,r),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=fe(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const l=fe(e,t,r);if("heatcell"===n.type)n.style={opacity:l};else if("candlestick"===n.type)n._decayOpacity=l;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*l})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const l=ge(e,r,s);l>i&&(i=l)}i>0&&(n._pulseIntensity=i,n._pulseColor=l);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=ge(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=l,n._pulseGlowRadius=a)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,r,s,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=ye(e,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=ye(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var r,s,l,a,c,u,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,$,E,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let q=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=ye(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];q=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];q=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:r.style.opacity)&&void 0!==a?a:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),q=!0;continue}const L=o.get(P);if("point"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(h=L.r)&&void 0!==h?h:r.r,q=!0)}else r._targetOpacity=null!==(d=r.style.opacity)&&void 0!==d?d:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),q=!0;else if("rect"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(f=r.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(g=L.w)&&void 0!==g?g:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,q=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),q=!0;else if("heatcell"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,q=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),q=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(A=null===(j=r.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(M=L.highY)&&void 0!==M?M:r.highY,r.lowY=null!==(S=L.lowY)&&void 0!==S?S:r.lowY,q=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),q=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),q=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),q=!0}for(const[e,t]of o)if(!V.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(B=t.r)&&void 0!==B?B:3,style:{opacity:null!==(T=t.opacity)&&void 0!==T?T:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(R=t.w)&&void 0!==R?R:0,h:null!==(F=t.h)&&void 0!==F?F:0,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(I=t.w)&&void 0!==I?I:0,h:null!==(N=t.h)&&void 0!==N?N:0,fill:"#999",datum:null,style:{opacity:null!==(z=t.opacity)&&void 0!==z?z:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(D=t.closeY)&&void 0!==D?D:o,highY:null!==($=t.highY)&&void 0!==$?$:o,lowY:null!==(E=t.lowY)&&void 0!==E?E:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}q=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),q&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,r,s,l,a,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),h=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=pe(r,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==e._targetR&&void 0!==n.r&&(e.r=pe(n.r,e._targetR,h))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=pe(i,e._targetOpacity,h)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),e.y=pe(n.y,e._targetY,h),void 0!==n.w&&(e.w=pe(n.w,e._targetW,h)),void 0!==n.h&&(e.h=pe(n.h,e._targetH,h))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:pe(i,e._targetOpacity,h)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=pe(n.x,e._targetX,h),void 0!==n.openY&&(e.openY=pe(n.openY,e._targetOpenY,h)),void 0!==n.closeY&&(e.closeY=pe(n.closeY,e._targetCloseY,h)),void 0!==n.highY&&(e.highY=pe(n.highY,e._targetHighY,h)),void 0!==n.lowY&&(e.lowY=pe(n.lowY,e._targetLowY,h))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=pe(t[o][0],n[o][0],h),e.path[o][1]=pe(t[o][1],n[o][1],h)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:pe(t,e._targetOpacity,h)})}void 0!==e._introClipFraction&&(e._introClipFraction=h);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=pe(t[n][0],o[n][0],h),e.topPath[n][1]=pe(t[n][1],o[n][1],h);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=pe(n[t][0],i[t][0],h),e.bottomPath[t][1]=pe(n[t][1],i[t][1],h)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ae,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ae;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>ke.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!W(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=a||!W(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=D(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=D(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=D(this.config.xAccessor,"x"),this.getY=D(this.config.yAccessor,"y")),s=!0,l=!0)}if("groupAccessor"in e&&!W(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?E(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!W(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?E(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!W(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?D(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!W(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?E(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!W(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?D(this.config.y0Accessor,"y0"):void 0,s=!0,l=!0),"boundsAccessor"in e&&!W(e.boundsAccessor,r.boundsAccessor)&&(this.getBounds=this.config.boundsAccessor?D(this.config.boundsAccessor,"bounds"):void 0,s=!0,l=!0),"pointIdAccessor"in e&&!W(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?E(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!W(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!W(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!W(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!W(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?D(this.config.openAccessor,"open"):void 0,this.getHigh=D(this.config.highAccessor,"high"),this.getLow=D(this.config.lowAccessor,"low"),this.getClose=t?D(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,l=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function we(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:d.createElement(d.Fragment,null,...t)}function je(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Oe(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Me(e,t){const n=Oe(e);if(!n)return!1;const o=Oe(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}ke.GROUP_COLOR_MAP_CAP=1e3,ke.QUADTREE_THRESHOLD=500;const Se=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ce=new WeakMap;let _e=0,Pe=!1,Le=null,Be=null,Te=null;function Re(e,t){var n,o;if(!t)return t;const i=Se.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pe=!0;const e=()=>{_e++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Le=new MutationObserver(e),Le.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Be=window.matchMedia("(prefers-color-scheme: dark)"),Te=e,"function"==typeof Be.addEventListener?Be.addEventListener("change",Te):"function"==typeof Be.addListener&&Be.addListener(Te)}catch(e){}}();let s=Ce.get(r);s&&s.version===_e||(s={version:_e,map:new Map},Ce.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}function Fe(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function He(e,t,n){return null==t?n:"string"!=typeof t?t:Re(e,t)||n}function Ie(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(o,i,r,s);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),u=Math.max(0,Math.min(1,a)),h=e.createLinearGradient(o,i,r,s),[d,f,g]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${g},${c})`),h.addColorStop(1,`rgba(${d},${f},${g},${u})`),h}function Ne(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}const ze=new WeakMap;function We(e,t){const n=Fe(t);if(!n)return e;const o=ze.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,s,l,a){if(!i)return i=[l,a],void o.push([l,a]);const[c,u]=i;for(let i=1;n>=i;i++){const h=i/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*r+h*h*h*l,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return ze.set(e,i),i}function De(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,l=t+r,a=n-r,c=n+r;let u=null,h=1/0;return e.visit((e,i,r,d,f)=>{if(i>l||s>d||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,l=Math.sqrt(r*r+s*s);Ae(e.r,o)>=l&&h>l&&(u=e,h=l),i=i.next}while(i)}return!1}),u?{node:u,distance:h}:null}(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=Ee(r,t,n,o);break;case"line":e=Ye(r,t,n,o);break;case"rect":if(null==r.datum)break;e=Xe(r,t,n);break;case"heatcell":e=qe(r,t,n);break;case"area":if(!1===r.interactive)break;e=Ue(r,t,n);break;case"candlestick":e=Ve(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function $e(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Ke(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[s,l]=e[i],[a,c]=e[r];return a===s?l:l+Math.max(0,Math.min(1,(t-s)/(a-s)))*(c-l)}function Ee(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Ae(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ye(e,t,n,o=30){var i,r,s,l;if(0===e.path.length)return null;const a=Ke(e.path,t);if(0>a)return null;const[c,u]=e.path[a];let h;if(e.path.length>1){let o=1/0;const i=Math.max(0,a-1),r=Math.min(e.path.length-2,a);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[l,a]=e.path[s+1],c=Ge(t,n,i,r,l,a);o>c&&(o=c)}h=o}else{const e=t-c,o=n-u;h=Math.sqrt(e*e+o*o)}const d=null!==(l=null!==(r=null===(i=e.style)||void 0===i?void 0:i.strokeWidth)&&void 0!==r?r:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==l?l:1;return h>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:c,y:u,distance:h}}function Ge(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Xe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function qe(e,t,n){const o=je(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ve(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function Ue(e,t,n){if(0===e.topPath.length)return null;const o=Ke(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,l=n-r,a=Math.sqrt(s*s+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:a}}function Ke(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Qe(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Ze(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Je={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function et(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Je[n])(o(e,t)),i}function tt(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function nt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ot=(t,n,o,i,r,s,l,a,c,u)=>{const{type:h="fill",styleFn:d,items:f}=t,g=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=r;return f.forEach((t,u)=>{const v=et(t,u,h,d),b=nt(t,i,r),x=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=22}),g};function it({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+d.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function rt(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:h="vertical"}=t,[f,g]=d.useState(0),[p,y]=d.useState(0),m=d.useCallback((e,t)=>{g(e),y(t)},[]),v="vertical"===h?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let h=24;const d=[];return t.forEach((t,f)=>{h+=5,d.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,d.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),d.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ot(t,o,i,r,s,l,a,f,c,u)},"legend-group-"+f)),h+=22*t.items.length+8}),d})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:h})=>{let d=0;const f=[];t.forEach((t,n)=>{let g=0;t.label&&(g+=16);const p=((t,n,o,i,r,s,l,a,c,u,h)=>{const{type:d="fill",styleFn:f,items:g}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=r;g.forEach((t,u)=>{const x=et(t,u,d,f),k=nt(t,i,r),w=r&&r.size>0&&r.has(t.label),j=26+7*t.label.length;h&&h>0&&y>0&&y+j>h&&(m++,y=0),p.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?a===s&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.jsx(tt,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=j});let x=0,k=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&k>0&&k+t>h?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:p,offset:x,totalRows:w,totalHeight:22*w}})(t,i,r,s,l,a,c,n,u,h,o);g+=p.offset+5,f.push(Object.assign(Object.assign({label:t.label},p),{offset:g,totalRows:p.totalRows,totalHeight:p.totalHeight})),d+=g+12});let g=d>o?0:Math.max(0,(o-d)/2);const p=[];return f.forEach((o,i)=>{const r=t[i];r.label&&(p.push(e.jsx("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),g+=16),p.push(e.jsx("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+i)),g+=o.offset+5,t[i+1]&&p.push(e.jsx("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e.jsx("g",{children:p})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:l}),b=!(!o&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===h&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),v]})}function st(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function lt(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:l,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=t;if(!n)return null;const f="top"===s||"bottom"===s;let g,p;return"left"===s?(g=4,p=r.top):"top"===s?(g=0,p=l?32:8):"bottom"===s?(g=0,p=i-r.bottom+50):(g=o-r.right+10,p=r.top),e.jsx("g",{transform:`translate(${g}, ${p})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(it,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):st(n)?e.jsx(rt,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):n)});var y}function at(e){return"string"==typeof e?{type:e}:e}function ct({orient:n,config:o,values:i,scale:r,size:s,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,h=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),o=s-8;if("boxplot"===c.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)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:s,median:l,q3:a,whiskerLow:h,whiskerHigh:d}=t,f=Math.min(.5*o,20),g=(o-f)/2+4;if(u){const t=r(s),o=r(a),i=r(l),u=r(h),p=r(d),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(g+f/2),x2:p,y2:m+y*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*g,x2:u,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*g,x2:p,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-g-f:m+g,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-g-f:m+g,x2:i,y2:"top"===n?m-g:m+g+f,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),o=r(a),i=r(l),u=r(h),p=r(d),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(g+f/2),y1:u,x2:m+y*(g+f/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:u,x2:m+y*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:p,x2:m+y*(g+f),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-g-f:m+g,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-g-f:m+g,y1:i,x2:"left"===n?m-g:m+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const h=l.bin().domain(t).thresholds(c.bins)(i);if(0===h.length)return null;const d=Math.max(...h.map(e=>e.length));if(0===d)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:h.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/d*o;if(u){const o=r(t.x0),l=r(t.x1)-r(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-s:4,width:Math.max(l,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=r(t.x0),l=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===n?-4-s:4,y:Math.min(o,o+l),width:s,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of h){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),l=r((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-s):t-s}`:`${"left"===n?-(t-s):t-s},${l}`)}for(let e=h.length-1;e>=0;e--){const s=h[e];if(null==s.x0||null==s.x1)continue;const l=s.length/d*(o/2),a=r((s.x0+s.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=h[0].x0?r(h[0].x0):0;t.push(`M${i},${e}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===n?-i-4:i+4}`)}const s=null!=h[h.length-1].x1?r(h[h.length-1].x1):a;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=h[0].x0?r(h[0].x0):0;t.push(`M${e},${i}`);for(const e of h){if(null==e.x0||null==e.x1)continue;const i=e.length/d*o,s=r((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${s}`)}const s=null!=h[h.length-1].x1?r(h[h.length-1].x1):a;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,a,n,u,4]);return h?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:h}):null}function ut(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function ht(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 dt(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===h?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===h?"right"===d?f="end":"middle"===d&&(f="middle"):f=0>n?"end":"start";const g=16,p=s?u?[s]:ut(s,c):[],y=r?u?[r]:ut(r,c):[],m="leftRight"===h?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:p.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=p.length*g),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let k=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===h){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),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*g+(y.length>0?g:0);let n=0,o=t;"bottom"===d?(n=-t,o=0):"middle"===d&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*g;let j=0;return"topBottom"===h?j=0>o?-(w+2):18:"leftRight"===h&&(j="middle"===d?-(w+g+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function ft(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:ht((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:l})}function gt(t,n,o,i,r,s){const l=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),u=e/2,h=o/2,d=t*h>n*u?u/t:h/n;a=i+s*d,c=r+l*d}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(l.push(e.jsx("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-a);l.push(e.jsx("path",{d:`M${a},${c}L${a+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${a+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:l})}function pt(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:l,note:a,connector:c,subject:u,type:h,color:d,className:f,disable:g,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(g)?g:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=l&&(b=l-o);const x="string"==typeof h?h:"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.jsxs("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&>(v,b,c,d,x,u),!m.has("subject")&&ft(x,u,d,n,o),!m.has("note")&&dt(a,v,b,d)]}))}function yt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.jsx(pt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(pt,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function mt(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function vt(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function bt(e,t,n){var o,i,r,s;const l=e.anchor||"fixed";if("latest"===l){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const h=a[e.xAccessor||"x"],d=a[e.yAccessor||"y"];return null==h||null==d?null:{x:c(h),y:u(d)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=mt(e,n),c=vt(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===l){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function xt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const kt={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};let wt={positions:new Map};const jt=new Set;function At(){for(const e of jt)e()}function Ot(e,t){const n=wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function Mt(e,t){const n=wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(wt.positions);o.delete(e),wt={positions:o},At()}function St(){return wt}function Ct(e){return jt.add(e),()=>jt.delete(e)}const _t={positions:new Map};function Pt(){return()=>{}}function Lt(){return _t}function Bt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Tt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function Rt(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:l,scales:a,showAxes:c,axes:u,showGrid:h,xFormat:d,yFormat:f}=n,g=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||d||Ft,i=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=a.x.ticks(Math.min(i,Math.max(2,Math.floor(o/70)))),s=r.map(e=>e.valueOf()),l=r.map((e,t)=>({value:e,pixel:a.x(e),label:n(e,t,s)})),c=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Ht(l,Math.max(55,c+8))},[a,u,d,o]),p=t.useMemo(()=>{var e;if(!a)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||f||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Ht(a.y.ticks(Math.min(o,Math.max(2,Math.floor(i/30)))).map(e=>({value:e,pixel:a.y(e),label:n(e)})),22)},[a,u,f,i]),y=h&&a,m=c&&a;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,j=(null==b?void 0:b.jaggedBase)||!1,A="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[y&&(()=>{var t,n;const r=Bt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=Bt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[g.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),p.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),x&&!w&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:A,strokeWidth:1}),w&&e.jsx("path",{d:Tt("bottom",o,i),fill:"none",stroke:A,strokeWidth:1}),k&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:A,strokeWidth:1}),j&&e.jsx("path",{d:Tt("left",o,i),fill:"none",stroke:A,strokeWidth:1})]})})}function Ft(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ht(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function It(n){var o,i;const{width:r,height:l,totalWidth:c,totalHeight:u,margin:h,scales:d,showAxes:g,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:j,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S,legendPosition:C="right",foregroundGraphics:_,marginalGraphics:P,xValues:L,yValues:B,annotations:T,svgAnnotationRules:R,xAccessor:F,yAccessor:H,annotationData:I,pointNodes:N,curve:z,underlayRendered:W,canvasObscuresUnderlay:D=!0,linkedCrosshairName:$,linkedCrosshairSourceId:E,children:Y}=n,G=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=d.x.ticks(Math.min(o,Math.max(2,Math.floor(r/70)))),s=i.map(e=>e.valueOf()),l=i.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,s)})),a=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Ht(l,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,s);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[g,d,p,b,r]),X=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||Ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=d.y.domain()[1],t=d.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[g,d,p,x,l]),q=t.useMemo(()=>{var e;if(!g||!d)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||Ft,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ht(d.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[g,d,p,x,l]),V=t.useRef(new Map),U=t.useRef(null!==(o=null==T?void 0:T.length)&&void 0!==o?o:0),K=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;U.current!==K&&(U.current=K,V.current=new Map);const Q=t.useMemo(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var i,r,l,c,u,h,d,g,p,y,m,v,b,x,k,w,j,A,O,M,S,C,_,P,L,B,T,R,F,H,I,N,z,W,D,$,E,Y,G,X,q,V,U,K,Q,Z,J,ee;switch(t.type){case"label":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return xt(r,s,o)?e.jsx(yt,{noteData:{x:r,y:s,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}},"ann-"+n):null}case"callout":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return xt(r,s,o)?e.jsx(yt,{noteData:{x:r,y:s,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}},"ann-"+n):null}case"x-threshold":{const i=mt(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let l;return l="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=vt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=a.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:mt(Object.assign(Object.assign({},e),{type:"point"}),o),y:vt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...l)-r,h=Math.max(...l)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:h-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=mt(n,o),l=vt(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=mt(t,o),r=vt(t,o);return e.jsx(yt,{noteData:{x:null!=i?i:0,y:null!=r?r: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}},"ann-"+n)}case"trend":{const s=o.data||[];if(2>s.length)return null;const a=o.xAccessor||"x",g=o.yAccessor||"y",p=s.map(e=>[e[a],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(h=o.scales)||void 0===h?void 0:h.value;if(!y||!m)return null;const v=t.method||"linear";let b;b="loess"===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]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*i[e],d+=t*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const p=u*f-h*h;if(1e-12>Math.abs(p))l.push([t,d/u]);else{const e=(u*g-h*d)/p;l.push([t,(d-e*h)/u+e*t])}}return l}(p,null!==(d=t.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?f.default.polynomial(p,{order:t.order||2}):f.default.linear(p)).points;const x=b.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:k,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(p=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==p?p:null===(y=o.scales)||void 0===y?void 0:y.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",l=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.time,a=null!==(j=null===(w=o.scales)||void 0===w?void 0:w.y)&&void 0!==j?j:null===(A=o.scales)||void 0===A?void 0:A.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",h=t.filter,d=i.filter(e=>null!=e[c]&&null!=e[u]&&!(h&&!h(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const f=kt[o.curve||"linear"]||s.curveLinear,g=s.area().x(e=>l(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:p,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&d.length>0&&e.jsx("text",{x:l(d[d.length-1][r])+4,y:a(d[d.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(S=null===(M=o.scales)||void 0===M?void 0:M.x)&&void 0!==S?S:null===(C=o.scales)||void 0===C?void 0:C.time,l=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.scales)||void 0===L?void 0:L.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,h=Math.sqrt(u),d=null!==(B=t.threshold)&&void 0!==B?B:2,f=c-d*h,g=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,m=t.anomalyColor||"#ef4444",v=null!==(R=t.anomalyRadius)&&void 0!==R?R:6,b=l(c+d*h),x=l(f),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>d*h});return e.jsxs("g",{children:[g&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const i=mt(t,o),r=vt(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.x)&&void 0!==H?H:null===(I=o.scales)||void 0===I?void 0:I.time,a=null!==(z=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==z?z:null===(W=o.scales)||void 0===W?void 0:W.value;if(!l||!a)return null;const c=i.map(e=>[e[r],e[s]]).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")){const e=f.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;u=e=>l+s*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(h-2,1)),p=c.reduce((e,t)=>e+t[0],0)/h,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(D=t.confidence)&&void 0!==D?D:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==($=t.steps)&&void 0!==$?$:5,x=c[h-1][0],k=(x-c[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),M=`${l(x)},${a(u(x))}`,S=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${M} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:l(j[j.length-1].x)+4,y:a(j[j.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=bt(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!xt(i,r,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(q=t.dy)&&void 0!==q?q:0,a=null!==(V=t.width)&&void 0!==V?V:32,c=null!==(U=t.height)&&void 0!==U?U:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=bt(t,n,o);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(Z=o.scales)||void 0===Z?void 0:Z.x,l=null===(J=o.scales)||void 0===J?void 0:J.y,a=(null==r?void 0:r.bandwidth)?r:(null==s?void 0:s.bandwidth)?s:(null==l?void 0:l.bandwidth)?l:null;if(!a)return null;const c=a(i);if(null==c)return null;const u=a.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",d=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:a===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:F,yAccessor:H,width:r,height:l,data:I,frameType:"xy",pointNodes:N,curve:z,stickyPositionCache:V.current};return T.map((e,o)=>{if(R){const i=R(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[T,R,r,l,F,H,I,d,N,z]),Z=function(e){var n;const o=t.useSyncExternalStore(e?Ct:Pt,e?St:Lt,e?St:Lt);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}($);return t.useEffect(()=>{if(!(null==Z?void 0:Z.locked)||!$)return;const e=e=>{"Escape"===e.key&&Mt($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,$]),g||w||j||_||P||Q&&Q.length>0||k||Y||Z?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[k&&d&&(!W||D)&&(()=>{var t,n;const o=Bt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Bt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),X.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&d&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=r/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!W||D)&&i&&!a&&e.jsx("line",{x1:0,y1:l,x2:r,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&a&&e.jsx("path",{d:Tt("bottom",r,l),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Me(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:l+40,textAnchor:"middle",fontSize:12,fill:g,style:{userSelect:"none"},children:y}),(!W||D)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:d,strokeWidth:1}),(!W||D)&&s&&e.jsx("path",{d:Tt("left",r,l),fill:"none",stroke:d,strokeWidth:1}),X.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Me(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-h.left,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(-90, ${15-h.left}, ${l/2})`,style:{userSelect:"none"},children:n}):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.jsxs(e.Fragment,{children:[!1!==t.baseline&&e.jsx("line",{x1:r,y1:0,x2:r,y2:l,stroke:d,strokeWidth:1}),q.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Me(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:f,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-r-"+o)}),o&&e.jsx("text",{x:r+h.right-15,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(90, ${r+h.right-15}, ${l/2})`,style:{userSelect:"none"},children:o})]})})()]})})(),Q,P&&d&&L&&B&&e.jsxs(e.Fragment,{children:[P.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"top",config:at(P.top),values:L,scale:d.x,size:h.top,length:r})}),P.bottom&&e.jsx("g",{transform:`translate(0, ${l})`,children:e.jsx(ct,{orient:"bottom",config:at(P.bottom),values:L,scale:d.x,size:h.bottom,length:r})}),P.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ct,{orient:"left",config:at(P.left),values:B,scale:d.y,size:h.left,length:l})}),P.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ct,{orient:"right",config:at(P.right),values:B,scale:d.y,size:h.right,length:l})})]}),_,Z&&Z.sourceId!==E&&(null==d?void 0:d.x)&&(()=>{const t=d.x(Z.xValue);if(null==t||0>t||t>r)return null;const n=Z.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),lt({legend:j,totalWidth:c,totalHeight:u,margin:h,legendPosition:C,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:M,legendIsolatedCategories:S})]}):null}function Nt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const zt="undefined"==typeof window||"undefined"==typeof document,Wt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Dt=()=>()=>{},$t=()=>!1,Et=()=>!0;function Yt(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Gt(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Xt(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const qt=d.createContext(null),Vt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ut(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Kt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Qt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Zt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Jt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},en={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},tn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},nn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},on={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function rn({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=d.useState(!1),a=d.useContext(qt),c=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,u=s||c,h=d.useRef(null),f=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=d.useCallback(()=>{s||c||l(!0)},[s,c]),p=d.useCallback(e=>{var t;c||(null===(t=h.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Vt}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:g,style:Vt,role:"region","aria-label":f,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,i,r,s,l,a,c,u,h,d,f,g,p,y,m,v,b,x,k,w,j,A,O;const M=[];if(!Array.isArray(e))return M;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":M.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;M.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":M.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=S.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=S.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(d=null===(h=S.datum)||void 0===h?void 0:h.id)&&void 0!==d?d:"",x:null!==(f=S.cx)&&void 0!==f?f:S.x,y:null!==(g=S.cy)&&void 0!==g?g:S.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(y=null===(p=S.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(v=S.cy)&&void 0!==v?v:S.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=S.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(O=null===(A=S.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return M}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Kt(e.min)} to ${Kt(e.max)}, mean ${Kt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const k=Array.from(x);return e.jsxs("div",{ref:h,id:o,tabIndex:-1,onBlur:p,style:Qt,role:"region","aria-label":f,children:[e.jsx("button",{type:"button",onClick:()=>{c&&a&&a.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:Jt,children:"×"}),e.jsx("div",{role:"note",style:Zt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:en,children:[e.jsxs("caption",{style:on,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:tn,children:"type"}),k.map(t=>e.jsx("th",{style:tn,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:nn,children:t.label}),k.map(n=>{return e.jsx("td",{style:nn,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Kt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function sn({summary:t}){return t?e.jsx("div",{role:"note",style:Vt,children:t}):null}function ln({tableId:t}){return e.jsx("a",{href:"#"+t,style:Vt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Vt)},children:"Skip to data table"})}function an({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Vt,children:n})}const cn="var(--semiotic-focus, #005fcc)";function un({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:cn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:cn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function hn({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=d.useRef(null),[u,h]=d.useState(null);d.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let f;return f=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:l,style:{position:"absolute",left:r.left+t,top:r.top+n,transform:f,pointerEvents:"none",zIndex:a,width:"max-content"},children:s})}function dn(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}const fn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function gn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pn(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=dn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=gn(e.foregroundGraphics,r,s),u=gn(e.backgroundGraphics,r,s),h=P(e=>e.theme),{transition:f,introEnabled:g}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+d.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const M=e.themeDirtyRef;return fn(()=>{M&&(_e++,M.current=!0,v())},[h,v,M]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:h,transition:f,introEnabled:g,tableId:p,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function yn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function mn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function vn(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const bn=(e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",h=Re(e,u)||u,d=a.style.strokeWidth||2,f=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;vn(e,a.path,h,d,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Fe(a.curve),y=f&&f.length>0&&g&&g.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=h;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,O=!1;function M(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function S(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[_,P]=a.path[C],L=g[C],B=mn(L,f,h);if(null!==k&&null!==A&&null!==j){if(B===A)e.lineTo(_,P);else{const T=[];for(const R of f){const F=R.value;(j>F||F>L)&&(F>j||L>F)||j===F||L===F||T.push({t:(F-j)/(L-j)})}T.sort((e,t)=>e.t-t.t);for(const H of T){const I=k+(_-k)*H.t,N=w+(P-w)*H.t,z=mn(j+(L-j)*Math.min(H.t+1e-4,1),f,h);e.lineTo(I,N),S(),M(z,I,N)}e.lineTo(_,P)}k=_,w=P,j=L,A=B}else M(B,_,P),k=_,w=P,j=L,A=B}S()}else{e.beginPath();const W=a.strokeGradient&&a.path.length>=2?Ne(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=W||h,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[D,$]=a.path[0];e.moveTo(D,$);for(let E=1;a.path.length>E;E++)e.lineTo(a.path[E][0],a.path[E][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=He(e,a.style.fill,a.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,X]=a.path[0];e.moveTo(G,X);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function xn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function kn(e,t,n=.3){xn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function wn(e,t,n=.6){var o,i,r,s,l;if(!xn(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,h=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,h,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function jn(e,t,n,o=.35){xn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function An(e,t){const n=Fe(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=s.area().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const On=(e,t,n,o)=>{var i,r,l;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=t.style.fill||"#4e79a7",u=t._decayOpacities;if(u&&u.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(u[n]+u[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const h=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(An(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=Ie(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,n,0,o);e.fillStyle=i||c,e.globalAlpha=h}else{const n=null!==(l=t.style.fillOpacity)&&void 0!==l?l:.7;e.globalAlpha=n*h,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(An(e,t),jn(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=h;const n=t.strokeGradient&&t.topPath.length>=2?Ne(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Fe(t.curve);if(e.beginPath(),o)s.line().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Mn=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=He(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=He(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),wn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Sn(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const Cn=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)_n(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,l),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s,l+c);break;case"left":e.moveTo(s+a,l),e.lineTo(s+r,l),e.arcTo(s,l,s,l+r,r),e.lineTo(s,l+c-r),e.arcTo(s,l+c,s+r,l+c,r),e.lineTo(s+a,l+c);break;case"bottom":e.moveTo(s,l),e.lineTo(s+a,l),e.lineTo(s+a,l+c-r),e.arcTo(s+a,l+c,s+a-r,l+c,r),e.lineTo(s+r,l+c),e.arcTo(s,l+c,s,l+c-r,r);break;default:e.moveTo(s,l+c),e.lineTo(s,l+r),e.arcTo(s,l,s+r,l,r),e.lineTo(s+a-r,l),e.arcTo(s+a,l,s+a,l+r,r),e.lineTo(s+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=He(e,t.style.fill,Re(e,"var(--semiotic-primary, #007bff)")),o=Sn(t),i=t.fillGradient&&"string"==typeof n?Ie(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Re(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}kn(e,t),e.globalAlpha=1}};function _n(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Pn(e,t,n,o){return Object.assign({data:e,x:t,y:n,__semioticHoverData:!0},o)}function Ln(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Bn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Tn=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Re(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),kn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Bn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=Ln(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Rn=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const l=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==l&&(e.globalAlpha=l);const a=Re(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,h=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||h(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=a,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=Re(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&h(),e.restore()}},Fn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hn(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Fn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const In={line:[On,bn,Mn],area:[On,Mn],stackedarea:[On,Mn],scatter:[Mn],bubble:[Mn],heatmap:[Tn],bar:[Cn],swarm:[Mn],waterfall:[(e,t,n,o)=>{var i,r,s;Cn(e,t);const l=t.filter(e=>"rect"===e.type);if(2>l.length)return;const a=l[0].datum,c=null==a?void 0:a._connectorStroke;if(c){e.save(),e.strokeStyle=Re(e,c)||c,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;l.length-1>t;t++){const o=l[t],i=l[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=i.datum)||void 0===s?void 0:s.baseline))continue;const a=n.y(o.datum.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[Rn],mixed:[On,bn,Mn],custom:[On,Cn,Tn,bn,Mn,Rn]},Nn={top:20,right:20,bottom:30,left:40},zn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function Wn(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Dn={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 $n({hover:t}){var n,o,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(n=t.data)&&void 0!==n?n:{},l=null!==(o=s.y)&&void 0!==o?o:s.value,a=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:Dn,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(l)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(a)})]})}const En=t.forwardRef(function(n,o){var i,r,s,l,a,c,u,h,f,g,p,m,x;const{chartType:k,runtimeMode:j,data:A,chunkThreshold:O,chunkSize:M,xAccessor:S,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:B,curve:T,normalize:R,baseline:F,stackOrder:H,binSize:I,valueAccessor:N,arrowOfTime:z="right",windowMode:W="sliding",windowSize:D=200,timeAccessor:$,xExtent:E,yExtent:Y,extentPadding:G=.1,scalePadding:X,sizeRange:q,size:V=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:ne,barStyle:oe,waterfallStyle:ie,swarmStyle:re,barColors:se,colorScheme:le,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:he,lineGradient:de,areaGroups:fe,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,showAxes:be=!0,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:Me,yFormat:Se,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Be,customClickBehavior:Te,enableHover:Fe,hoverRadius:He=30,tooltipMode:Ie,annotations:Ne,svgAnnotationRules:ze,showGrid:Ee,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,legendCategoryAccessor:Je,onCategoriesChange:et,backgroundGraphics:tt,foregroundGraphics:nt,canvasPreRenderers:ot,svgPreRenderers:it,title:rt,categoryAccessor:st,brush:lt,onBrush:at,decay:ct,pulse:ut,transition:ht,animate:dt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,marginalGraphics:bt,pointIdAccessor:xt,xScaleType:kt,yScaleType:wt,accessibleTable:jt=!0,description:At,summary:Ot,linkedCrosshairName:Mt,linkedCrosshairSourceId:St,customLayout:Ct,layoutConfig:_t}=n,Pt=t.useId().replace(/:/g,""),Lt=t.useRef(!1),Bt=pn({sizeProp:V,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:Nn,animate:dt,transitionProp:ht,themeDirtyRef:Lt}),Tt=function(){const[e,n]=t.useState(!1);return Wt(()=>{n(!0)},[]),e}(),Ft=function(){const e=t.useSyncExternalStore(Dt,$t,Et);return t.useRef(e).current}(),{reducedMotionRef:Ht,responsiveRef:qt,size:Vt,currentTheme:Kt,transition:Qt,introEnabled:Zt,tableId:Jt,rafRef:en,renderFnRef:tn,scheduleRender:nn}=Bt;let on=Bt.margin;if(bt){const e=60,t=Object.assign({},Bt.margin);bt.top&&e>t.top&&(t.top=e),bt.bottom&&e>t.bottom&&(t.bottom=e),bt.left&&e>t.left&&(t.left=e),bt.right&&e>t.right&&(t.right=e),on=t}const cn="function"==typeof nt?nt({size:Vt,margin:on}):nt,dn="function"==typeof tt?tt({size:Vt,margin:on}):tt,fn=Vt[0]-on.left-on.right,gn=Vt[1]-on.top-on.bottom,mn=t.useMemo(()=>v(A),[A]),vn=null!=Pe?Pe:Fe,bn=t.useRef(null),xn=t.useRef(null),[kn,wn]=t.useState(0),[jn,An]=t.useState(null),On=t.useRef(null),Mn=t.useRef(null),[Sn,Cn]=t.useState(null),_n=t.useRef(zn.primary),Ln=t.useRef([]),Bn=t.useRef(Je),Tn=t.useRef(et);Bn.current=Je,Tn.current=et;const[Rn,Fn]=t.useState(!1),[Dn,En]=t.useState([]),[Yn,Gn]=t.useState([]),Xn="streaming"===j||["bar","swarm","waterfall"].includes(k),qn=t.useMemo(()=>{var e,t,n;return{chartType:k,runtimeMode:Xn?"streaming":"bounded",windowSize:D,windowMode:W,arrowOfTime:Xn?z:"right",extentPadding:G,scalePadding:X,xAccessor:S,yAccessor:C,timeAccessor:Xn?$:void 0,valueAccessor:N,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(B?"_lineGroup":void 0),categoryAccessor:st,lineDataAccessor:B,xScaleType:kt,yScaleType:wt,xExtent:E,yExtent:Y,sizeRange:q,binSize:I,normalize:R,baseline:F,stackOrder:H,boundsAccessor:ae,boundsStyle:ce,y0Accessor:ue,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:de,openAccessor:ge,highAccessor:pe,lowAccessor:ye,closeAccessor:me,candlestickStyle:ve,lineStyle:ee,pointStyle:te,areaStyle:ne,swarmStyle:re,waterfallStyle:ie,colorScheme:le,barColors:se,barStyle:oe,annotations:Ne,decay:ct,pulse:ut,transition:Qt,introAnimation:Zt,staleness:ft,heatmapAggregation:gt,heatmapXBins:pt,heatmapYBins:yt,showValues:mt,heatmapValueFormat:vt,pointIdAccessor:xt,curve:T,themeCategorical:null===(e=null==Kt?void 0:Kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:w(Kt),themeSequential:null===(t=null==Kt?void 0:Kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Kt?void 0:Kt.colors)||void 0===n?void 0:n.diverging,customLayout:Ct,layoutConfig:_t,layoutMargin:on}},[k,D,W,z,G,X,S,C,$,N,kt,wt,_,P,L,st,B,E,Y,q,I,R,F,H,ae,ce,ue,he,de,fe,ge,pe,ye,me,ve,ee,te,ne,re,ie,oe,le,se,Ne,ct,ut,null==Qt?void 0:Qt.duration,null==Qt?void 0:Qt.easing,Zt,ft,gt,pt,yt,mt,vt,Xn,xt,T,Kt,Ct,_t,on]),Vn=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Gt(e,t);if(!Xt(e)||!Xt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Gt(n,i))return!1}else{if(!Xt(n)||!Xt(i))return!1;if(!Yt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(qn),Un=t.useRef(null);Un.current||(Un.current=new ke(Vn));const Kn=t.useCallback(()=>{var e,t;const n=Bn.current,o=Tn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Un.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,Ln.current)||(Ln.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Un.current)||void 0===e||e.updateConfig(Vn),Lt.current=!0,nn()},[Vn,nn]);const Qn=t.useRef(null);Qn.current||(Qn.current=new b(e=>{const t=Un.current;t&&t.ingest(e)&&(Lt.current=!0,nn())},{chunkThreshold:O,chunkSize:M})),t.useEffect(()=>{var e;null===(e=Qn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:O,chunkSize:M})},[O,M]);const Zn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.push(e)},[]),Jn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.pushMany(e)},[]),eo=t.useCallback(()=>{var e,t;null===(e=Qn.current)||void 0===e||e.clear(),null===(t=Un.current)||void 0===t||t.clear(),Lt.current=!0,nn()},[nn]);t.useImperativeHandle(o,()=>({push:Zn,pushMany:Jn,remove:e=>{var t,n,o;null===(t=Qn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Un.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(On.current&&i.some(e=>{var t;return e===(null===(t=On.current)||void 0===t?void 0:t.data)})&&(On.current=null,Cn(null)),Lt.current=!0,nn()),i},update:(e,t)=>{var n,o,i;null===(n=Qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Un.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Lt.current=!0,nn()),r},clear:eo,getData:()=>{var e,t,n;return null===(e=Qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Un.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Un.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Zn,Jn,eo,nn]),t.useEffect(()=>{var e,t;if(A){if(B&&mn.length>0&&"object"==typeof mn[0]&&null!==mn[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(mn[0][t])){const n=[];for(const e of mn){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Qn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Qn.current)||void 0===t||t.setBoundedData(mn)}},[A,mn,B]);const{hoverHandlerRef:to,hoverLeaveRef:no,onPointerMove:oo,onPointerLeave:io}=Bt;to.current=e=>{var t,n,o;if(!vn)return;const i=bn.current;if(!i)return;const r=i.getBoundingClientRect(),s=e.clientX-r.left-on.left,l=e.clientY-r.top-on.top;if(0>s||s>fn||0>l||l>gn)return void(On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn()));const a=Un.current;if(!a||0===a.scene.length)return;const c=De(a.scene,s,l,He,a.quadtree,a.maxPointRadius),u="multi"===Ie,h=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&Be(null),nn())};if(!c&&!u)return void h();const d=u||!c?s:c.x,f=u||!c?l:c.y;let g=Pn(null!==(t=null==c?void 0:c.datum)&&void 0!==t?t:{},d,f);if(u&&a.scene.length>0&&a.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=$e(We(e.path,e.curve),t,n);if(null===r)continue;const s=Ke(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=We(e.topPath,e.curve),s=We(e.bottomPath,e.curve),l=$e(r,t,n);if(null===l)continue;const a=$e(s,t,n),c=Ke(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:l,y0:null!=a?a:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(a.scene,d,Math.max(He,fn));if(e.length>0){const t=a.scales.y.invert,n=a.scales.x.invert,o=_n.current,i=n?n(d):d;if(c)g.xValue=i,g.xPx=d;else{const e={xValue:i};"string"==typeof S&&(e[S]=i),g=Pn(e,d,f,{xValue:i,xPx:d})}g.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===k&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:e.datum}})}}c||(null===(n=g.allSeries)||void 0===n?void 0:n.length)?(On.current=g,Mn.current=null!==(o=null==c?void 0:c.node)&&void 0!==o?o:null,Cn(g),Be&&(Be(g),Lt.current=!0),nn()):h()},no.current=()=>{On.current&&(On.current=null,Mn.current=null,Cn(null),Be&&(Be(null),Lt.current=!0),nn())};const ro=t.useRef(()=>{});ro.current=e=>{if(!Te)return;const t=bn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-on.left,i=e.clientY-n.top-on.top;if(0>o||o>fn||0>i||i>gn)return void Te(null);const r=Un.current;if(!r||0===r.scene.length)return void Te(null);const s=De(r.scene,o,i,He,r.quadtree,r.maxPointRadius);Te(s?Pn(s.datum||{},s.x,s.y):null)};const so=t.useCallback(e=>ro.current(e),[]),lo=t.useRef(-1),ao=t.useRef(null),co=t.useRef(null),uo=t.useCallback(e=>{const t=Un.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(co.current&&co.current.version===n)o=co.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),co.current={version:n,graph:o}}const i=lo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),lo.current=0;const t=o.flat[0];ao.current={shape:t.shape,w:t.w,h:t.h};const n=Ze(t);return On.current=n,Cn(n),Be&&Be(n),void nn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Qe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Qe(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return lo.current=-1,ao.current=null,On.current=null,Mn.current=null,Cn(null),Be&&Be(null),void nn();lo.current=s;const l=o.flat[s];ao.current={shape:l.shape,w:l.w,h:l.h};const a=Ze(l);On.current=a,Cn(a),Be&&Be(a),nn()},[Be,nn]),ho=t.useCallback(e=>{lo.current=-1,ao.current=null,oo(e)},[oo]);tn.current=()=>{var e,t;en.current=0;const n=bn.current,o=xn.current;if(!n||!o)return;const i=Un.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Ht.current?r+1e6:r),l=!Ht.current&&s,a=Lt.current||s;a&&!l&&(i.computeScene({width:fn,height:gn}),Kn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return zn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),l=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||l||n||r?{axisStroke:a||zn.axisStroke,tickText:s||zn.tickText,crosshair:s?Wn(s,"66"):zn.crosshair,hoverFill:c?Wn(c,"4D"):zn.hoverFill,hoverStroke:s?Wn(s,"99"):zn.hoverStroke,pointRing:c||zn.pointRing,primary:r||zn.primary}:zn}(n);_n.current=u.primary;const h=null!==(e=null==ft?void 0:ft.threshold)&&void 0!==e?e:5e3,d=ft&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(a){const e=yn(n,Vt,on,c);if(e){if(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),d&&(e.globalAlpha=null!==(t=null==ft?void 0:ft.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!tt){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=J||(t&&"transparent"!==t?t:null),i=o?Re(e,o):null;i&&(e.fillStyle=i,e.fillRect(-on.left,-on.top,Vt[0],Vt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,fn,gn),e.clip()),ot&&i.scales)for(const t of ot)e.save(),t(e,i.scene,i.scales,{width:fn,height:gn}),e.restore();const o=Ct?In.custom:In[k];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:fn,height:gn});e.restore(),d&&(e.globalAlpha=1)}}{const e=yn(o,Vt,on,c);if(e&&(e.clearRect(-on.left,-on.top,Vt[0],Vt[1]),vn&&On.current&&i.scales&&function(e,t,n,o,i,r,s){var l;if(!1===i.crosshair)return;const a=t.allSeries,c=a&&a.length>0,u=null!==(l=t.xPx)&&void 0!==l?l:t.x;e.save();const h="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=h.stroke||s.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,On.current,fn,gn,"object"==typeof vn?vn:{},Mn.current,u),Mn.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s=n.group;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,Mn.current,t,u)}}a&&n&&n.setAttribute("aria-label",Ut(i.scene,k+" chart"));const f=Lt.current;if(Lt.current=!1,f&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!jn||e(jn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(jn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(jn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(jn.y.domain()[1])!==e(i.scales.y.domain()[1])||jn.x.range()[0]!==i.scales.x.range()[0]||jn.x.range()[1]!==i.scales.x.range()[1]||jn.y.range()[0]!==i.scales.y.range()[0]||jn.y.range()[1]!==i.scales.y.range()[1])&&An(i.scales),bt){const e=i.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof C?C:e=>e[C||"y"];En(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Gn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}f&&Ne&&Ne.length>0&&wn(e=>e+1),(null==ft?void 0:ft.showBadge)&&Fn(!!d),(l||null!=i.activeTransition||i.hasActivePulses)&&(en.current=requestAnimationFrame(()=>tn.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;Wt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Tt,wasHydratingFromSSR:Ft,storeRef:Un,dirtyRef:Lt,renderFnRef:tn,cleanup:()=>{var e;return null===(e=Qn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Lt.current=!0,nn()},[k,fn,gn,be,J,ee,ot,nn]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(ft,Un,Lt,nn,Rn,Fn);const fo=t.useMemo(()=>{if(Me||Ce)return;const e=Un.current;return(null==e?void 0:e.xIsDate)&&jn?Hn(jn.x.domain()):void 0},[Me,Ce,jn]),go=Me||Ce||fo,po=vn&&Sn?Le?Le(Sn):e.jsx($n,{hover:Sn}):null,yo=po?e.jsx(hn,{x:Sn.x,y:Sn.y,containerWidth:fn,containerHeight:gn,margin:on,className:"stream-frame-tooltip",children:po}):null,mo=ao.current,vo=e.jsx(un,{active:lo.current>=0,hoverPoint:Sn,margin:on,size:Vt,shape:null==mo?void 0:mo.shape,width:null==mo?void 0:mo.w,height:null==mo?void 0:mo.h}),bo=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},xo=bo(S,$,"__semiotic_resolvedX","__semiotic_resolvedTime"),ko=bo(C,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),wo=xo.key,jo=ko.key,Ao=Ne&&Ne.length>0,Oo=e=>{if(!e||!Ao||!xo.fn&&!ko.fn)return e;let t=!1;const n=e.map(e=>{const n=xo.fn&&xo.key&&!(xo.key in e),o=ko.fn&&ko.key&&!(ko.key in e);if(!n&&!o)return e;t=!0;const i=Object.assign({},e);return n&&(i[xo.key]=xo.fn(e)),o&&(i[ko.key]=ko.fn(e)),i});return t?n:e};if(zt||!Tt&&Ft){const t=Un.current;t&&A&&(t.ingest({inserts:mn,bounded:!0}),t.computeScene({width:fn,height:gn}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l=go||(()=>{if((null==t?void 0:t.xIsDate)&&o)return Hn(o.x.domain())})();return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":At||("string"==typeof rt?rt:"XY chart"),style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1]},children:[e.jsx(sn,{summary:Ot}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn}),e.jsxs("g",{transform:`translate(${on.left},${on.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:fn,height:gn,fill:J}),it&&o&&it.map((t,i)=>e.jsx(d.Fragment,{children:t(n,o,{width:fn,height:gn})},"svgpre-"+i)),n.map((t,n)=>function(t,n,o){var i,r,s,l,a;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const a=t;if(0===a.topPath.length)return null;const c=`M${a.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...a.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(a.clipRect){const t=`${o?o+"-":""}area-clip-${n}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:a.clipRect.x,y:a.clipRect.y,width:a.clipRect.width,height:a.clipRect.height})})}),e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(r=null!==(i=a.style.fillOpacity)&&void 0!==i?i:a.style.opacity)&&void 0!==r?r:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+n)}return e.jsx("path",{d:c,fill:Nt(a.style.fill),fillOpacity:null!==(l=null!==(s=a.style.fillOpacity)&&void 0!==s?s:a.style.opacity)&&void 0!==l?l:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Nt(o.style.fill),opacity:null!==(a=o.style.opacity)&&void 0!==a?a:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Nt(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[i,r,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),l=.299*i+.587*r+.114*s>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:a+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n,Pt)).filter(Boolean)]})]}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:o,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:l,yFormat:Se||_e,showGrid:Ee,title:rt,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(s=Un.current)||void 0===s?void 0:s.customLayoutOverlays),marginalGraphics:bt,xValues:[],yValues:[],annotations:Ne,svgAnnotationRules:ze,annotationFrame:0,xAccessor:wo,yAccessor:jo,annotationData:Oo(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:St})]})}return e.jsxs("div",{ref:qt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":At||("string"==typeof rt?rt:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Vt[0],height:K?"100%":Vt[1],overflow:"visible"},onKeyDown:uo,children:[jt&&e.jsx(ln,{tableId:Jt}),jt&&e.jsx(rn,{scene:null!==(a=null===(l=Un.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:k+" chart",tableId:Jt,chartTitle:"string"==typeof rt?rt:void 0}),e.jsx(sn,{summary:Ot}),e.jsxs("div",{role:"img","aria-label":At||("string"==typeof rt?rt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:vn?ho:void 0,onMouseLeave:vn?io:void 0,onClick:Te?so:void 0,children:[dn&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Vt[0],height:Vt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${on.left},${on.top})`,children:dn})}),e.jsx(Rt,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,showGrid:Ee,xFormat:go,yFormat:Se||_e}),e.jsx("canvas",{ref:bn,"aria-label":Ut(null!==(u=null===(c=Un.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],k+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:xn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(an,{hoverPoint:Sn}),e.jsx(It,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,scales:jn,showAxes:be,axes:xe,xLabel:je,yLabel:Ae,yLabelRight:Oe,xFormat:go,yFormat:Se||_e,showGrid:Ee,title:rt,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:Xe,legendHighlightedCategory:qe,legendIsolatedCategories:Ve,legendPosition:Ue,foregroundGraphics:we(cn,null===(h=Un.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:bt,xValues:Dn,yValues:Yn,annotations:Ne,svgAnnotationRules:ze,annotationFrame:kn,xAccessor:wo,yAccessor:jo,annotationData:Oo(null===(f=Un.current)||void 0===f?void 0:f.getData()),pointNodes:null===(g=Un.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof T?T:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!tt,linkedCrosshairName:Mt,linkedCrosshairSourceId:St}),(lt||at)&&e.jsx(y,{width:fn,height:gn,totalWidth:Vt[0],totalHeight:Vt[1],margin:on,dimension:null!==(p=null==lt?void 0:lt.dimension)&&void 0!==p?p:"xy",scales:jn,onBrush:null!=at?at:()=>{},binSize:I,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(m=null==lt?void 0:lt.binBoundaries)&&void 0!==m?m:"bar"===k?null===(x=Un.current)||void 0===x?void 0:x.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===j}),(null==ft?void 0:ft.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ft.badgePosition?{top:4,left:4}:"bottom-left"===ft.badgePosition?{bottom:4,left:4}:"bottom-right"===ft.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Rn?"#dc3545":"#28a745",color:"white"}),children:Rn?"STALE":"LIVE"}),vo,yo]})]})});En.displayName="StreamXYFrame";const Yn=t.createContext(null);function Gn({colors:n,categories:o,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(n)return n;if(o){const e=Array.isArray(i)?i:se[i]||le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[n,o,i]);return e.jsx(Yn.Provider,{value:s,children:r})}function Xn(){return t.useContext(Yn)}function qn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Vn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}Gn.displayName="CategoryColorProvider";const[Un,Kn]=x(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Vn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Vn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qn,Zn]=x(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Jn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Kn(e=>e.selections.get(i)),s=Kn(e=>e.setClause),l=Kn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(qn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function eo(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=Jn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}function to(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function no(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:l,clear:a}=Jn({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void a();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&to(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&to(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[c,o,i,l,a]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:a}}const oo=t.createContext(!1),io=t.createContext(null),ro="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function so(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function lo(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function ao({selections:e}){const n=Kn(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function co({categoryColors:n,interaction:o,selectionName:i,field:r}){const s=Object.entries(n),l=s.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=eo({name:i,fields:[r]}),u=Jn({name:i,clientId:"__linked-legend-isolate__"}),[h,d]=t.useState(new Set),[f,g]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(h.size>0?p.current({[r]:Array.from(h)}):y.current())},[o,h,r]);const m=t.useCallback(e=>{"highlight"===o&&(e?(g(e.label),c.onHover({[r]:e.label})):(g(null),c.onHover(null)))},[o,r,c]),v=t.useCallback(e=>{"isolate"===o&&d(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===l.length?new Set:n})},[o,l.length]),[b,[x]]=dn([0,0],!0,!1),k=t.useMemo(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(rt,{legendGroups:a,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:f,isolatedCategories:h})})})}function uo({children:n,selections:o,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:l="legend",legendField:a="category"}){const c=Xn(),[u,h]=t.useState({}),d=t.useRef({}),f=t.useMemo(()=>({registerCategories:(e,t)=>{const n=so(t);h(t=>{var o;return lo(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{h(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),g=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const n of t)e.push(n);return so(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},n=d.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of g)t[e]||n[e]||(n[e]=le[o%le.length],o++);const i=Object.assign({},t);for(const o of g)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[c,g]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(Un,{children:e.jsxs(Qn,{children:[o&&e.jsx(ao,{selections:o}),e.jsx(io.Provider,{value:f,children:e.jsx(Gn,{colors:p,children:e.jsxs(oo.Provider,{value:m,children:[y&&"top"===r&&e.jsx(co,{categoryColors:p,interaction:s,selectionName:l,field:a}),n,y&&"bottom"===r&&e.jsx(co,{categoryColors:p,interaction:s,selectionName:l,field:a})]})})})]})})}function ho(e){return e?"string"==typeof e?{name:e}:e:null}function fo(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function go(){return P(e=>e.theme)}d.createContext(void 0);const po="#007bff";function yo(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function mo(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function vo(){var e;const t=go(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function bo(e,n,o){const i=Xn(),r=vo();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=he(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return he(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=he(e,n,s);return e=>i[e]||t(e)}return he(e,n,s)}if(i&&Object.keys(i).length>0){const e=he([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}function xo({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const h=t.useId(),d=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),f=Jn({name:(null==e?void 0:e.name)||"__unused__"}),g=eo({name:(null==d?void 0:d.name)||"hover",fields:(null==d?void 0:d.fields)||o||[]}),p=Zn(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==d?void 0:d.mode)&&d.xField){const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n})},At())}(d.name||"hover",n,h)}"x-position"!==(null==d?void 0:d.mode)&&g.onHover(t)}else"x-position"===(null==d?void 0:d.mode)&&Ot(d.name||"hover",h),"x-position"!==(null==d?void 0:d.mode)&&g.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||p){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=mo(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),p&&p(e)}}},[n,g,d,h,r,s,l,p,c,b]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==d?void 0:d.mode)&&d.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=yo(e,t,d.xField);null!=n&&function(e,t,n){const o=wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(wt.positions);return t.delete(e),wt={positions:t},At(),!1}wt={positions:new Map(wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},At()}(d.name||"hover",n,h)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=mo(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[a,r,p,s,l,d,h]);return t.useEffect(()=>{if("x-position"!==(null==d?void 0:d.mode))return;const e=d.name||"hover";return()=>{Mt(e,h),Ot(e,h)}},[null==d?void 0:d.mode,null==d?void 0:d.name,h]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:h}}function ko(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function wo({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(oo),u=null!==t.useContext(io),h=void 0!==i?i:!c&&!!n,d=!!n&&(h||u),f=t.useMemo(()=>{if(!d)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,d]);!function(e){const n=t.useContext(io),o=t.useId(),i=so(e),r=t.useRef([]);lo(r.current,i)||(r.current=i);const s=r.current;ro(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),ro(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const g=t.useMemo(()=>{if(!h||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):ae[r%ae.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:ue,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[h,n,e,o,f]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},l),e);return g&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[l,s,g,r]);return{legend:g,margin:p,legendPosition:r}}function jo(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}const Ao={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 Oo(e,t,n){var o,i,r,s,l,a,c;const u=Ao[e||"primary"],h="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:h?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:h?void 0:t.xLabel,yLabel:h?void 0:t.yLabel,categoryLabel:h?void 0:t.categoryLabel,valueLabel:h?void 0:t.valueLabel,marginDefaults:Mo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:h}}function Mo(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function So(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Co={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function _o(e,t){return"function"==typeof t?t(e):e[t]}function Po(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Lo(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=_o(t,o);l=Po(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=_o(t,o);a.push({label:n,value:Po(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Po(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Po(t[e[0]],i))}}const c=Object.assign(Object.assign({},Co),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Bo(){return t=>{var n,o,i,r,s,l,a;const c=t.allSeries;if(!c||0===c.length){const r=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:Co,children:e.jsx("div",{children:Po(r)})})}const u=null!==(l=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==l?l:null===(a=t.data)||void 0===a?void 0:a.x;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Po(u)}),c.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Po(t.value)})]},n))]})}}function To(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Co,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lo(t):Lo())}}function Ro(e){return"string"==typeof e?e:"value"}function Fo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ho(e,t){if(!t)return Fo(e);try{const n=t(e);return null==n?Fo(e):n}catch(t){return Fo(e)}}function Io(e,t){return"function"==typeof t?t(e):e[t]}function No(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=n?Ho(Io(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:Co,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((t,n)=>{const o=Ho(Io(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function zo({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,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"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class Wo extends d.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.jsx(zo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Do;const $o="undefined"!=typeof process&&"production"!==(null===(Do=process.env)||void 0===Do?void 0:Do.NODE_ENV);function Eo({componentName:t,width:n,height:o,children:i}){return e.jsx(Wo,{fallback:i=>e.jsx(zo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Yo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Go={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xo(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Yo),{width:n,height:o}),children:i||"No data available"}):null}function qo(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(r+s)-s))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Go),{position:"absolute",top:l+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Vo(e,t,n,o){if(!$o)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Uo(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Ko(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Uo(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Qo({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Ko(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Zo(e){const n=P(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Jo(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:d,chartType:f,chartId:g,showLegend:p,userMargin:y,marginDefaults:m,onClick:b,hoverHighlight:x,loading:k,emptyContent:w,width:j,height:A}=e,O=void 0===o,M=t.useMemo(()=>v(n),[n]),[S,C]=t.useState([]),_=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:B,customHoverBehavior:T,customClickBehavior:R,crosshairSourceId:F}=xo({selection:a,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:d,chartType:f,chartId:g,onClick:b,hoverHighlight:x,colorByField:P}),H=ko(c,F),I=bo(M,i,r),N=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[M,i]),z=t.useMemo(()=>O&&S.length>0?S:N,[O,S,N]),W=jo(s,i,z),D=t.useMemo(()=>B||(W.legendSelectionHook?W.legendSelectionHook:L),[B,W.legendSelectionHook,L]),$=Zo(a),E=vo(),Y=Xn(),G=t.useMemo(()=>{if(I)return I;if(!i||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:E&&E.length>0?E:ae,t="__streamCat",n=he(z.map(e=>({[t]:e})),t,e);return e=>(null==Y?void 0:Y[e])||n(e)||"#999"},[I,i,z,r,E,Y]),{legend:X,margin:q,legendPosition:V}=wo({data:M,colorBy:i,colorScale:G,showLegend:p,legendPosition:l,userMargin:y,defaults:m,categories:z}),U=t.useMemo(()=>{const e={};return X&&(e.legend=X,e.legendPosition=V),s&&"none"!==s&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=_),e},[X,V,s,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,O,i,_]),K=Array.isArray(o)?v(o):o,Q=qo(k,j,A),Z=Q?null:Xo(K,j,A,w);return{data:M,colorScale:I,allCategories:z,legendState:W,effectiveSelectionHook:D,activeSelectionHook:L,customHoverBehavior:T,customClickBehavior:R,legend:X,margin:q,legendPosition:V,earlyReturn:Q||Z||null,legendBehaviorProps:U,crosshairProps:H,resolvedSelection:$}}function ei(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function ti(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const ni="__forecastSegment";let oi=null;function ii(){return ti(this,void 0,void 0,function*(){return oi||(oi=yield Promise.resolve().then(function(){return Ni})),oi})}const ri=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",lineBy:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:b,curve:x="linear",showPoints:k=!1,pointRadius:w=3,fillArea:j=!1,areaOpacity:A=.3,lineWidth:O=2,lineGradient:M,tooltip:S,pointIdAccessor:C,annotations:_,directLabel:P,gapStrategy:L="break",anomaly:B,forecast:T,frameProps:R={},selection:F,linkedHover:H,onObservation:I,onClick:N,hoverHighlight:z,hoverRadius:W,chartId:D,loading:$,emptyContent:E,legendInteraction:Y,legendPosition:G,xScaleType:X,yScaleType:q,color:V,stroke:U,strokeWidth:K,opacity:Q}=n,{width:Z,height:J,enableHover:ee,showGrid:te,showLegend:ne,title:oe,description:ie,summary:re,accessibleTable:se,xLabel:le,yLabel:ae}=l,ce=t.useMemo(()=>v(a),[a]);Vo("LineChart",ce,"xAccessor",f),Vo("LineChart",ce,"yAccessor",g);const he="string"==typeof f?f:"__semiotic_resolvedX",de="string"==typeof g?g:"__semiotic_resolvedY",[fe,ge]=t.useState(null),[pe,ye]=t.useState([]),me=t.useMemo(()=>{if(!T&&!B)return ce;const e="function"==typeof f,t="function"==typeof g;return e||t?ce.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=f(n)),t&&(o.__semiotic_resolvedY=g(n)),o}):ce},[ce,T,B,f,g]),ve=t.useRef(T),be=t.useRef(B);t.useEffect(()=>{if(!T&&!B)return void((ve.current||be.current)&&(ge(null),ye([]),ve.current=T,be.current=B));let e=!1;const t=T!==ve.current||B!==be.current;if(ve.current=T,be.current=B,t&&(ge(null),ye([])),T){const t=p&&"string"==typeof p&&"object"==typeof T?Object.assign(Object.assign({},T),{_groupBy:p}):T;(function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildForecast(...e)})})(me,he,de,t,B).then(t=>{e||(ge(t),ye(t.annotations))}).catch(()=>{e||(ge(null),ye([]))})}else B&&function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).buildAnomalyAnnotations(...e)})}(B).then(t=>{e||(ge(null),ye(t))}).catch(()=>{e||ye([])});return()=>{e=!0}},[me,T,B,he,de]);const xe=fe?fe.processedData:ce,ke="__compoundGroup",we=!(!T||!p),je=we?ke:T?ni:p,Ae=t.useMemo(()=>{if(!we)return xe;const e="function"==typeof p?p:e=>e[p];return xe.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[ni]||"observed"}`,n})},[xe,we,p]),Oe=we?Ae:xe,Me=t.useMemo(()=>{if(!T)return;const e=T.upperBounds,t=T.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=fe?fe.processedData:ce;for(const e of s){const t="function"==typeof g?g(e):+e[g];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[T,fe,ce,g]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],n="function"==typeof g?g(e):e[g];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[f,g]),Ce=void 0!==(null===(i=Oe[0])||void 0===i?void 0:i[y]),_e=t.useMemo(()=>{if(Ce)return Oe;if(je){const e=Oe.reduce((e,t)=>{const n="function"==typeof je?je(t):t[je];if(!e[n]){const o={[y]:[]};"string"==typeof je&&(o[je]=n),we&&(o[ni]=t[ni],"string"==typeof p&&(o[p]=t[p])),e[n]=o}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:Oe}]},[Oe,je,y,Ce]),{gapProcessedLineData:Pe,hasGaps:Le}=t.useMemo(()=>{if("interpolate"===L){let e=!1;const t=[];for(const n of _e){const o=(n[y]||[]).filter(t=>!Se(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===L){let e=!1;const t=[];for(const n of _e){const o=n[y]||[];let i=[],r=0;const s=je&&"string"==typeof je?n[je]:void 0;for(const l of o)if(Se(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[y]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[y]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===L){let e=!1;const t="string"==typeof g?g:"y",n=[];for(const o of _e){const i=o[y]||[],r=[];for(const n of i)Se(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[y]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:_e,hasGaps:!1}},[_e,L,y,Se,je,g]),Be="object"==typeof P?P:{},Te=Be.position||"end",Re=Be.fontSize||11,Fe=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof m?m:e=>e[m],n=new Set;for(const o of Pe){const i=o[y]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Te?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[P,m,Pe,y,Te]),He=t.useMemo(()=>{if(!P)return l.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Re)),0)+10,t="end"===Te?"right":"left";return Object.assign(Object.assign({},l.marginDefaults),{[t]:Math.max(l.marginDefaults[t]||0,e)})},[P,Fe,Re,Te,l.marginDefaults]),Ie=Jo({data:xe,rawData:a,colorBy:m,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:F,linkedHover:H,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:I,onClick:N,hoverHighlight:z,chartType:"LineChart",chartId:D,showLegend:(!P||void 0!==ne)&&ne,userMargin:c,marginDefaults:He,loading:$,emptyContent:E,width:Z,height:J}),Ne=Ie.colorScale,ze=Ie.effectiveSelectionHook,We=Ie.resolvedSelection,De=Ie.customHoverBehavior,$e=Ie.customClickBehavior,Ee=Ie.crosshairProps,Ye=t.useMemo(()=>(e,t)=>{const n={strokeWidth:O},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return m?Ne&&(n.stroke=ue(e,m,Ne),o&&(n.fill=n.stroke,n.fillOpacity=A)):(n.stroke=V||po,o&&(n.fill=V||po,n.fillOpacity=A)),n},[m,Ne,O,j,A,V]),[Ge,Xe]=t.useState(null);t.useEffect(()=>{if(!T)return void Xe(null);let e=!1;return function(...e){return ti(this,void 0,void 0,function*(){return(yield ii()).createSegmentLineStyle(...e)})}(Ye,T).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,T]);const qe=Ge||Ye,Ve=t.useMemo(()=>So(qe,{stroke:U,strokeWidth:K,opacity:Q}),[qe,U,K,Q]),Ue=t.useMemo(()=>fo(Ve,ze,We),[Ve,ze,We]),Ke=t.useMemo(()=>{if(k)return e=>{const t={r:w,fillOpacity:1};return m?Ne&&(t.fill=ue(e.parentLine||e,m,Ne)):t.fill=V||po,t}},[k,w,m,Ne,V]),Qe=Array.isArray(j)?"mixed":j?"area":"line",Ze=t.useMemo(()=>{var e;if(!P||!m)return[];const t="function"==typeof f?f:e=>e[f],n="function"==typeof g?g:e=>e[g],o="function"==typeof m?m:e=>e[m],i=new Map;for(const t of Pe){const n=t[y]||[];if(0===n.length)continue;const r="end"===Te?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const l=s+"";""===l||i.has(l)||i.set(l,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof f?f:"x"]:t(o),["string"==typeof g?g:"y"]:n(o),dx:"end"===Te?6:-6,dy:0,color:Ne?Ne(e):po,fontSize:Re}));r.sort((e,t)=>{const n="string"==typeof g?g:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof g?g:"y",n=r[e-1],o=r[e];Re+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Re+2)}return r},[P,m,Ne,Pe,y,f,g,Te,Re]),Je=Ie.margin,et=p||m,tt=t.useMemo(()=>No([{label:le||Ro(f),accessor:f,role:"x",format:h},{label:ae||Ro(g),accessor:g,role:"y",format:d},...et?[{label:Ro(et),accessor:et,role:"group"}]:[]]),[f,g,le,ae,et,h,d]),nt=Qo({componentName:"LineChart",data:Ce?(null===(r=xe[0])||void 0===r?void 0:r[y])||[]:a,accessors:{xAccessor:f,yAccessor:g}}),ot=t.useMemo(()=>Ce||je||Le?Pe.flatMap(e=>{const t=e[y]||[];return je&&"string"==typeof je?t.map(t=>Object.assign(Object.assign({},t),{[je]:e[je]})):t}):Oe,[Pe,y,Ce,je,Oe,Le]),it=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Qe},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=W&&{hoverRadius:W}),null!=a&&{data:ot}),{xAccessor:f,yAccessor:g,xScaleType:X,yScaleType:q}),Me&&{yExtent:Me}),{groupAccessor:"break"===L&&Le?"_gapSegment":je||void 0,curve:x,lineStyle:Ue}),k&&{pointStyle:Ke}),{size:[Z,J],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Je,showAxes:l.showAxes,xLabel:le,yLabel:ae,xFormat:h,yFormat:d,enableHover:ee,showGrid:te}),Ie.legendBehaviorProps),oe&&{title:oe}),ie&&{description:ie}),re&&{summary:re}),void 0!==se&&{accessibleTable:se}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===S?()=>null:"multi"===S?Bo():To(S)||tt}),"multi"===S&&{tooltipMode:"multi"}),(H||I||N||z)&&{customHoverBehavior:De}),(I||N||H)&&{customClickBehavior:$e}),C&&{pointIdAccessor:C}),((null==_?void 0:_.length)||pe.length||Ze.length)&&{annotations:[..._||[],...pe,...Ze]}),Ee),R);return Ie.earlyReturn?Ie.earlyReturn:nt?e.jsx(zo,{componentName:"LineChart",message:nt,width:Z,height:J}):e.jsx(Eo,{componentName:"LineChart",width:Z,height:J,children:e.jsx(En,Object.assign({ref:s},it))})});function si(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),l}function li(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=r),(l?n||o||t:n||o)&&(a.customClickBehavior=s),a}function ai(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:To(t)||n}}ri.displayName="LineChart";const ci=t.forwardRef(function(n,o){var i;const r=t.useRef(null);ei(o,{variant:"xy",frameRef:r});const s=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,y0Accessor:p,gradientFill:y=!1,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:O=2,showPoints:M=!1,pointRadius:S=3,tooltip:C,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,chartId:H,loading:I,emptyContent:N,legendInteraction:z,legendPosition:W,color:D,stroke:$,strokeWidth:E,opacity:Y}=n,{width:G,height:X,enableHover:q,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>v(l),[l]);Vo("AreaChart",ne,"xAccessor",d),Vo("AreaChart",ne,"yAccessor",f);const oe=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[m]),ie=t.useMemo(()=>{if(oe)return ne;if(g){const e=ne.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[m]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:ne}]},[ne,g,m,oe]),re=Jo({data:ne,rawData:l,colorBy:b,colorScheme:x,legendInteraction:z,legendPosition:W,selection:L,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:F,chartType:"AreaChart",chartId:H,showLegend:U,userMargin:a,marginDefaults:s.marginDefaults,loading:I,emptyContent:N,width:G,height:X}),se=t.useMemo(()=>e=>{const t={};if(b){if(re.colorScale){const n=ue(e,b,re.colorScale);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}}else{const e=D||po;t.fill=e,A?(t.stroke=e,t.strokeWidth=O):t.stroke="none"}return t.fillOpacity=w,t},[b,re.colorScale,D,w,A,O]),le=t.useMemo(()=>So(se,{stroke:$,strokeWidth:E,opacity:Y}),[se,$,E,Y]),ae=t.useMemo(()=>fo(le,re.effectiveSelectionHook,re.resolvedSelection),[le,re.effectiveSelectionHook,re.resolvedSelection]),ce=t.useMemo(()=>{if(M)return e=>{const t={r:S,fillOpacity:1};return b?re.colorScale&&(t.fill=ue(e.parentLine||e,b,re.colorScale)):t.fill=po,t}},[M,S,b,re.colorScale]),he=g||b,de=t.useMemo(()=>No([{label:ee||Ro(d),accessor:d,role:"x",format:u},{label:te||Ro(f),accessor:f,role:"y",format:h},...he?[{label:Ro(he),accessor:he,role:"group"}]:[]]),[d,f,ee,te,he,u,h]),fe=Qo({componentName:"AreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),ge=t.useMemo(()=>oe||g?ie.flatMap(e=>{const t=e[m]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ne,[ie,m,oe,g,ne]),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ge}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0}),p&&{y0Accessor:p}),y&&{gradientFill:y}),j&&{lineGradient:j}),{curve:k,lineStyle:ae}),M&&ce&&{pointStyle:ce}),{size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:h,enableHover:q}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:V}),re.legendBehaviorProps),si({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:de})),li({linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),_&&_.length>0&&{annotations:_}),re.crosshairProps),P);return re.earlyReturn?re.earlyReturn:fe?e.jsx(zo,{componentName:"AreaChart",message:fe,width:G,height:X}):e.jsx(Eo,{componentName:"AreaChart",width:G,height:X,children:e.jsx(En,Object.assign({ref:r},pe))})});ci.displayName="AreaChart";const ui=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=Oo(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:l,margin:a,className:c,xFormat:u,yFormat:h,xAccessor:d="x",yAccessor:f="y",areaBy:g,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:b="monotoneX",areaOpacity:x=.7,showLine:k=!0,lineWidth:w=2,showPoints:j=!1,pointRadius:A=3,normalize:O=!1,baseline:M="zero",stackOrder:S,tooltip:C,annotations:_,frameProps:P={},selection:L,linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,chartId:H,loading:I,emptyContent:N,legendInteraction:z,legendPosition:W,color:D,stroke:$,strokeWidth:E,opacity:Y}=n,{width:G,height:X,enableHover:q,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>v(l),[l]),oe=y||g;ei(o,{variant:"xy",frameRef:r});const ie=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[p]),re=t.useMemo(()=>{if(ie)return ne;if(g){const e=ne.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[p]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][p].push(t),e},{});return Object.values(e)}return[{[p]:ne}]},[ne,g,p,ie]),se=Jo({data:ne,rawData:l,colorBy:oe,colorScheme:m,legendInteraction:z,legendPosition:W,selection:L,linkedHover:B,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:F,chartType:"StackedAreaChart",chartId:H,showLegend:U,userMargin:a,marginDefaults:s.marginDefaults,loading:I,emptyContent:N,width:G,height:X}),le=t.useMemo(()=>e=>{const t={};if(oe&&se.colorScale){const n=ue(e,oe,se.colorScale);t.fill=n,k?(t.stroke=n,t.strokeWidth=w):t.stroke="none"}else if(!oe){const e=D||po;t.fill=e,t.stroke=k?e:"none",k&&(t.strokeWidth=w)}return t.fillOpacity=x,t},[oe,se.colorScale,x,k,w,D]),ae=t.useMemo(()=>So(le,{stroke:$,strokeWidth:E,opacity:Y}),[le,$,E,Y]),ce=t.useMemo(()=>fo(ae,se.effectiveSelectionHook,se.resolvedSelection),[ae,se.effectiveSelectionHook,se.resolvedSelection]),he=t.useMemo(()=>{if(j)return e=>{const t={r:A,fillOpacity:1};return oe?se.colorScale&&(t.fill=ue(e.parentLine||e,oe,se.colorScale)):t.fill=D||po,t}},[j,A,oe,se.colorScale,D]),de=g||y,fe=t.useMemo(()=>No([{label:ee||Ro(d),accessor:d,role:"x",format:u},{label:te||Ro(f),accessor:f,role:"y",format:h},...de?[{label:Ro(de),accessor:de,role:"group"}]:[]]),[d,f,ee,te,de,u,h]),ge=Qo({componentName:"StackedAreaChart",data:l,accessors:{xAccessor:d,yAccessor:f}}),pe=t.useMemo(()=>ie||g?re.flatMap(e=>{const t=e[p]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):ne,[re,p,ie,g,ne]),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=l&&{data:pe}),{xAccessor:d,yAccessor:f,groupAccessor:g||void 0,curve:b,normalize:O,baseline:O?"zero":M,stackOrder:S,lineStyle:ce}),j&&he&&{pointStyle:he}),{size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:u,yFormat:h,enableHover:q}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:V}),se.legendBehaviorProps),si({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:n.animate})),"multi"===C?{tooltipContent:Bo(),tooltipMode:"multi"}:ai({tooltip:C,defaultTooltipContent:fe})),li({linkedHover:B,onObservation:T,onClick:R,hoverHighlight:F,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),_&&_.length>0&&{annotations:_}),se.crosshairProps),P);return se.earlyReturn?se.earlyReturn:ge?e.jsx(zo,{componentName:"StackedAreaChart",message:ge,width:G,height:X}):e.jsx(Eo,{componentName:"StackedAreaChart",width:G,height:X,children:e.jsx(En,Object.assign({ref:r},ye))})});ui.displayName="StackedAreaChart";const hi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:f="y",colorBy:g,colorScheme:p,sizeBy:y,sizeRange:m=[3,15],pointRadius:b=5,pointOpacity:x=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,frameProps:O={},selection:M,linkedHover:S,linkedBrush:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:F,legendPosition:H,color:I,stroke:N,strokeWidth:z,opacity:W}=n,{width:D,height:$,enableHover:E,showGrid:Y,showLegend:G,title:X,description:q,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=r,Z=t.useMemo(()=>v(s),[s]),J=Jo({data:Z,rawData:s,colorBy:g,colorScheme:p,legendInteraction:F,legendPosition:H,selection:M,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"Scatterplot",chartId:B,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:D,height:$}),ee=ho(C),te=no({name:(null==ee?void 0:ee.name)||"__unused_brush__",xField:(null==ee?void 0:ee.xField)||("string"==typeof h?h:void 0),yField:(null==ee?void 0:ee.yField)||("string"==typeof f?f:void 0)}),ne=ee?"xyBrush"===te.brushInteraction.brush?"xy":"xBrush"===te.brushInteraction.brush?"x":"y":void 0,oe=d.useRef(te.brushInteraction);oe.current=te.brushInteraction;const ie=t.useCallback(e=>{const t=oe.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(J.earlyReturn)return J.earlyReturn;Vo("Scatterplot",Z,"xAccessor",h),Vo("Scatterplot",Z,"yAccessor",f);const re=t.useMemo(()=>{if(!y||0===Z.length)return;const e=Z.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[Z,y]),se=t.useMemo(()=>e=>{const t={fillOpacity:x};return g?J.colorScale&&(t.fill=ue(e,g,J.colorScale)):t.fill=I||po,t.r=y?de(e,y,m,re):b,t},[g,J.colorScale,y,m,re,b,x,I]),le=t.useMemo(()=>So(se,{stroke:N,strokeWidth:z,opacity:W}),[se,N,z,W]),ae=t.useMemo(()=>fo(le,J.effectiveSelectionHook,J.resolvedSelection),[le,J.effectiveSelectionHook,J.resolvedSelection]),ce=t.useMemo(()=>No([{label:K||Ro(h),accessor:h,role:"x",format:c},{label:Q||Ro(f),accessor:f,role:"y",format:u},...g?[{label:Ro(g),accessor:g,role:"color"}]:[],...y?[{label:Ro(y),accessor:y,role:"size"}]:[]]),[h,f,K,Q,g,y,c,u]),he=Qo({componentName:"Scatterplot",data:s,accessors:{xAccessor:h,yAccessor:f}});if(he)return e.jsx(zo,{componentName:"Scatterplot",message:he,width:D,height:$});const fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:Z}),{xAccessor:h,yAccessor:f,colorAccessor:g||void 0,sizeAccessor:y||void 0,sizeRange:m,pointStyle:ae,colorScheme:p,size:[D,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,showAxes:r.showAxes,xLabel:K,yLabel:Q,xFormat:c,yFormat:u,enableHover:E,showGrid:Y}),J.legendBehaviorProps),si({title:X,description:q,summary:V,accessibleTable:U,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:ce})),li({linkedHover:S,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),ee&&{brush:{dimension:ne},onBrush:ie}),J.crosshairProps),O);return e.jsx(Eo,{componentName:"Scatterplot",width:D,height:$,children:e.jsx(En,Object.assign({ref:i},fe))})});function di(e,t){return ee(1===t?.5:e/(t-1))}hi.displayName="Scatterplot";const fi=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,frameProps:k={},selection:w,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:M,chartId:S,loading:C,emptyContent:_,legendInteraction:P,stroke:L,strokeWidth:B,opacity:T}=n,{width:R,height:F,enableHover:H,showGrid:I,title:N,description:z,summary:W,accessibleTable:D,xLabel:$,yLabel:E}=l,Y=a||[],{safeData:G,orderMap:X}=t.useMemo(()=>{const e="function"==typeof f?f:e=>e[f],t="function"==typeof g?g:e=>e[g];let n=Y;if(p&&Y.length>0){const e="function"==typeof p?p:e=>e[p];n=[...Y].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const s of n){const n=e(s),l=t(s);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Y,p,f,g]);Vo("ConnectedScatterplot",G,"xAccessor",f),Vo("ConnectedScatterplot",G,"yAccessor",g);const q=Jo({data:G,rawData:a,colorBy:void 0,colorScheme:void 0,legendInteraction:P,selection:w,linkedHover:j,fallbackFields:[],unwrapData:!1,onObservation:A,onClick:O,hoverHighlight:M,chartType:"ConnectedScatterplot",chartId:S,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:C,emptyContent:_,width:R,height:F}),V=null!==(r=null===(i=q.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,U=t.useMemo(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const l=null===(n=q.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=q.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=s[t],o=s[t+1],h=di(t,u),d=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(r=o.datum)&&void 0!==r?r:o),f=l?d?1:V:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=h,e.lineWidth=m,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[m,q.effectiveSelectionHook,V]),K=t.useMemo(()=>[U],[U]),Q=t.useMemo(()=>(t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const l=s.length,a=100>l,c=[];for(let t=0;l-1>t;t++){const n=s[t],o=s[t+1],u=di(t,l),h="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,d="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,f=Math.min(h,d);a&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:f},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),Z=t.useMemo(()=>[Q],[Q]),J=t.useMemo(()=>e=>{var t,n;const o=X.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?di(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,X]),ee=t.useMemo(()=>So(J,{stroke:L,strokeWidth:B,opacity:T}),[J,L,B,T]),te=t.useMemo(()=>fo(ee,q.effectiveSelectionHook,q.resolvedSelection),[ee,q.effectiveSelectionHook,q.resolvedSelection]),ne=y||("string"==typeof p?p:"Order"),oe=t.useMemo(()=>No([{label:$||Ro(f),accessor:f,role:"x",format:h},{label:E||Ro(g),accessor:g,role:"y",format:d},...p?[{label:ne,accessor:p,role:"group"}]:[]]),[f,g,$,E,p,ne,h,d]),ie=Qo({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:f,yAccessor:g}}),re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:G}),{xAccessor:f,yAccessor:g,pointStyle:te,size:[R,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:q.margin,showAxes:l.showAxes,xLabel:$,yLabel:E,xFormat:h,yFormat:d,enableHover:H,showGrid:I}),si({title:N,description:z,summary:W,accessibleTable:D,className:u,animate:n.animate})),ai({tooltip:v,defaultTooltipContent:oe})),li({linkedHover:j,onObservation:A,onClick:O,hoverHighlight:M,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:K,svgPreRenderers:Z}),x&&x.length>0&&{annotations:x}),q.crosshairProps),k);return q.earlyReturn?q.earlyReturn:ie?e.jsx(zo,{componentName:"ConnectedScatterplot",message:ie,width:R,height:F}):e.jsx(Eo,{componentName:"ConnectedScatterplot",width:R,height:F,children:e.jsx(En,Object.assign({ref:s},re))})});fi.displayName="ConnectedScatterplot";const gi=t.forwardRef(function(n,o){const i=t.useRef(null),r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",sizeBy:f,sizeRange:g=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:b=1,bubbleStrokeColor:x="white",tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,frameProps:O={},selection:M,linkedHover:S,linkedBrush:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:B,loading:T,emptyContent:R,legendInteraction:F,legendPosition:H,color:I,stroke:N,strokeWidth:z,opacity:W}=n,{width:D,height:$,enableHover:E,showGrid:Y,showLegend:G,title:X,description:q,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=r,Z=t.useMemo(()=>v(s),[s]),J=void 0===s,ee=Jo({data:Z,rawData:s,colorBy:p,colorScheme:y,legendInteraction:F,legendPosition:H,selection:M,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"BubbleChart",chartId:B,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:T,emptyContent:R,width:D,height:$}),te=t.useRef(null),[ne,oe]=t.useState(0),ie=t.useCallback(e=>{if(!J)return;let t=!1;for(const n of e){const e="function"==typeof f?f(n):n[f];null!=e&&isFinite(e)&&(te.current?(te.current[0]>e&&(te.current[0]=e,t=!0),e>te.current[1]&&(te.current[1]=e,t=!0)):(te.current=[e,e],t=!0))}t&&oe(e=>e+1)},[J,f]),re=t.useCallback(e=>{var t;ie([e]),null===(t=i.current)||void 0===t||t.push(e)},[ie]),se=t.useCallback(e=>{var t;ie(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[ie]);ei(o,{variant:"xy",frameRef:i,overrides:{push:re,pushMany:se,clear:()=>{var e;te.current=null,oe(e=>e+1),null===(e=i.current)||void 0===e||e.clear()}},deps:[re,se]});const le=ho(C);no({name:(null==le?void 0:le.name)||"__unused_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof h?h:void 0),yField:(null==le?void 0:le.yField)||("string"==typeof d?d:void 0)});const ae=t.useMemo(()=>{if(J)return te.current||[0,1];const e=Z.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[Z,f,J,ne]),ce=t.useMemo(()=>e=>{const t={fillOpacity:m,strokeWidth:b,stroke:x};return p?ee.colorScale&&(t.fill=ue(e,p,ee.colorScale)):t.fill=I||po,t.r=de(e,f,g,ae),t},[p,ee.colorScale,f,g,ae,m,b,x,I]),he=t.useMemo(()=>So(ce,{stroke:N,strokeWidth:z,opacity:W}),[ce,N,z,W]),fe=t.useMemo(()=>fo(he,ee.effectiveSelectionHook,ee.resolvedSelection),[he,ee.effectiveSelectionHook,ee.resolvedSelection]),ge=t.useMemo(()=>No([{label:K||Ro(h),accessor:h,role:"x",format:c},{label:Q||Ro(d),accessor:d,role:"y",format:u},{label:Ro(f),accessor:f,role:"size"},...p?[{label:Ro(p),accessor:p,role:"color"}]:[]]),[h,d,K,Q,f,p,c,u]),pe=Qo({componentName:"BubbleChart",data:s,accessors:{xAccessor:h,yAccessor:d},requiredProps:{sizeBy:f}});if(pe)return e.jsx(zo,{componentName:"BubbleChart",message:pe,width:D,height:$});const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:Z}),{xAccessor:h,yAccessor:d,colorAccessor:p||void 0,sizeAccessor:f,sizeRange:g,pointStyle:fe,colorScheme:y,size:[D,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,showAxes:r.showAxes,xLabel:K,yLabel:Q,xFormat:c,yFormat:u,enableHover:E,showGrid:Y}),ee.legendBehaviorProps),si({title:X,description:q,summary:V,accessibleTable:U,className:a,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:ge})),li({linkedHover:S,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),A&&A.length>0&&{annotations:A}),ee.crosshairProps),O);return ee.earlyReturn?ee.earlyReturn:e.jsx(Eo,{componentName:"BubbleChart",width:D,height:$,children:e.jsx(En,Object.assign({ref:i},ye))})});gi.displayName="BubbleChart";const pi=t.forwardRef(function(n,o){var r;const s=t.useRef(null);ei(o,{variant:"xy",frameRef:s});const l=Oo(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:a,margin:c,className:u,xAccessor:h="x",yAccessor:d="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,frameProps:j={},selection:A,linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,chartId:_,loading:P,emptyContent:L,showLegend:B,legendPosition:T,legendInteraction:R}=n,{width:F,height:H,enableHover:I,title:N,description:z,summary:W,accessibleTable:D,xLabel:$,yLabel:E}=l,Y=qo(P,F,H),G=Y?null:Xo(a,F,H,L),X=t.useMemo(()=>v(a),[a]),q=function(){var e;const t=go();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),se=null!==(r=null!=y?y:q)&&void 0!==r?r:"blues",le=null!=B&&B,ae=null!=T?T:"right",{margin:ce}=wo({data:X,colorBy:le?"value":void 0,colorScale:void 0,showLegend:le,legendPosition:ae,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:ue,customClickBehavior:he,crosshairSourceId:de}=xo({selection:A,linkedHover:O,fallbackFields:[],onObservation:M,onClick:S,chartType:"Heatmap",chartId:_,hoverHighlight:C,colorByField:void 0});Zo(A);const fe=ko(O,de);jo(R,void 0,[]);const ge=t.useMemo(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),pe=t.useMemo(()=>{const e=X.map(ge);return[Math.min(...e),Math.max(...e)]},[X,ge]),ye=t.useMemo(()=>"custom"===se&&m?m:i.scaleSequential({blues:V,reds:U,greens:K,viridis:ee,oranges:Q,purples:Z,greys:J,plasma:te,inferno:ne,magma:oe,cividis:ie,turbo:re}[se]||V).domain(pe),[se,m,pe]),me=t.useMemo(()=>No([{label:$||Ro(h),accessor:h,role:"x",format:g},{label:E||Ro(d),accessor:d,role:"y",format:p},{label:Ro(f),accessor:f,role:"value",format:x}]),[h,d,$,E,f,g,p,x]),ve=Qo({componentName:"Heatmap",data:a,accessors:{xAccessor:h,yAccessor:d,valueAccessor:f}}),be=t.useMemo(()=>{if(le)return{gradient:{colorFn:e=>ye(e),domain:pe,label:"string"==typeof f?f:"value",format:x}}},[le,ye,pe,f,x]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:X}),{xAccessor:h,yAccessor:d,valueAccessor:f,colorScheme:"custom"!==se?se:void 0,showValues:b,heatmapValueFormat:x,size:[F,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,showAxes:l.showAxes,xLabel:$,yLabel:E,xFormat:g,yFormat:p,enableHover:I}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),be&&{legend:be,legendPosition:ae}),si({title:N,description:z,summary:W,accessibleTable:D,className:u,animate:n.animate})),ai({tooltip:k,defaultTooltipContent:me})),li({linkedHover:O,onObservation:M,onClick:S,hoverHighlight:C,customHoverBehavior:ue,customClickBehavior:he})),w&&w.length>0&&{annotations:w}),fe),j);return Y||G||(ve?e.jsx(zo,{componentName:"Heatmap",message:ve,width:F,height:H}):e.jsx(Eo,{componentName:"Heatmap",width:F,height:H,children:e.jsx(En,Object.assign({ref:s},xe))}))});pi.displayName="Heatmap";const yi="__splomIdx",mi={top:4,bottom:4,left:4,right:4};function vi({frameRef:i,cellSize:r,onBrush:s}){const l=t.useRef(null),a=r-mi.left-mi.right,c=r-mi.top-mi.bottom;return t.useEffect(()=>{if(!l.current)return;const e=n.select(l.current).select(".brush-g"),t=o.brush().extent([[0,0],[a,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void s(null);const[[o,r],[l,a]]=e.selection,c=[[n.x.invert(o),n.y.invert(r)],[n.x.invert(l),n.y.invert(a)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,c,i,s]),e.jsx("svg",{ref:l,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${mi.left},${mi.top})`})})}function bi({data:n,xField:o,yField:i,cellSize:r,pointRadius:s,pointOpacity:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:h,unselectedOpacity:d,mode:f,onPointHover:g}){const p=t.useRef(null),y=Jn({name:u,clientId:`splom-${o}-${i}`}),m=no({name:u,xField:o,yField:i}),v=Jn({name:h,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==g||g(null));const t=e.data,n=null==t?void 0:t[yi];void 0!==n&&(b({[yi]:[n]}),null==g||g(t,e.x+mi.left,e.y+mi.top))},[b,g]),w=t.useCallback(e=>{const t={opacity:l,r:s};return t.fill=a?ue(e,a,c):po,"hover"===f?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*l):y.isActive&&!y.predicate(e)&&(t.opacity=d),t},[a,c,l,s,f,y.isActive,y.predicate,v.isActive,v.predicate,d]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(En,{ref:p,chartType:"scatter",data:n,size:[r,r],xAccessor:o,yAccessor:i,pointStyle:w,margin:mi,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?k:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.jsx(vi,{frameRef:p,cellSize:r,xField:o,yField:i,onBrush:x})]})}function xi({data:n,field:o,label:i,cellSize:r,bins:s,colorBy:l,colorScale:a,brushSelectionName:c,hoverSelectionName:u,mode:h}){const d=Jn({name:c,clientId:"splom-diag-"+o}),f=Jn({name:u,clientId:`splom-diag-${o}-hover`}),g="hover"===h?f:d,p=g.isActive,y=g.predicate,m=t.useMemo(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/s||1,a="string"==typeof l?l:null,c=a?[...new Set(n.map(e=>e[a]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),h=Array(s).fill(0),d=Array(s).fill(0),f=Array.from({length:s},()=>Array(c.length).fill(0)),g=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const r=Math.min(Math.floor((n-t)/i),s-1);if(h[r]++,p&&!y(e)||d[r]++,a){const t=u.get(e[a]+"");void 0!==t&&(f[r][t]++,p&&!y(e)||g[r][t]++)}}const m=Math.max(...h,1),v=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),l={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,l})}),b=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/m*(r-24),l={x:t/s*r,w:r/s-1,h:i,y0:n,category:c[o]};return n+=i,l})});return{bars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[n,o,s,r,p,y,l]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:p?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:p?.3:.6},"bg-"+n)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):po,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:po,opacity:.7},"sel-"+n)))]})}function ki({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function wi(n){const{data:o,fields:i,fieldLabels:r={},colorBy:s,colorScheme:l,cellSize:a=150,cellGap:c=4,pointRadius:u=2,pointOpacity:h=.5,diagonal:f="histogram",histogramBins:g=20,brushMode:p="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=n,O="splom",M="splom-hover",S=y?"hover":p?"brush":"hover",C=Kn(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(M),P(null)},[C,M]),B=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[yi]?e:Object.assign(Object.assign({},e),{[yi]:t})),[o]),T=bo(B,s,l),R=void 0!==x?x:!!s,F=t.useMemo(()=>{if(!R||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:T?T(e+""):po})):null},[R,s,B,T]),H=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>a+"px").join(" "),gridTemplateRows:i.map(()=>a+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,a,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[F&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:H,onMouseLeave:"hover"===S?L:void 0,children:[i.map((t,n)=>e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((o,i)=>n===i?"label"===f?e.jsx(ki,{label:r[t]||t,cellSize:a},"diag-"+t):e.jsx(xi,{data:B,field:t,label:r[t]||t,cellSize:a,bins:g,colorBy:s,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,mode:S},"diag-"+t):e.jsx(bi,{data:B,xField:o,yField:t,fieldLabels:r,cellSize:a,pointRadius:u,pointOpacity:h,colorBy:s,colorScale:T,brushSelectionName:O,hoverSelectionName:M,unselectedOpacity:m,showGrid:v,tooltip:b,mode:S,onPointHover:"hover"===S?(e,r,s)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=r?r:0,py:null!=s?s:0}),j&&j({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===S&&(()=>{const t=_.datum,n=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,l=k?"function"==typeof k?k(t):t[k]:"Row "+t[yi];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(a+c)+_.px,top:_.rowIndex*(a+c)+_.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function ji(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(uo,{selections:i,children:e.jsx(wi,Object.assign({},t))})}function Ai({width:i,height:r,margin:s,scales:l,brushDirection:a,extent:c,onBrush:u}){const h=t.useRef(null),d=t.useRef(null),f=t.useRef(!1),g=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!h.current||!l)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?o.brushX().extent([[0,0],[i,r]]):o.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(f.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===a?l.x:l.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,i,r,a,u]),t.useEffect(()=>{if(!d.current||!l||!h.current)return;const e=n.select(h.current).select(".brush-group"),t="x"===a?l.x:l.y;if(f.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);f.current=!1},[c,l,a]),e.jsx("svg",{ref:h,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function Oi(n){var o,i;const{data:r,width:s=600,height:l=400,margin:a,className:c,title:u,description:h,summary:d,xLabel:f,yLabel:g,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:O=2,fillArea:M=!1,areaOpacity:S=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:B,legendPosition:T,tooltip:R,minimap:F={},renderBefore:H=!1,onBrush:I,brushExtent:N,frameProps:z={},loading:W,emptyContent:D}=n,$=qo(W,s,l),E=$?null:Xo(r,s,l,D),Y=t.useMemo(()=>v(r),[r]),[G,X]=t.useState(null),q=null!=N?N:G,V=t.useCallback(e=>{N||X(e),null==I||I(e)},[N,I]),U=t.useRef(null),[K,Q]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=U.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?Q(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const Z=void 0!==(null===(o=Y[0])||void 0===o?void 0:o[k]),J=t.useMemo(()=>{if(Z)return Y;if(x){const e=Y.reduce((e,t)=>{const n="function"==typeof x?x(t):t[x];if(!e[n]){const t={[k]:[]};"string"==typeof x&&(t[x]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Y}]},[Y,x,k,Z]),ee=t.useMemo(()=>Z||x?J.flatMap(e=>{const t=e[k]||[];return x&&"string"==typeof x?t.map(t=>Object.assign(Object.assign({},t),{[x]:e[x]})):t}):Y,[J,k,Z,x,Y]),te=bo(Y,w,j),ne=t.useMemo(()=>e=>{const t={strokeWidth:O};return t.stroke=w?ue(e,w,te):po,M&&(t.fill=t.stroke,t.fillOpacity=S),t},[w,te,O,M,S]),oe=t.useMemo(()=>F.lineStyle?F.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=w?ue(e,w,te):po,t},[w,te,F.lineStyle]),ie=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ue(e.parentLine||e,w,te):po,t}},[C,_,w,te]),{legend:re,margin:se,legendPosition:le}=wo({data:J,colorBy:w,colorScale:te,showLegend:B,legendPosition:T,userMargin:a}),ae=F.height||60,ce=t.useMemo(()=>{var e,t,n,o,i,r,s,l;return{top:null!==(t=null===(e=F.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=F.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=F.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:se.left,right:null!==(l=null===(s=F.margin)||void 0===s?void 0:s.right)&&void 0!==l?l:se.right}},[F.margin,se]),he=F.brushDirection||"x",de=Qo({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:b}});if(de)return e.jsx(zo,{componentName:"MinimapChart",message:de,width:s,height:l});const fe=M?"area":"line",ge=t.useMemo(()=>No([{label:f||Ro(m),accessor:m,role:"x",format:p},{label:g||Ro(b),accessor:b,role:"y",format:y}]),[m,b,f,g,p,y]),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:fe,data:ee,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:ne},C&&{pointStyle:ie}),{size:[s,l],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se,showAxes:!0,xLabel:f,yLabel:g,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),re&&{legend:re,legendPosition:le}),u&&{title:u}),h&&{description:h}),d&&{summary:d}),{tooltipContent:!1===R?()=>null:To(R)||ge}),q&&{xExtent:q}),z),ye={chartType:fe,data:ee,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:oe,size:[s,ae+ce.top+ce.bottom],margin:ce,showAxes:null!==(i=F.showAxes)&&void 0!==i&&i,background:F.background,enableHover:!1},me=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(En,Object.assign({ref:U},ye)),e.jsx(Ai,{width:s-ce.left-ce.right,height:ae,margin:ce,scales:K,brushDirection:he,extent:q,onBrush:V})]},"minimap"),ve=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(En,Object.assign({},pe))},"main");return $||E||e.jsx(Eo,{componentName:"MinimapChart",width:s,height:l,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[H?me:ve,H?ve:me]})})}ji.displayName="ScatterplotMatrix",Oi.displayName="MinimapChart";const Mi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(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:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",yAccessor:d="y",xCenter:f,yCenter:g,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:b=12,colorBy:x,colorScheme:k,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:O=.8,tooltip:M,pointIdAccessor:S,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:B,onClick:T,hoverHighlight:R,chartId:F,loading:H,emptyContent:I,legendInteraction:N,legendPosition:z,color:W,stroke:D,strokeWidth:$,opacity:E}=n,{width:Y,height:G,enableHover:X,showGrid:q,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>v(s),[s]),ne=Jo({data:te,rawData:s,colorBy:x,colorScheme:k,legendInteraction:N,legendPosition:z,selection:P,linkedHover:L,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:B,onClick:T,hoverHighlight:R,chartType:"QuadrantChart",chartId:F,showLegend:V,userMargin:l,marginDefaults:r.marginDefaults,loading:H,emptyContent:I,width:Y,height:G});Vo("QuadrantChart",te,"xAccessor",h),Vo("QuadrantChart",te,"yAccessor",d);const oe=t.useMemo(()=>{if(!te.length)return;const e="function"==typeof h?h:e=>+e[h],t="function"==typeof d?d:e=>+e[d];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of te){const l=e(s),a=t(s);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>r&&(r=a))}if(null!=f&&isFinite(f)&&(n>f&&(n=f),f>o&&(o=f)),null!=g&&isFinite(g)&&(i>g&&(i=g),g>r&&(r=g)),n===1/0)return;const s=.1*(o-n)||1,l=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-l,r+l]}},[te,h,d,f,g]),ie=t.useMemo(()=>{if(!w||0===te.length)return;const e=te.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,w]),re=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),se=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>e=>{const t={fillOpacity:O};if(x)ne.colorScale&&(t.fill=ue(e,x,ne.colorScale));else{const n=re(e),o=se(e),i=null!=f?n>=f:void 0,r=null!=g?o>=g:void 0;t.fill=void 0===r||void 0===i?W||po:r&&i?p.topRight.color:r&&!i?p.topLeft.color:!r&&i?p.bottomRight.color:p.bottomLeft.color}return t.r=w?de(e,w,j,ie):A,t},[x,ne.colorScale,w,j,ie,A,O,re,se,f,g,p,W]),ae=t.useMemo(()=>So(le,{stroke:D,strokeWidth:$,opacity:E}),[le,D,$,E]),ce=t.useMemo(()=>fo(ae,ne.effectiveSelectionHook,ne.resolvedSelection),[ae,ne.effectiveSelectionHook,ne.resolvedSelection]),he=t.useMemo(()=>{if(!te.length)return;const e=new Set;"string"==typeof h&&e.add(h),"string"==typeof d&&e.add(d),"string"==typeof x&&e.add(x),"string"==typeof w&&e.add(w);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,h,d,x,w]),fe=t.useMemo(()=>No([...he?[{label:he,accessor:he,role:"title"}]:[],{label:J||Ro(h),accessor:h,role:"x",format:c},{label:ee||Ro(d),accessor:d,role:"y",format:u},...x?[{label:Ro(x),accessor:x,role:"color"}]:[],...w?[{label:Ro(w),accessor:w,role:"size"}]:[]]),[he,h,d,J,ee,x,w,c,u]),ge=Qo({componentName:"QuadrantChart",data:s,accessors:{xAccessor:h,yAccessor:d}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,l=i.height,a=null!=f?o.x(f):s/2,c=null!=g?o.y(g):l/2;if(null!=f&&!isFinite(a))return;if(null!=g&&!isFinite(c))return;const u=Math.max(0,Math.min(s,a)),h=Math.max(0,Math.min(l,c)),d=[{config:p.topLeft,x:0,y:0,w:u,h:h},{config:p.topRight,x:u,y:0,w:s-u,h:h},{config:p.bottomLeft,x:0,y:h,w:u,h:l-h},{config:p.bottomRight,x:u,y:h,w:s-u,h:l-h}];for(const t of d)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,l),e.stroke(),e.beginPath(),e.moveTo(0,h),e.lineTo(s,h),e.stroke(),e.setLineDash([])}]},[f,g,p,y]),ye=t.useMemo(()=>m?[...pe,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,s=null!=f?n.x(f):i/2,l=null!=g?n.y(g):r/2;(null==f||isFinite(s))&&(null==g||isFinite(l))&&(e.font=`600 ${b}px sans-serif`,e.globalAlpha=.5,e.fillStyle=p.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(p.topLeft.label,8,8),e.fillStyle=p.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(p.topRight.label,i-8,8),e.fillStyle=p.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(p.bottomLeft.label,8,r-8),e.fillStyle=p.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(p.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:pe,[pe,m,b,p,f,g]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const r=i.width,s=i.height,l=null!=f?o.x(f):r/2,a=null!=g?o.y(g):s/2;if(null!=f&&!isFinite(l))return null;if(null!=g&&!isFinite(a))return null;const c=Math.max(0,Math.min(r,l)),u=Math.max(0,Math.min(s,a));return e.jsxs(e.Fragment,{children:[[{config:p.topLeft,x:0,y:0,w:c,h:u},{config:p.topRight,x:c,y:0,w:r-c,h:u},{config:p.bottomLeft,x:0,y:u,w:c,h:s-u},{config:p.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+b,fill:p.topLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.topLeft.label}),e.jsx("text",{x:r-8,y:8+b,fill:p.topRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:p.bottomLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:p.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:p.bottomRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:p.bottomRight.label})]})]})}]},[f,g,p,y,m,b]),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:h,yAccessor:d,colorAccessor:x||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:ce,colorScheme:k,size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:X,showGrid:q}),oe&&{xExtent:oe.xExtent,yExtent:oe.yExtent}),ne.legendBehaviorProps),U&&{title:U}),K&&{description:K}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),a&&{className:a}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?fe:To(M)||fe}),(L||B||T||R)&&{customHoverBehavior:ne.customHoverBehavior}),(B||T||L)&&{customClickBehavior:ne.customClickBehavior}),S&&{pointIdAccessor:S}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ne.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return ne.earlyReturn?ne.earlyReturn:ge?e.jsx(zo,{componentName:"QuadrantChart",message:ge,width:Y,height:G}):e.jsx(Eo,{componentName:"QuadrantChart",width:Y,height:G,children:e.jsx(En,Object.assign({ref:i},be))})});Mi.displayName="QuadrantChart";const Si="__ma_unitized",Ci="__ma_series";function _i(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Pi(e,t){return t[0]+e*(t[1]-t[0])}const Li=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=t.useRef([]),l=t.useRef(n.series);l.current=n.series,t.useImperativeHandle(o,()=>{const e=()=>{var e;return(null!==(e=l.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||s.current[e];if(!i)continue;const l=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=l&&isFinite(l)&&r.current.push(Object.assign(Object.assign({},o),{[Si]:_i(l,i),[Ci]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||s.current[t];if(!r)continue;const l=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=l&&isFinite(l)&&o.push(Object.assign(Object.assign({},e),{[Si]:_i(l,r),[Ci]:i.label||"Series "+(t+1)}))}r.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const a=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:h,xFormat:f,xAccessor:g="x",series:p,colorScheme:y,curve:m="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:M,hoverHighlight:S,chartId:C,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,stroke:T,strokeWidth:R,opacity:F}=n,{width:H,height:I,enableHover:N,showGrid:z,showLegend:W=!0,title:D,description:$,summary:E,accessibleTable:Y,xLabel:G}=a,X=t.useMemo(()=>v(c),[c]),q=t.useMemo(()=>v(p),[p]),V=q,U=2===q.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||U||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const K=qo(_,H,I),Q=K?null:Xo(c,H,I,P),Z=vo(),J=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(Z&&Z.length>0)e=Z;else{const t=se[y];e=Array.isArray(t)?t:le}return V.map((t,n)=>t.color||e[n%e.length])},[V,y,Z]),ee=t.useMemo(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:te,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(s.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(X,e.yAccessor));if(s.current=e,!U){const t=[];for(const e of X)for(let n=0;q.length>n;n++){const o=q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Si]:i,[Ci]:ee[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of X)for(let o=0;2>o;o++){const i=q[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Si]:_i(r,e[o]),[Ci]:ee[o]}))}return{unitizedData:t,extents:e}},[X,q,U,ee]),oe=t.useMemo(()=>{if(U&&ne.length>=2)return[{orient:"left",label:ee[0],tickFormat:q[0].format||(e=>{const t=Pi(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ee[1],tickFormat:q[1].format||(e=>{const t=Pi(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[U,ne,q,ee]),ie=Jo({data:t.useMemo(()=>te.length>0?te:ee.map(e=>({[Ci]:e})),[te,ee]),rawData:c,colorBy:Ci,colorScheme:J,legendInteraction:L,legendPosition:B,selection:j,linkedHover:A,fallbackFields:[Ci],unwrapData:!1,onObservation:O,onClick:M,hoverHighlight:S,chartType:"MultiAxisLineChart",chartId:C,showLegend:W,userMargin:u,marginDefaults:U?Object.assign(Object.assign({},a.marginDefaults),{left:70,right:70}):a.marginDefaults,loading:_,emptyContent:P,width:H,height:I});if(ie.earlyReturn)return ie.earlyReturn;const re=t.useMemo(()=>{const e=new Map;return ee.forEach((t,n)=>e.set(t,J[n])),t=>({stroke:e.get(t[Ci])||J[0],strokeWidth:b,fill:"none"})},[ee,J,b]),ae=t.useMemo(()=>So(re,{stroke:T,strokeWidth:R,opacity:F}),[re,T,R,F]),ce=t.useMemo(()=>fo(ae,ie.effectiveSelectionHook,ie.resolvedSelection),[ae,ie.effectiveSelectionHook,ie.resolvedSelection]),ue=t.useMemo(()=>{if(!1===x)return()=>null;return To(x)||(e=>{var t;const n=e.data||e,o=n[Ci],i=ee.indexOf(o),r=n[Si],s=U&&i>=0&&ne[i]?Pi(r,ne[i]):r,l=i>=0&&(null===(t=q[i])||void 0===t?void 0:t.format)?q[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof g?g(n):n[g];return d.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},d.createElement("div",{style:{fontWeight:600,marginBottom:4,color:J[i]||"inherit"}},o),d.createElement("div",null,`${"string"==typeof g?g:"x"}: ${a}`),d.createElement("div",null,`${o}: ${l(s)}`))})},[x,ee,J,ne,U,q,g]),he=Qo({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),de=U?[0,1]:void 0,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:te}),{xAccessor:g,yAccessor:Si,groupAccessor:Ci,lineStyle:ce,colorScheme:J,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:a.showAxes}),oe&&{axes:oe}),{xLabel:G}),U?{}:{yLabel:ee[0]}),{xFormat:f}),U&&de&&{yExtent:de}),{enableHover:N}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:z,curve:m}),ie.legendBehaviorProps),D&&{title:D}),$&&{description:$}),E&&{summary:E}),void 0!==Y&&{accessibleTable:Y}),h&&{className:h}),null!=n.animate&&{animate:n.animate}),{tooltipContent:ue}),k&&{annotations:k}),(A||O||M||S)&&{customHoverBehavior:ie.customHoverBehavior}),(O||M||A)&&{customClickBehavior:ie.customClickBehavior}),ie.crosshairProps),w);return K||Q||(he?e.jsx(zo,{componentName:"MultiAxisLineChart",message:he,width:H,height:I}):e.jsx(Eo,{componentName:"MultiAxisLineChart",width:H,height:I,children:e.jsx(En,Object.assign({ref:r},fe))}))});Li.displayName="MultiAxisLineChart";const Bi=t.forwardRef(function(n,o){const i=t.useRef(null);ei(o,{variant:"xy",frameRef:i});const r=Oo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:s,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:h="x",highAccessor:d="high",lowAccessor:f="low",openAccessor:g,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:j,onClick:A,chartId:O,loading:M,emptyContent:S}=n,{width:C,height:_,enableHover:P,showGrid:L,title:B,description:T,summary:R,accessibleTable:F,xLabel:H,yLabel:I}=r,N=qo(M,C,_),z=N?null:Xo(s,C,_,S),W=t.useMemo(()=>v(s),[s]),D=null==g||null==p;Vo("CandlestickChart",W,"xAccessor",h),Vo("CandlestickChart",W,"highAccessor",d),Vo("CandlestickChart",W,"lowAccessor",f),D||(Vo("CandlestickChart",W,"openAccessor",g),Vo("CandlestickChart",W,"closeAccessor",p));const{customHoverBehavior:$,customClickBehavior:E,crosshairSourceId:Y}=xo({selection:k,linkedHover:w,onObservation:j,onClick:A,chartType:"CandlestickChart",chartId:O}),G=ko(w,Y),X=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?t:"number"==typeof l?{top:l,bottom:l,left:l,right:l}:Object.assign(Object.assign({},t),l)},[l,r.marginDefaults,n.mode]),q=t.useMemo(()=>{const e=[{label:H||Ro(h),accessor:h,role:"x",format:c}];return D?(e.push({label:"High",accessor:d,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:g,format:u}),e.push({label:"High",accessor:d,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:p,format:u})),No(e)},[h,H,c,u,d,f,g,p,D]),V=Qo({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:h,highAccessor:d,lowAccessor:f},!D&&{openAccessor:g,closeAccessor:p})}),U=Math.max(2,Math.min(12,Math.round(C/40))),K=C>200?.1:.02,Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=s&&{data:W}),{xAccessor:h,yAccessor:d,highAccessor:d,lowAccessor:f}),!D&&{openAccessor:g,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:U,extentPadding:K,size:[C,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X,showAxes:r.showAxes,xLabel:H,yLabel:I,xFormat:c,yFormat:u,enableHover:P,showGrid:L}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),si({title:B,description:T,summary:R,accessibleTable:F,className:a,animate:n.animate})),ai({tooltip:m,defaultTooltipContent:q})),li({linkedHover:w,onObservation:j,onClick:A,customHoverBehavior:$,customClickBehavior:E})),b&&b.length>0&&{annotations:b}),G),x);return N||z||(V?e.jsx(zo,{componentName:"CandlestickChart",message:V,width:C,height:_}):e.jsx(Eo,{componentName:"CandlestickChart",width:C,height:_,children:e.jsx(En,Object.assign({ref:i},Q))}))});Bi.displayName="CandlestickChart";const Ti=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,xExtent:l,yExtent:a,showAxes:c=!1,margin:u,className:h,annotations:d,onObservation:f,onClick:g,selection:p,linkedHover:y,chartId:m,loading:v,emptyContent:b,colorScheme:x,frameProps:k={}}=n,{frameRef:w,resolved:j,safeData:A,setup:O,earlyReturn:M}=function(e){var n;const o=function(e){const n=t.useRef(null);return ei(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:Oo(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=Jo({data:null!==(n=e.data)&&void 0!==n?n:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:i.showLegend,userMargin:r,marginDefaults:i.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:i,colorScheme:x,selection:p,linkedHover:y,onObservation:f,onClick:g,chartId:m,loading:v,emptyContent:b,margin:u,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,mode:n.mode,xLabel:n.xLabel,yLabel:n.yLabel});if(M)return M;const{width:S,height:C,enableHover:_,showGrid:P,title:L,description:B,summary:T,accessibleTable:R,xLabel:F,yLabel:H}=j,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:A}),{customLayout:r,layoutConfig:s,xExtent:l,yExtent:a,colorScheme:x,size:[S,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,showAxes:c,xLabel:F,yLabel:H,enableHover:_,showGrid:P}),O.legendBehaviorProps),si({title:L,description:B,summary:T,accessibleTable:R,className:h,animate:n.animate})),null!=n.tooltip&&{tooltipContent:n.tooltip}),li({linkedHover:y,onObservation:f,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),d&&d.length>0&&{annotations:d}),O.crosshairProps),k);return e.jsx(Eo,{componentName:"XYCustomChart",width:S,height:C,children:e.jsx(En,Object.assign({ref:w},I))})});function Ri(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),r=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Fi(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),r=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}Ti.displayName="XYCustomChart";const Hi="__forecastSegment";function Ii(e,t){return"function"==typeof t?t(e):!!e[t]}const Ni=Object.freeze({__proto__:null,SEGMENT_FIELD:Hi,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(r=o).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,n,o,i){var r,s,l,a;const{isTraining:c,isForecast:u,isAnomaly:h,upperBounds:d,lowerBounds:f,color:g="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&Ii(e,u)?t="forecast":c&&Ii(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[Hi]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][Hi]!==n[e+1][Hi]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[Hi]:n[e][Hi]})),t.push(Object.assign(Object.assign({},n[e]),{[Hi]:n[e+1][Hi]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][Hi]!==b[e+1][Hi]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[Hi]:b[e][Hi]})),k.push(Object.assign(Object.assign({},b[e]),{[Hi]:b[e+1][Hi]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[Hi]&&e.push(Object.assign(Object.assign({},t),{[Hi]:"training-base"}));k.unshift(...e)}const w=[];if(d&&f){const e="string"==typeof d?d:"__envUpper",t="string"==typeof f?f:"__envLower";if("function"==typeof d||"function"==typeof f)for(const n of k)"function"==typeof d&&(n[e]=d(n)),"function"==typeof f&&(n[t]=f(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:g,fillOpacity:p,label:v})}if(h){const e=o.anomalyStyle,t={type:"highlight",filter:e=>Ii(e,h)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(l=i.bandOpacity)&&void 0!==l?l:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var r,s,l;const{trainEnd:a,steps:c=10,confidence:u=.95,color:h="#6366f1",bandOpacity:d=.15,label:f}=o;if(null==a)return{processedData:e,annotations:[]};const g=[],p=[];for(const n of e)n[t]>a?p.push(Object.assign(Object.assign({},n),{[Hi]:"observed"})):g.push(Object.assign(Object.assign({},n),{[Hi]:"training"}));const y=g.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const o=y.length;let i=0,r=0,s=0,l=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,l+=e*t;const a=o*s-i*i;if(Math.abs(a)>1e-12){const s=(o*l-i*r)/a,g=(r-s*i)/o,p=e=>g+s*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(o-2,1)),k=y.reduce((e,t)=>e+t[0],0)/o,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,A=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),O=Math.max(...A),M=y.length>1?(y[o-1][0]-y[0][0])/(o-1):1;for(let e=1;c>=e;e++){const i=O+e*M,r=p(i),s=x*Math.sqrt(1+1/o+(w>0?Math.pow(i-k,2)/w:0))*j;v.push({[t]:i,[n]:r,[Hi]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:h,fillOpacity:d,label:f})}}m.push({type:"x-threshold",x:a,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label});const b=[];if(b.push(...g),g.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},g[g.length-1]),{[Hi]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:g[g.length-1];e&&b.push(Object.assign(Object.assign({},e),{[Hi]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var r},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",r=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",s=t.color||"#6366f1",l=t.trainOpacity,a=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,h=t.trainUnderline;return t=>{const n=e(t),o=t[Hi];if("training"===o){let e=n.stroke;return"darken"===c?e=Ri(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=l&&{strokeOpacity:l})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===h&&(e=Fi(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}return"forecast"===o?Object.assign(Object.assign(Object.assign({},n),{stroke:s,strokeDasharray:r}),null!=a&&{strokeOpacity:a}):n}},darkenColor:Ri,lightenColor:Fi});exports.AreaChart=ci,exports.BubbleChart=gi,exports.CandlestickChart=Bi,exports.ConnectedScatterplot=fi,exports.Heatmap=pi,exports.LineChart=ri,exports.MinimapChart=Oi,exports.MultiAxisLineChart=Li,exports.QuadrantChart=Mi,exports.Scatterplot=hi,exports.ScatterplotMatrix=ji,exports.StackedAreaChart=ui,exports.StreamXYFrame=En,exports.XYCustomChart=Ti;
|