semiotic 3.5.4 → 3.7.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 +196 -175
- package/README.md +52 -15
- package/ai/cli.js +41 -0
- package/ai/componentMetadata.cjs +11 -2
- package/ai/dist/mcp-server.js +454 -4
- package/ai/examples.md +98 -0
- package/ai/schema.json +614 -9
- package/ai/system-prompt.md +5 -2
- package/dist/components/AccessibleNavTree.d.ts +25 -0
- package/dist/components/Annotation.d.ts +40 -14
- package/dist/components/ChartContainer.d.ts +32 -2
- package/dist/components/ai/annotationProvenance.d.ts +349 -0
- package/dist/components/ai/audienceProfile.d.ts +147 -0
- package/dist/components/ai/audiences.d.ts +31 -0
- package/dist/components/ai/chartCapabilities.d.ts +55 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +254 -0
- package/dist/components/ai/chartRoles.d.ts +27 -0
- package/dist/components/ai/conversationArc.d.ts +379 -0
- package/dist/components/ai/dataScaleProfile.d.ts +320 -0
- package/dist/components/ai/describeChart.d.ts +114 -0
- package/dist/components/ai/diffProfile.d.ts +51 -0
- package/dist/components/ai/inferIntent.d.ts +24 -0
- package/dist/components/ai/intents.d.ts +34 -0
- package/dist/components/ai/navigationTree.d.ts +45 -0
- package/dist/components/ai/profileData.d.ts +16 -0
- package/dist/components/ai/qualityFixtures.d.ts +2 -0
- package/dist/components/ai/qualityScorecard.d.ts +82 -0
- package/dist/components/ai/readerGrounding.d.ts +70 -0
- package/dist/components/ai/repairChartConfig.d.ts +73 -0
- package/dist/components/ai/streamingTypes.d.ts +64 -0
- package/dist/components/ai/suggestCharts.d.ts +109 -0
- package/dist/components/ai/suggestDashboard.d.ts +92 -0
- package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
- package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
- package/dist/components/ai/useChartSuggestions.d.ts +22 -0
- package/dist/components/ai/useConversationArc.d.ts +89 -0
- package/dist/components/ai/useNavigationSync.d.ts +61 -0
- package/dist/components/ai/variantDiscovery.d.ts +168 -0
- package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
- package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
- package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
- package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
- package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
- package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
- package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +3 -0
- package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
- package/dist/components/charts/shared/annotationHierarchy.d.ts +42 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +3 -2
- package/dist/components/charts/shared/annotationRules.d.ts +16 -0
- package/dist/components/charts/shared/annotationTypes.d.ts +14 -0
- package/dist/components/charts/shared/auditAccessibility.d.ts +90 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +2 -37
- package/dist/components/charts/shared/diagnoseConfig.d.ts +4 -6
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +5 -1
- package/dist/components/charts/value/BigNumber.capability.d.ts +13 -0
- package/dist/components/charts/value/BigNumber.d.ts +14 -0
- package/dist/components/charts/value/formatting.d.ts +40 -0
- package/dist/components/charts/value/thresholdSparkline.d.ts +40 -0
- package/dist/components/charts/value/types.d.ts +292 -0
- package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
- package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
- package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
- package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
- package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
- package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
- package/dist/components/data/DataSummarizer.d.ts +45 -0
- package/dist/components/realtime/lifecycleBands.d.ts +44 -0
- package/dist/components/realtime/types.d.ts +23 -8
- package/dist/components/recipes/annotationDensity.d.ts +69 -0
- package/dist/components/recipes/annotationLayout.d.ts +93 -0
- package/dist/components/semiotic-ai.d.ts +58 -0
- package/dist/components/semiotic-realtime.d.ts +2 -0
- package/dist/components/semiotic-recipes.d.ts +4 -0
- package/dist/components/semiotic-utils.d.ts +8 -0
- package/dist/components/semiotic-value.d.ts +55 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +8 -1
- package/dist/components/server/staticAnnotations.d.ts +2 -0
- package/dist/components/store/useChartFocus.d.ts +43 -0
- package/dist/components/store/useChartInterrogation.d.ts +141 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +10 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +11 -5
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +2 -0
- package/dist/components/stream/geoTypes.d.ts +3 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +2 -0
- package/dist/components/stream/types.d.ts +2 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +58 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +2 -0
- package/dist/semiotic-recipes.d.ts +4 -0
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +8 -0
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.d.ts +55 -0
- package/dist/semiotic-value.min.js +2 -0
- package/dist/semiotic-value.module.min.js +2 -0
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +8 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +28 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from"react";import{useRef as i,useMemo as r,useEffect as s,useContext as a,useCallback as l,useSyncExternalStore as c,createContext as d,useState as u,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleBand as S,scaleSequential as O}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{curveNatural as j,curveBasis as M,curveStepAfter as _,curveStepBefore as P,curveStep as L,curveCatmullRom as T,curveCardinal as N,curveMonotoneY as B,curveMonotoneX as $,line as E,area as D,curveLinear as H,arc as I,pie as R}from"d3-shape";import{bin as F,quantile as W,min as z,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Q,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as oe}from"d3-hierarchy";import ne from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as se,forceManyBody as ae,forceCenter as le,forceX as ce,forceY as de}from"d3-force";import{ribbon as ue,chord as he}from"d3-chord";function ge(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function fe(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function pe({width:t,height:o,totalWidth:n,totalHeight:a,margin:l,dimension:c,scales:d,onBrush:u,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(u);A.current=u;const S=i(d);S.current=d;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),C=i(O);C.current=O;const j=i(!1),M=i(null);return s(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),n="x"===c?m():"y"===c?v():b();return n.extent([[0,0],[t,o]]),n.on("brush end",i=>{if(j.current)return;const r=S.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=i.selection;s=[r.x.invert(e),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(0)]}else if("y"===c){const[e,o]=i.selection;s=[r.x.invert(0),r.x.invert(t)],a=[r.y.invert(o),r.y.invert(e)]}else{const[[e,t],[o,n]]=i.selection;s=[r.x.invert(e),r.x.invert(o)],a=[r.y.invert(n),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?s=function(e,t){return 0===t.length?e:[ge(e[0],t),fe(e[1],t)]}(s,t):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const o=r.x(s[0]),a=r.x(s[1]);if(j.current=!0,"x"===c)e.call(n.move,[o,a]);else if("xy"===c){const t=i.selection;e.call(n.move,[[o,t[0][1]],[a,t[1][1]]])}j.current=!1}const l={x:s,y:a};M.current=l,A.current(l)}),e.call(n),w.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[t,o,c,g,h,p]),s(()=>{if(!(x&&d&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=d.x.domain()[0],o=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,o.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);let n=e.x[0],i=!1;if(t>e.x[0]){if(n=t,"bin"===g){const e=C.current;e&&e.length>0?n=fe(t,e):h&&h>0&&(n=Math.ceil(t/h)*h)}if(n>=e.x[1])return j.current=!0,o.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);i=!0}const r=d.x(n),s=d.x(e.x[1]);if(j.current=!0,"x"===c)o.call(w.current.move,[r,s]);else{const t=d.y(e.y[1]),n=d.y(e.y[0]);o.call(w.current.move,[[r,t],[s,n]])}if(j.current=!1,i){const t={x:[n,e.x[1]],y:e.y};M.current=t,A.current(t)}},[d,x,c,g,h]),e("svg",{ref:k,width:n,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const ye=Object.freeze([]);function me(e){if(!e)return ye;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class ve{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n: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=me(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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=me(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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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 o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),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 be(t){let o=null;const n=()=>(o||(o=d(null)),o),s=xe(t);return[function({children:o,initialState:s}){const a=i(s),l=r(()=>xe(t,a.current),[]),c=n();return e(c.Provider,{value:l,children:o})},e=>{var t;const o=n(),r=null!==(t=a(o))&&void 0!==t?t:s,d=i(e);d.current=e;const u=l(()=>d.current(r.getState()),[r]),h=l(()=>d.current(r.getState()),[r]);return c(r.subscribe,u,h)}]}function xe(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={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}},Oe={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}},Ce={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,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 je(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return Ce;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?Oe:Se;return we(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 we(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[Me,_e]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:je(e.theme,t)}))}}));class Pe{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 o of e){const e=this.push(o);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 o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+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),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 Le{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 o of e){const e=t?t(o):o;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 Te(e,t,o,n,i){const r=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=r.get(l);if(c||(c={start:l,end:l+n,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 Ne(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(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 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 Be(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),d=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(d)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),d=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],d[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:d,style:r,datum:e,group:s}}function $e(e,t,o,n){var i,r,s;const a=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const i of t)e+=o(i,n)||0;a.set(n,-e/2)}else if("wiggle"===n){e.length>0&&a.set(e[0],0);for(let n=1;e.length>n;n++){const r=e[n-1],s=e[n];let l=0,c=0,d=0;for(const e of t){const t=o(e,s)||0;l+=(2*d+t)*(t-(o(e,r)||0)),c+=t,d+=t}const u=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,u-(c>0?l/(2*c):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=n/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function Ee(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(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 De(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function He(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,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 Ie(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Re(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function Fe(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function We(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function ze(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ge(e){const t=e.map(ze),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return Ye(e,o,n)}if(e>=1){const[e,n,i]=t[o];return Ye(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return Ye(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qe=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ot=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),nt=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),st=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),at=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),dt=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ut=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,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:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Qe,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 mt(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||yt.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):gt[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%gt.length]}function vt(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return x().domain(n).range(o).unknown("#999");const r=ht[o]||ht.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:gt;return x().domain(n).range(e).unknown("#999")}}function bt(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function xt(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}function kt(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,o){return e+(t-e)*o}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ct(e,t,o){var n,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 o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function jt(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function Mt(e,t,o,n){if(!e.scales)return null;const i=[],r=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),d=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(d)&&(i.push([l,c]),r.push([l,d]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:jt(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function _t(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function Pt(e,t,o){const n=[];for(const i of o){const o=Mt(e,t,"__ribbon_aggregate",i);o&&n.push(o)}return n}function Lt(e,t,o,n){const i=[];for(const r of n){const n=Mt(e,t,o,r);n&&i.push(n)}return i}function Tt(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),i=n.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&o.push({y0:i,y1:t})}return 0===o.length?e:Object.assign(Object.assign({},e),{band:o[0],bands:o})}function Nt(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=Ee(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const Bt={topOpacity:.8,bottomOpacity:.05};function $t(e){var t,o;if(e)return!0===e?Bt:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Bt.topOpacity,bottomOpacity:null!==(o=e.bottomOpacity)&&void 0!==o?o:Bt.bottomOpacity}}const Et={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it},Dt=new Map;function Ht(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function It(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=Ht(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=Re(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:Ht(e.y1Accessor,"y1"),getBottom:Ht(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Rt{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new Pe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Re(e.timeAccessor||e.xAccessor,"time"),this.getY=Re(e.valueAccessor||e.yAccessor,"value")):(this.getX=Re(e.xAccessor,"x"),this.getY=Re(e.yAccessor,"y")),this.getGroup=We(e.groupAccessor),this.getCategory=We(e.categoryAccessor),this.getSize=e.sizeAccessor?Re(e.sizeAccessor,"size"):void 0,this.getColor=We(e.colorAccessor),this.getY0=e.y0Accessor?Re(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=It(e),this.getPointId=We(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Re(e.openAccessor,"open"):void 0,this.getHigh=Re(e.highAccessor,"high"),this.getLow=Re(e.lowAccessor,"low"),this.getClose=o?Re(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Pe(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}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?Re(this.config.timeAccessor||this.config.xAccessor,"time"):Re(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)if(this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}}else for(const o 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(o);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}}return!0}computeScene(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(o=p.xExtent[0])&&void 0!==o?o:v[0],null!==(n=p.xExtent[1])&&void 0!==n?n:v[1]]:v,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(s=p.baseline)&&void 0!==s?s:"zero"}:${null!==(a=p.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(m),o=new Map,n=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const o of e.data){const e=this.getX(o),s=this.getY(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),n.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}o.set(e.key,t),s.set(e.key,a)}const a=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(c=s.get(t))&&void 0!==c?c:0):(n.push(t),r+=null!==(d=s.get(t))&&void 0!==d?d:0);f=[...n.reverse(),...o]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(e))&&void 0!==o?o:0)-(null!==(n=s.get(t))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=$e(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},p.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(u=t.get(o))&&void 0!==u?u:0,n=null!==(h=r.get(o))&&void 0!==h?h:0;i>e&&(i=e),e+n>s&&(s=e+n)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=C?0:a>0?a*p.extentPadding:1;S=[i-l,s+l]}else S=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,o,n,i){const r=Te(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(y,this.getY),o=t-e,n=C?0:o>0?o*p.extentPadding:1;S=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!O&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&(S[0]>o&&(S[0]=o),o>S[1]&&(S[1]=o)),Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n))}const e=S[1]-S[0],t=C?0:e>0?e*p.extentPadding:1,o=null===(g=p.yExtent)||void 0===g?void 0:g[0],n=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=o?S[0]:S[0]-t,null!=n?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||C||(S[0]=null!=o?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const j="streaming"===p.runtimeMode,M=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(_=p.arrowOfTime)||"down"===_?"y":"x")){const t="right"===p.arrowOfTime?[M,e.width-M]:[e.width-M,M];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-M,M])}}else{const t="down"===p.arrowOfTime?[M,e.height-M]:[e.height-M,M];this.scales={x:k().domain(S).range([M,e.width-M]),y:k().domain(x).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)};this.scales={x:t(p.xScaleType,x,[M,e.width-M]),y:t(p.yScaleType,S,[e.height-M,M])}}var _;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Rt.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(o).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(o):k().domain(t).range(o)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,n,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var o,n,i,r,s,a,l;const{config:c,scales:d}=this;if(!d)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},u={data:t,scales:d,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(n=c.themeSemantic)&&void 0!==n?n:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var o,n;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!==(n=null===(o=c.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==n?n:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const u={scales:d,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:o,aggregate:r}=_t(e.ribbons);if(r.length>0&&i.push(...Pt(e,t,r)),o.length>0)for(const t of n)i.push(...Lt(e,t.data,t.key,o))}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=Ne(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return Nt(e,n,i),i}(u,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=_t(e.ribbons);if(r.length>0&&n.push(...Pt(e,t,r)),i.length>0)for(const t of o)n.push(...Lt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=Be(t.data,e.scales,e.getX,e.getY,i,o,t.key,r),a=$t(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),n.push(s)}return Nt(e,o,n),n}(u,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=_t(e.ribbons);if(r.length>0&&n.push(...Pt(e,t,r)),i.length>0)for(const t of o)n.push(...Lt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=Be(t.data,e.scales,e.getX,e.getY,r,o,t.key,s),a=$t(e.config.gradientFill);a&&(i.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=Ne(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return Nt(e,o,n),n}(u,t);case"stackedarea":return function(e,t){var o,n,i,r;const s=e.groupData(t),a=null!==(o=e.config.stackOrder)&&void 0!==o?o:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const o of s){let n=0;for(const t of o.data){const o=e.getX(t),i=e.getY(t);Number.isFinite(o)&&Number.isFinite(i)&&(n+=i)}t.set(o.key,n)}const o=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(n.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else if("desc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else{const e=[...s].sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)}),r=[],a=[];let l=0,c=0;for(const o of e)c>l?(r.push(o),l+=null!==(n=t.get(o.key))&&void 0!==n?n:0):(a.push(o),c+=null!==(i=t.get(o.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,d=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:u,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const d=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&d.add(t)}const u=Array.from(d).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of u){let o=0;for(const n of e)o+=(null===(l=h.get(n.key))||void 0===l?void 0:l.get(t))||0;g.set(t,o||1)}}const f=$e(u,e.map(e=>e.key),(e,t)=>{var o;return(null===(o=h.get(e))||void 0===o?void 0:o.get(t))||0},a),p=[],y=new Map,m=new Map;for(const e of u)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const o of e){const e=h.get(o.key),n=[],a=[],l=new Map;for(const o of u){let i=e.get(o)||0;const s=m.get(o);r&&(i/=g.get(o));const c=s+i,d=t.x(o);a.push([d,t.y(s)]),n.push([d,t.y(c)]),m.set(o,c),l.set(o,c)}y.set(o.key,l);const c={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,c,d),g=u;if(e.config.pointStyle){const t=new WeakMap;for(const o of s){const n=h.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=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};Nt(e,s,g,o)}return g}(u,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,d=Ee(o,e.scales,e.getX,e.getY,r,t,c);d&&n.push(d)}return n}(u,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n: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=Re(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[d,u]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(u-d||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-d)/f),s-1),u=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>u)continue;const g=u*s+l;m[g]++;const y=c(n);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=o.width/s,A=o.height/a,S=e.config.showValues,O=e.config.heatmapValueFormat,C=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===m[n])continue;let i;switch(l){case"sum":i=v[n];break;case"mean":i=v[n]/m[n];break;default:i=m[n]}const r=(i-b)/k;C.push(He(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:m[n],sum:v[n],xCenter:d+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return C}(e,t,o);if(0===t.length)return[];const n=Re(e.config.valueAccessor,"value"),i=Fe(e.config.xAccessor,"x"),r=Fe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=i(o),d=r(o);l[e]=n,c[e]=d,s.has(n)||s.set(n,s.size),a.has(d)||a.set(d,a.size)}const d=s.size,u=a.size;if(0===d||0===u)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[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 o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const u=n(o),h=r*d+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=u,v[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Et?e:"blues";let o=Dt.get(t);if(o)return o;o=Array(256);const n=Et[t]||Xe;for(let e=0;256>e;e++)o[e]=n(e/255);return Dt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=o.width/d,C=o.height/u,j=e.config.showValues,M=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const o=y[e],n=o%d;_.push(He(n*O,(u-1-(o-n)/d)*C,O,C,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:M}:void 0))}return _}(u,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(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 o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.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(),d=e.config.barStyle,u=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==d?void 0:d.gap,g="number"!=typeof h||0>h?1:h,f={};(null==d?void 0:d.stroke)&&(f.stroke=d.stroke),"number"==typeof(null==d?void 0:d.strokeWidth)&&(f.strokeWidth=d.strokeWidth),"number"==typeof(null==d?void 0:d.opacity)&&(f.opacity=d.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==d?void 0:d.fill)||u||"#4e79a7";s.push(De(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(De(v,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==d?void 0:d.fill)||u||"#007bff"},f),{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)}}(u,t);return this._barCategoryCache=null!==(l=u.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},d=null!==(o=c.radius)&&void 0!==o?o:3,u=null!==(r=null!==(n=c.fill)&&void 0!==n?n: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,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=u;if(e.getCategory){const t=e.getCategory(o);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:d,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(u,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const d=[],u=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return d;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=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 n=g[t],i=e.getX(n),r=e.getY(n),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=u.x(i),c=0!==a?u.x(i+a):l+o.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=u.y(x),S=u.y(s),O=Math.min(A,S),C=Math.abs(A-S),j={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(j.opacity=b),d.push(De(k,O,w,C,j,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return d}(u,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;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",d=i?a:s.wickColor||"#333",u=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!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:d,wickWidth:u,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(u,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=xt(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=xt(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=xt(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=xt(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){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;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=kt(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=kt(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-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,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],d=Ct(e,c,l);d&&("point"===c.type?o.set(d,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(d,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(d,{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?o.set(d,{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?n.set(d,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&n.set(d,{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,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=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=Ct(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:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o: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,o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,_,P,L,T,N,B,$,E,D,H,I,R,F,W,z,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],P=Ct(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]];X=!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]];X=!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}),X=!0;continue}const L=n.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!==(d=r.style.opacity)&&void 0!==d?d: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!==(u=L.r)&&void 0!==u?u:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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!==(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!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!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,X=!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}),X=!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!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S: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!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,X=!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}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const n={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};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={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};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==(N=t.opacity)&&void 0!==N?N:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==($=t.h)&&void 0!==$?$:0,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(D=t.w)&&void 0!==D?D:0,h:null!==(H=t.h)&&void 0!==H?H:0,fill:"#999",datum:null,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(R=t.openY)&&void 0!==R?R:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(W=t.highY)&&void 0!==W?W:n,lowY:null!==(z=t.lowY)&&void 0!==z?z:n,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};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:Ot(),duration:q}),o}(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},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const d=At(e,o.activeTransition),u=wt(d,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==e._targetR&&void 0!==o.r&&(e.r=St(o.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==o.w&&(e.w=St(o.w,e._targetW,u)),void 0!==o.h&&(e.h=St(o.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),e.y=St(o.y,e._targetY,u),void 0!==o.w&&(e.w=St(o.w,e._targetW,u)),void 0!==o.h&&(e.h=St(o.h,e._targetH,u))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=St(o.x,e._targetX,u),void 0!==o.openY&&(e.openY=St(o.openY,e._targetOpenY,u)),void 0!==o.closeY&&(e.closeY=St(o.closeY,e._targetCloseY,u)),void 0!==o.highY&&(e.highY=St(o.highY,e._targetHighY,u)),void 0!==o.lowY&&(e.lowY=St(o.lowY,e._targetLowY,u))}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:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=St(t[n][0],o[n][0],u),e.path[n][1]=St(t[n][1],o[n][1],u)}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:St(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=St(t[o][0],n[o][0],u),e.topPath[o][1]=St(t[o][1],n[o][1],u);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(o[t][0],i[t][0],u),e.bottomPath[t][1]=St(o[t][1],i[t][1],u)}}if(d>=1){for(const e of o.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 o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.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,o}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 o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}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 o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.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 o=(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)||ft;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Rt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}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]),o=this.getPointId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);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 o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(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,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!Ie(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),d=l||!Ie(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||d)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Re(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Re(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Re(this.config.xAccessor,"x"),this.getY=Re(this.config.yAccessor,"y")),d&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=It(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!Ie(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?We(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!Ie(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?We(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!Ie(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Re(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!Ie(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!Ie(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Re(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!Ie(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=It(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!Ie(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?We(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!Ie(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Ie(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Ie(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Ie(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Re(this.config.openAccessor,"open"):void 0,this.getHigh=Re(this.config.highAccessor,"high"),this.getLow=Re(this.config.lowAccessor,"low"),this.getClose=t?Re(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Ft(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:n.createElement(n.Fragment,null,...t)}function Wt(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function zt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Yt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Gt(e,t){const o=Yt(e);if(!o)return!1;const n=Yt(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function qt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Xt(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let d=null,u=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-o,a=Math.sqrt(r*r+s*s);zt(e.r,n)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}Rt.GROUP_COLOR_MAP_CAP=1e3,Rt.QUADTREE_THRESHOLD=500;const Vt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ut=new WeakMap;let Kt=0,Qt=!1,Zt=null,Jt=null,eo=null;function to(e,t){var o,n;if(!t)return t;const i=Vt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(Qt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Qt=!0;const e=()=>{Kt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Zt=new MutationObserver(e),Zt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Jt=window.matchMedia("(prefers-color-scheme: dark)"),eo=e,"function"==typeof Jt.addEventListener?Jt.addEventListener("change",eo):"function"==typeof Jt.addListener&&Jt.addListener(eo)}catch(e){}}();let s=Ut.get(r);s&&s.version===Kt||(s={version:Kt,map:new Map},Ut.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}function oo(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)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 no(e){switch(e){case"monotoneX":return $;case"monotoneY":return B;case"cardinal":return N;case"catmullRom":return T;case"step":return L;case"stepBefore":return P;case"stepAfter":return _;case"basis":return M;case"natural":return j;default:return null}}function io(e,t,o){return null==t?o:"string"!=typeof t?t:to(e,t)||o}function ro(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,l)),u=e.createLinearGradient(n,i,r,s),[h,g,f]=oo(e,o);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function so(e,t,o,n,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 a=e.createLinearGradient(o,n,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const ao=new WeakMap;function lo(e,t){const o=no(t);if(!o)return e;const n=ao.get(e);if(n)return n;const i=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let i=null;const r={moveTo(e,t){i=[e,t],n.push([e,t])},lineTo(e,t){i=[e,t],n.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void n.push([a,l]);const[c,d]=i;for(let i=1;o>=i;i++){const u=i/o,h=1-u;n.push([h*h*h*c+3*h*h*u*e+3*h*u*u*r+u*u*u*a,h*h*h*d+3*h*h*u*t+3*h*u*u*s+u*u*u*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return E().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return ao.set(e,i),i}function co(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Xt(i,t,o,n,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=ho(r,t,o,n);break;case"line":e=go(r,t,o,n);break;case"rect":if(null==r.datum)break;e=po(r,t,o);break;case"heatcell":e=yo(r,t,o);break;case"area":if(!1===r.interactive)break;e=vo(r,t,o);break;case"candlestick":e=mo(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function uo(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=bo(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+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 ho(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>zt(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function go(e,t,o,n=30){var i,r;if(0===e.path.length)return null;const s=bo(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let n=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=fo(t,o,i,r,a,l);n>c&&(n=c)}c=n}else{const e=t-a,n=o-l;c=Math.sqrt(e*e+n*n)}const d=e.style,u=null!==(r=null!==(i=d.strokeWidth)&&void 0!==i?i:d.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,u/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function fo(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const d=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-d,2))}function po(e,t,o){const n=Wt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function yo(e,t,o){const n=Wt(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function mo(e,t,o){const n=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function vo(e,t,o){if(0===e.topPath.length)return null;const n=bo(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function bo(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function xo(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.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(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.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===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}function ko(e,t){var o,n;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!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}function wo(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);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=o.groups.indexOf(n);return o.groups.length-1>e?Ao(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Ao(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function Ao(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function So(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Oo(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function Co(e,t,o,n,i,r){s(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,d=l-a.lastIngestTime>c;d!==i&&(r(d),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,i,n])}const jo={fill:(t,o)=>e("rect",{style:t,width:o,height:o}),line:(t,o)=>e("line",{style:t,x1:0,y1:0,x2:o,y2:o})};function Mo(e,t,o,n,i){let r;return r="function"==typeof o?o(e):(0,jo[o])(n(e,t),i),r}function _o({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Po(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Lo=(o,n,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=o,y=[];let m=0;const v=!(!n&&!i),b="isolate"===u||void 0===u&&null!=s,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((o,u)=>{const h=Mo(o,u,g,f,x),A=Po(o,r,s),S=s&&s.size>0&&s.has(o.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?S||!1:void 0,"aria-current":v&&!b&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const o=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{d(c,u),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*o.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&e(_o,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+u)),m+=w}),y};function To({config:o,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=o,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+n.useId();if("horizontal"===i){const o=12,n=Math.min(r,200),i=Math.max(0,(r-n)/2),c=[];for(let t=0;64>=t;t++){const o=t/64;c.push(e("stop",{offset:100*o+"%",stopColor:s(a[0]+o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:n,height:o,fill:`url(#${u})`,rx:2}),e("text",{x:i,y:o+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),e("text",{x:i+n,y:o+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const o=t/64;h.push(e("stop",{offset:100*o+"%",stopColor:s(a[1]-o*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function No(o){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:g="vertical",legendLayout:f}=o,p=function(e){var t,o,n,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(o=null==e?void 0:e.rowHeight)&&void 0!==o?o:22);return{swatchSize:s,labelGap:Math.max(0,null!==(n=null==e?void 0:e.labelGap)&&void 0!==n?n:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=n.useState(0),[v,b]=n.useState(0),x=n.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===g?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:o,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:Lo(t,n,i,r,s,a,l,f,c,d,u)},"legend-group-"+f)),h+=t.items.length*u.rowHeight+8}),g})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:o,height:n,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];o.forEach((o,n)=>{var f;let m=0;o.label&&(m+=16);const v=((o,n,i,r,s,a,l,c,d,u,h,g)=>{const{type:f="fill",styleFn:p,items:y}=o,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!n&&!i),S="isolate"===u||void 0===u&&null!=s,O=y.map(e=>v+b+7*e.label.length),C=[];let j=0,M=0;O.forEach((e,t)=>{const o=0===M?e:M+x+e;g&&g>0&&M>0&&o>g?(C.push({start:j,end:t,width:M}),j=t,M=e):M=o}),y.length>0&&C.push({start:j,end:y.length,width:M}),C.forEach((o,u)=>{let h="center"===w?Math.max(0,((null!=g?g:o.width)-o.width)/2):"end"===w?Math.max(0,(null!=g?g:o.width)-o.width):0;for(let g=o.start;o.end>g;g++){const o=y[g],w=Mo(o,g,f,p,v),C=Po(o,r,s),j=s&&s.size>0&&s.has(o.label);m.push(t("g",{transform:`translate(${h},${u*k})`,onClick:n?()=>n(o):void 0,onMouseEnter:i?()=>i(o):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===a&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?j||!1:void 0,"aria-current":A&&!S&&null!=r&&o.label===r||void 0,"aria-label":o.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(o)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const o=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;d(c,o);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[o];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:A?e=>{d(c,g),i&&i(o);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*o.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,j&&e(_o,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label})]},"legend-item-"+g)),h+=O[g]+x}});const _=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:_,totalRows:P,totalHeight:P*k}})(o,r,s,a,l,c,d,n,u,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:o.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=o[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,o[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!s);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==d&&""!==d&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:u/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:d}),k]})}function Bo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function $o(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Eo(t){var o;const{legend:n,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!n)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(o=null==l?void 0:l.maxWidth)&&void 0!==o?o:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:$o(n)?e(To,{config:n.gradient,orientation:p?"horizontal":"vertical",width:m}):Bo(n)?e(No,{legendGroups:n.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):n})}function Do(e){return"string"==typeof e?{type:e}:e}function Ho({orient:o,config:n,values:i,scale:s,size:a,length:l}){const c=function(e){var t,o,n,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),d="top"===o||"bottom"===o,u=r(()=>{if(0===i.length)return null;const n=s.domain(),r=a-8;if("boxplot"===c.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!n)return null;const{q1:a,median:l,q3:u,whiskerLow:h,whiskerHigh:g}=n,f=Math.min(.5*r,20),p=(r-f)/2+4;if(d){const n=s(a),i=s(u),r=s(l),d=s(h),y=s(g),m="top"===o?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:d,y1:v+m*(p+f/2),x2:y,y2:v+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:d,y1:v+m*p,x2:d,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(n,i),y:"top"===o?v-p-f:v+p,width:Math.abs(i-n),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===o?v-p-f:v+p,x2:r,y2:"top"===o?v-p:v+p+f,stroke:c.fill,strokeWidth:2})]})}{const n=s(a),i=s(u),r=s(l),d=s(h),y=s(g),m="left"===o?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+o,children:[e("line",{x1:v+m*(p+f/2),y1:d,x2:v+m*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:d,x2:v+m*(p+f),y2:d,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===o?v-p-f:v+p,y:Math.min(n,i),width:f,height:Math.abs(i-n),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===o?v-p-f:v+p,y1:r,x2:"left"===o?v-p:v+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const u=F().domain(n).thresholds(c.bins)(i);if(0===u.length)return null;const h=Math.max(...u.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+o,children:u.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(d){const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:r,y:"top"===o?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}{const r=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===o?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},n)}})});if("violin"===c.type){const t=r/2+4,n=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=s((e.x0+e.x1)/2);n.push(d?`${a},${"top"===o?-(t-i):t-i}`:`${"left"===o?-(t-i):t-i},${a}`)}for(let e=u.length-1;e>=0;e--){const i=u[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),l=s((i.x0+i.x1)/2);n.push(d?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+o,children:e("polygon",{points:n.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(d){const e=0,n=null!=u[0].x0?s(u[0].x0):0;t.push(`M${n},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===o?-n-4:n+4}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,n=null!=u[0].x0?s(u[0].x0):0;t.push(`M${e},${n}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const n=e.length/h*r,i=s((e.x0+e.x1)/2);t.push(`L${"left"===o?-n-4:n+4},${i}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+o,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,a,l,o,d,4]);return u?e("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:u}):null}function Io(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Ro(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Fo(o,n,i,r){if(!o)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=o;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(n)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>n?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>n?"end":"start";const p=16,y=a?u?[a]:Io(a,d):[],m=s?u?[s]:Io(s,d):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,o)=>e("tspan",{x:v,dy:0===o?0:p,children:t},o))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:m.map((t,o)=>e("tspan",{x:v,dy:0===o?0:p,children:t},o))},"annotation-note-label"));let w=null;if((a||s)&&(0!==n||0!==i))if("topBottom"===h){const t=Math.min(d,120);let o=0,n=t;"end"===f?(o=-t,n=0):"middle"===f&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let o=0,n=t;"bottom"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${n},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Wo(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e("path",{d:Ro((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function zo(t,o,n,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,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),d=e/2,u=n/2,h=t*u>o*d?d/t:u/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:a})}function Yo(e){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:d,type:u,color:h,className:g,disable:f,events:p={},"data-testid":y}=e,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-o),null!=a&&(b=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===v&&0===b)if(void 0!==d.width){v=d.width/2;const e=d.depth||30;b=e+(0>e?-5:5)}else if(void 0!==d.height){const e=d.depth||30;v=e+(0>e?-5:5),b=d.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":y},p,{children:[!m.has("connector")&&zo(v,b,c,h,x,d),!m.has("subject")&&Wo(x,d,h,o,n),!m.has("note")&&Fo(l,v,b,h)]}))}function Go(t){var o,n;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!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e(Yo,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Yo,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function qo(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n: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 Xo(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n: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 Vo(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,d=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||!d)return null;const u=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==u||null==h?null:{x:c(u),y:d(h)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=qo(e,o),c=Xo(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Uo(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ko={linear:H,monotoneX:$,monotoneY:B,step:L,stepAfter:_,stepBefore:P,basis:M,cardinal:N,catmullRom:T};function Qo(o){return function(o,n,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,_,P,L,T,N,B,$,E,I,R,F,W,z,Y,G,q,X,V,K,Q,Z,J,ee,te;switch(o.type){case"label":{const t=Vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Uo(r,s,i)?e(Go,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"label",connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"callout":{const t=Vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return Uo(r,s,i)?e(Go,{noteData:{x:r,y:s,dx:o.dx||30,dy:o.dy||-30,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"callout-circle",subject:{radius:o.radius||12},connector:o.connector||{end:"arrow"},color:o.color}},"ann-"+n):null}case"x-threshold":{const r=qo(null!=o.value?Object.assign(Object.assign({},o),{x:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"y-threshold":{const r=Xo(null!=o.value?Object.assign(Object.assign({},o),{y:o.value}):o,i);if(null==r)return null;const s=o.color||"#f97316",a=o.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:o.strokeWidth||1.5,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:o.label})]},"ann-"+n)}case"enclose":{const r=(o.coordinates||[]).map(e=>({x:qo(Object.assign(Object.assign({},e),{type:"point"}),i),y:Xo(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=U(r),a=o.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"rect-enclose":{const r=(o.coordinates||[]).map(e=>({x:qo(Object.assign(Object.assign({},e),{type:"point"}),i),y:Xo(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=o.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:u,width:d-c,height:h-u,fill:o.fill||"none",fillOpacity:o.fillOpacity||.1,stroke:o.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),o.label&&e("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:o.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:o.label})]},"ann-"+n)}case"highlight":{const t=i.data||[],r="function"==typeof o.filter?t.filter(o.filter):o.field&&null!=o.value?t.filter(e=>e[o.field]===o.value):[],s={stroke:o.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,n)=>{const r=qo(t,i),a=Xo(t,i);if(null==r||null==a)return null;const l="function"==typeof o.r?o.r(t):o.r||6,c="function"==typeof o.style?o.style(t):o.style||s;return e("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+n)})},"ann-"+n)}case"bracket":{const t=qo(o,i),r=Xo(o,i);return e(Go,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:o.dx||0,dy:o.dy||0,note:{label:o.label,title:o.title,wrap:o.wrap||120},type:"bracket",subject:{type:o.bracketType||"curly",width:o.width,height:o.height,depth:o.depth||30},color:o.color}},"ann-"+n)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?g:null,v=p?f:null;let b;const x=[],k=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const o=t+"";k.has(o)||(k.set(o,x.length),x.push(o))}b=h.map(e=>{const t=e[m],o=e[v];if(null==t||null==o)return null;const n=k.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,A=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(d=i.scales)||void 0===d?void 0:d.value;if(!w||!A)return null;const S=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(x.length-1,o+1),i=t-o,r=e(x[o]);return r+(e(x[n])-r)*i},O=w,C=A;let j;if(p)if(y){const e=S(C);j=(t,o)=>[O(o),e(t)]}else{const e=S(O);j=(t,o)=>[e(t),C(o)]}else j=(e,t)=>[O(e),C(t)];const M=o.method||"linear";let _;_="loess"===M?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===d){a.push([t,r[e]]);continue}const p=d*g-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*f-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(b,null!==(u=o.bandwidth)&&void 0!==u?u:.3):("polynomial"===M?ne.polynomial(b,{order:o.order||2}):ne.linear(b)).points;const P=_.map(([e,t])=>{const[o,n]=j(e,t);return`${o},${n}`}).join(" "),L=o.color||"#6366f1",T=_[_.length-1],[N,B]=j(T[0],T[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray||"6,3"}),o.label&&e("text",{x:N+4,y:B-4,fill:L,fontSize:11,children:o.label})]},"ann-"+n)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=i.scales)||void 0===f?void 0:f.value,s=null!==(p=null==r?void 0:r(o.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(o.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:o.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:o.fillOpacity||.1}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:o.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:o.label})]},"ann-"+n)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=o.upperAccessor||"upperBounds",d=o.lowerAccessor||"lowerBounds",u=o.filter,h=r.filter(e=>null!=e[c]&&null!=e[d]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ko[i.curve||"linear"]||H,f=D().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=o.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(A=o.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),o.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:o.label})]},"ann-"+n)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(O=null===(S=i.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(C=i.scales)||void 0===C?void 0:C.time,l=null!==(M=null===(j=i.scales)||void 0===j?void 0:j.y)&&void 0!==M?M:null===(_=i.scales)||void 0===_?void 0:_.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const d=c.reduce((e,t)=>e+t,0)/c.length,u=c.reduce((e,t)=>e+Math.pow(t-d,2),0)/c.length,h=Math.sqrt(u),g=null!==(P=o.threshold)&&void 0!==P?P:2,f=d-g*h,p=!1!==o.showBand,y=o.fill||"#6366f1",m=null!==(L=o.fillOpacity)&&void 0!==L?L:.1,v=o.anomalyColor||"#ef4444",b=null!==(T=o.anomalyRadius)&&void 0!==T?T:6,x=l(d+g*h),k=l(f),w=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,o)=>{const n=qo(t,i),r=Xo(t,i);return null==n||null==r?null:e("circle",{cx:n,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+o)}),o.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:o.label})]},"ann-"+n)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(B=null===(N=i.scales)||void 0===N?void 0:N.x)&&void 0!==B?B:null===($=i.scales)||void 0===$?void 0:$.time,c=null!==(I=null===(E=i.scales)||void 0===E?void 0:E.y)&&void 0!==I?I:null===(R=i.scales)||void 0===R?void 0:R.value;if(!l||!c)return null;const d=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>d.length)return null;let u;if("polynomial"===(o.method||"linear")){const e=ne.polynomial(d,{order:o.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=d.length;let t=0,o=0,n=0,i=0;for(const[e,r]of d)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const h=d.length,g=d.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=d.reduce((e,t)=>e+t[0],0)/h,y=d.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(F=o.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(W=o.steps)&&void 0!==W?W:5,x=d[h-1][0],k=(x-d[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=u(e),o=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),C=`${l(x)},${c(u(x))}`,j=o.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:o.fill||"#6366f1",fillOpacity:null!==(z=o.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e("polyline",{points:`${C} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(Y=o.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(G=o.strokeDasharray)&&void 0!==G?G:"6,3"}),o.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:o.label})]},"ann-"+n)}case"widget":{let t=null,r=null;if(null!=o.px&&null!=o.py)t=o.px,r=o.py;else{const e=Vo(o,n,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!Uo(t,r,i))return null;const s=null!==(q=o.dx)&&void 0!==q?q:0,a=null!==(X=o.dy)&&void 0!==X?X:0,l=null!==(V=o.width)&&void 0!==V?V:32,c=null!==(K=o.height)&&void 0!==K?K:32,d=null!==(Q=o.content)&&void 0!==Q?Q:e("span",{style:{fontSize:18,cursor:"default"},title:o.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+n)}case"text":{const t=Vo(o,n,i);if(!t)return null;const{x:r,y:s}=t;return e("text",{x:r+(o.dx||0),y:s+(o.dy||0),fill:o.color||"var(--semiotic-text, #333)",fontSize:o.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:o.label},"ann-text-"+n)}case"category-highlight":{const r=o.category;if(null==r)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(Z=i.scales)||void 0===Z?void 0:Z.o,l=null===(J=i.scales)||void 0===J?void 0:J.x,c=null===(ee=i.scales)||void 0===ee?void 0:ee.y,d=s(a)?a:s(l)?l:s(c)?c:null;if(!d)return null;const u=d(r+"");if(null==u)return null;const h=d.bandwidth(),g=o.color||"var(--semiotic-primary, #4589ff)",f=null!==(te=o.opacity)&&void 0!==te?te:.15,p=o.label;return t("g",(i.projection?"vertical"===i.projection:d===l)?{children:[e("rect",{x:u,y:0,width:h,height:i.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:u+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:u+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}}}let Zo={positions:new Map};const Jo=new Set;function en(){for(const e of Jo)e()}function tn(e,t){const o=Zo.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Zo.positions);n.delete(e),Zo={positions:n},en()}function on(e,t){const o=Zo.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(Zo.positions);n.delete(e),Zo={positions:n},en()}function nn(){return Zo}function rn(e){return Jo.add(e),()=>Jo.delete(e)}const sn={positions:new Map};function an(){return()=>{}}function ln(){return sn}function cn(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],i=o[o.length-1],r=n instanceof Date,s=n instanceof Date?n.getTime():n,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=r?new Date(o):o}return c}(e,t):e.ticks(t)}function dn(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function un(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function hn(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function gn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function fn(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function pn(o){const{width:n,height:i,totalWidth:s,totalHeight:a,margin:l,scales:c,showAxes:d,axes:u,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=o,y=r(()=>{var e,t;if(!c)return[];const o=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==o?void 0:o.tickFormat)||g||yn,r=Math.max(2,Math.floor(n/70)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,a=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:cn(c.x,"exact"===p?Math.max(2,s):Math.min(s,r),p),l=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=d.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 mn(d,Math.max(55,h+8))},[c,u,g,n,p]),m=r(()=>{var e,t;if(!c)return[];const o=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||f||yn,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;return mn((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:cn(c.y,"exact"===p?Math.max(2,s):Math.min(s,r),p)).map(e=>({value:e,pixel:c.y(e),label:n(e)})),22)},[c,u,f,i,p]),v=h&&c,b=d&&c;if(!v&&!b)return null;const x=null==u?void 0:u.find(e=>"bottom"===e.orient),k=null==u?void 0:u.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),S=(null==x?void 0:x.jaggedBase)||!1,O=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var o,r;const s=gn(null===(o=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),a=gn(null===(r=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+o)),m.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"ygrid-"+o))]})})(),w&&!S&&e("line",{x1:0,y1:i,x2:n,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:fn("bottom",n,i),fill:"none",stroke:C,strokeWidth:1}),A&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:fn("left",n,i),fill:"none",stroke:C,strokeWidth:1})]})})}function yn(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function mn(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function vn(n){var a,l;const{width:d,height:u,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:O,legend:C,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:P,legendPosition:L="right",legendLayout:T,foregroundGraphics:N,marginalGraphics:B,xValues:$,yValues:E,annotations:D,svgAnnotationRules:H,xAccessor:I,yAccessor:R,annotationData:F,pointNodes:W,curve:z,underlayRendered:Y,canvasObscuresUnderlay:G=!0,linkedCrosshairName:q,linkedCrosshairSourceId:X,children:V}=n,U=r(()=>{var e,t;if(!y||!p)return[];const o=null==m?void 0:m.find(e=>"bottom"===e.orient),n=(null==o?void 0:o.tickFormat)||k||yn,i=Math.max(2,Math.floor(d/70)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,s=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:cn(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),a=s.map(e=>e.valueOf()),l=s.map((e,t)=>({value:e,pixel:p.x(e),label:n(e,t,a)})),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),u=(null==o?void 0:o.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=mn(l,u);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==o?void 0:o.includeMax)&&h.length>0&&"exact"!==A&&!(null==o?void 0:o.tickValues)){const e=p.x.domain()[1],t=p.x(e),o=h[h.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,h.length,a);u>t-o&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,d,A]),K=r(()=>{var e,t;if(!y||!p)return[];const o=null==m?void 0:m.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||w||yn,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;let s=mn((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:cn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:n(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==o?void 0:o.includeMax)&&s.length>0&&"exact"!==A&&!(null==o?void 0:o.tickValues)){const e=p.y.domain()[1],t=p.y(e),o=s[s.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[y,p,m,w,u,A]),Q=r(()=>{var e,t;if(!y||!p)return[];const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o)return[];const n=o.tickFormat||w||yn,i=Math.max(2,Math.floor(u/30)),r=null!==(e=o.ticks)&&void 0!==e?e:5;return mn((null!==(t=o.tickValues)&&void 0!==t?t:cn(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:n(e)})),22)},[y,p,m,w,u,A]),Z=i(new Map),J=i(null!==(a=null==D?void 0:D.length)&&void 0!==a?a:0),ee=null!==(l=null==D?void 0:D.length)&&void 0!==l?l:0;J.current!==ee&&(J.current=ee,Z.current=new Map);const te=r(()=>{if(!D||0===D.length)return null;const e=Qo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:I,yAccessor:R,width:d,height:u,data:F,frameType:"xy",pointNodes:W,curve:z,stickyPositionCache:Z.current};return D.map((o,n)=>{if(H){const i=H(o,n,t);return null!=i?i:e(o,n,t)}return e(o,n,t)}).filter(Boolean)},[D,H,d,u,I,R,F,p,W,z]),oe=function(e){var t;const o=c(e?rn:an,e?nn:ln,e?nn:ln);return e&&null!==(t=o.positions.get(e))&&void 0!==t?t:null}(q);return s(()=>{if(!(null==oe?void 0:oe.locked)||!q)return;const e=e=>{"Escape"===e.key&&on(q)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,q]),y||O||C||N||B||te&&te.length>0||S||V||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!Y||G)&&(()=>{var o,n;const i=gn(null===(o=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===o?void 0:o.gridStyle),r=gn(null===(n=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return t("g",{className:"stream-grid",children:[U.map((t,o)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+o)),K.map((t,o)=>e("line",{x1:0,y1:t.pixel,x2:d,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),y&&p&&(()=>{const o=null==m?void 0:m.find(e=>"left"===e.orient),n=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!o||!1!==o.baseline,r=!n||!1!==n.baseline,s=(null==o?void 0:o.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==o?void 0:o.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==n?void 0:n.autoRotate)&&U.length>1&&(()=>{const e=d/Math.max(U.length-1,1),t=U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==n?void 0:n.tickAnchor,O=null==o?void 0:o.tickAnchor,C=hn(U),j=hn(K);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!Y||G)&&r&&!a&&e("line",{x1:0,y1:u,x2:d,y2:u,stroke:h,strokeWidth:1}),(!Y||G)&&a&&e("path",{d:fn("bottom",d,u),fill:"none",stroke:h,strokeWidth:1}),U.map((o,n)=>{const i=!!l&&("function"==typeof l?l(o.value,n):Gt(o.value,n>0?U[n-1].value:void 0));return t("g",{transform:`translate(${o.pixel},${u})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:y?10:18,textAnchor:y?"end":dn(S,o.pixel===C.min,o.pixel===C.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:o.label})})]},"xtick-"+n)}),v&&e("text",{x:d/2,y:u+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!Y||G)&&i&&!s&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:h,strokeWidth:1}),(!Y||G)&&s&&e("path",{d:fn("left",d,u),fill:"none",stroke:h,strokeWidth:1}),K.map((o,n)=>{const i=!!c&&("function"==typeof c?c(o.value,n):Gt(o.value,n>0?K[n-1].value:void 0));return t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:un(O,o.pixel===j.min,o.pixel===j.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:o.label})})]},"ytick-"+n)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-f.left,y:u/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-f.left}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o||0===Q.length)return null;const n=!1!==o.baseline,i=o.landmarkTicks,r=o.label||x,s=o.tickAnchor,a=hn(Q);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e("line",{x1:d,y1:0,x2:d,y2:u,stroke:h,strokeWidth:1}),Q.map((o,n)=>{const r=!!i&&("function"==typeof i?i(o.value,n):Gt(o.value,n>0?Q[n-1].value:void 0));return t("g",{transform:`translate(${d},${o.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:8,textAnchor:"start",dominantBaseline:un(s,o.pixel===a.min,o.pixel===a.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:o.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:o.label})})]},"ytick-r-"+n)}),r&&e("text",{x:d+f.right-15,y:u/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${d+f.right-15}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),te,B&&p&&$&&E&&t(o,{children:[B.top&&e("g",{transform:"translate(0, 0)",children:e(Ho,{orient:"top",config:Do(B.top),values:$,scale:p.x,size:f.top,length:d})}),B.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(Ho,{orient:"bottom",config:Do(B.bottom),values:$,scale:p.x,size:f.bottom,length:d})}),B.left&&e("g",{transform:"translate(0, 0)",children:e(Ho,{orient:"left",config:Do(B.left),values:E,scale:p.y,size:f.left,length:u})}),B.right&&e("g",{transform:`translate(${d}, 0)`,children:e(Ho,{orient:"right",config:Do(B.right),values:E,scale:p.y,size:f.right,length:u})})]}),N,oe&&oe.sourceId!==X&&(null==p?void 0:p.x)&&(()=>{const t=p.x(oe.xValue);if(null==t||0>t||t>d)return null;const o=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),V]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof O?O:null}),Eo({legend:C,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:O,legendLayout:T,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:P})]}):null}function bn(e){var t,o,n,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(o=e.tr)&&void 0!==o?o:0)>0||(null!==(n=e.br)&&void 0!==n?n:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function xn(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(null!=e?e:0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}const kn=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function wn(e){var t,o;const{innerRadius:n,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=n;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=kn(i,r),t=kn(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=kn(i,r),t=kn(i,s),o=kn(n,s),l=kn(n,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${o.x},${o.y} A${n},${n} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(o=e.cornerRadius)&&void 0!==o?o:0,(i-n)/2));if(0===l)return wn(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),d=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,n+l))),u=s-r,h=e.roundStart&&e.roundEnd?u/2:u,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return wn(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?d:0),v=s-(f?d:0),b=kn(i,p),x=kn(i,y),k=(i-l)*Math.cos(c),w=kn(k,r),A=kn(k,s),S=a?null:kn(n,v),O=a?null:kn(n,m),C=a?0:(n+l)*Math.cos(d),j=a?null:kn(C,r),M=a?null:kn(C,s),_=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${w.x},${w.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=kn(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=kn(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${M.x},${M.y}`,L+=` A${l},${l} 0 0 1 ${S.x},${S.y}`;else{const e=kn(n,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${n},${n} 0 ${P} 0 ${O.x},${O.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=kn(n,r);L+=` A${n},${n} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function An(e){const t=wn({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let i=0;n.length>i;i++)o.push({d:wn({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:n[i]})}return{clipPath:t,slices:o}}const Sn={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function On(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Cn(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const jn="undefined"==typeof window||"undefined"==typeof document,Mn="undefined"!=typeof window?h:s;function _n(){const[e,t]=u(!1);return Mn(()=>{t(!0)},[]),e}const Pn=()=>()=>{},Ln=()=>!1,Tn=()=>!0;function Nn(){const e=c(Pn,Ln,Tn);return i(e).current}function Bn(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:a,cleanup:l}=e;Mn(()=>{var e,i;t&&o&&(null===(i=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,o]);const c=i(l);c.current=l,s(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function $n(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Dn(e,t);if(!Hn(e)||!Hn(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!Dn(o,i))return!1}else{if(!Hn(o)||!Hn(i))return!1;if(!En(o,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function En(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Dn(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Hn(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 In=n.createContext(null);function Rn({children:t}){const[o,i]=n.useState(!1),r=n.useMemo(()=>({visible:o,setVisible:i}),[o]);return e(In.Provider,{value:r,children:t})}function Fn(){return n.useContext(In)}const Wn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],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(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}function Yn(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const Gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},qn="semiotic-accessible-data-table",Xn=qn+" semiotic-accessible-data-table-hidden",Vn=qn+" semiotic-accessible-data-table-visible",Un=Vn+" semiotic-accessible-data-table-network",Kn={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Qn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Zn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Jn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ei={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},ti={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},oi={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function ni({scene:o,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=n.useState(!1),d=Fn(),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=n.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=n.useCallback(()=>{l||u||c(!0)},[l,u]),y=n.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!o||0===o.length)return r?e("span",{id:r,tabIndex:-1,style:Wn}):null;if(!h)return e("div",{id:r,className:Xn,tabIndex:-1,onFocus:p,style:Wn,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",o.length," elements)"]})});const m=function(e){var t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const C=[];if(!Array.isArray(e))return C;for(const j of e)if(j&&"object"==typeof j&&null!==j.datum)try{switch(j.type){case"point":C.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&C.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let o=0;e.length>o&&t.length>o;o++){const t=e[o];Array.isArray(t)&&C.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;C.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":C.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":C.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=j.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=j.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":C.push({label:"Node",values:{id:null!==(h=null===(u=j.datum)||void 0===u?void 0:u.id)&&void 0!==h?h:"",x:null!==(g=j.cx)&&void 0!==g?g:j.x,y:null!==(f=j.cy)&&void 0!==f?f:j.y}});break;case"arc":C.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":C.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":C.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=j.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return C}(o),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];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 o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),b=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Gn(e.min)} to ${Gn(e.max)}, mean ${Gn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,v),x=m.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:g,id:r,className:Vn,tabIndex:-1,onBlur:y,style:Kn,role:"region","aria-label":f,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Zn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Qn,children:b}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Jn,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:oi,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:ei,children:"type"}),w.map(t=>e("th",{style:ei,children:t},t))]})}),e("tbody",{children:x.map((o,n)=>t("tr",{children:[e("td",{style:ti,children:o.label}),w.map(t=>{return e("td",{style:ti,children:(n=o.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Gn(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},n))})]})]})}function ii({nodes:o,edges:i,chartType:r,tableId:s,chartTitle:a}){var l,c,d,u,h,g,f,p,y,m,v,b,x,k;const[w,A]=n.useState(!1),S=Fn(),O=null!==(l=null==S?void 0:S.visible)&&void 0!==l&&l,C=w||O,j=a?"Data summary for "+a:s?`Data summary for ${r} ${s}`:"Data summary for "+r,M=n.useRef(null),_=n.useCallback(()=>{w||O||A(!0)},[w,O]),P=n.useCallback(e=>{var t;O||(null===(t=M.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[O]);if(!o||0===o.length)return s?e("span",{id:s,tabIndex:-1,style:Wn}):null;if(!C)return e("div",{id:s,className:Xn,tabIndex:-1,onFocus:_,style:Wn,role:"region","aria-label":j,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",o.length," nodes, ",i.length," edges)"]})});const L=Array.isArray(o)?o:[],T=Array.isArray(i)?i:[],N=new Map,B=new Map,$=new Map,E=new Map;for(const e of T){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,o="object"==typeof t.source?null===(d=t.source)||void 0===d?void 0:d.id:t.source,n="object"==typeof t.target?null===(u=t.target)||void 0===u?void 0:u.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";B.set(e,(null!==(h=B.get(e))&&void 0!==h?h:0)+1),E.set(e,(null!==(g=E.get(e))&&void 0!==g?g:0)+i)}if(null!=n&&""!==n){const e=n+"";N.set(e,(null!==(f=N.get(e))&&void 0!==f?f:0)+1),$.set(e,(null!==(p=$.get(e))&&void 0!==p?p:0)+i)}}const D=[];for(let e=0;L.length>e;e++){const t=L[e];if(!t||"object"!=typeof t)continue;const o=null!==(m=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==m?m:t.id,n=null!=o?o+"":"node-"+e,i=null!==(v=N.get(n))&&void 0!==v?v:0,r=null!==(b=B.get(n))&&void 0!==b?b:0,s=null!==(x=$.get(n))&&void 0!==x?x:0,a=null!==(k=E.get(n))&&void 0!==k?k:0;D.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}D.sort((e,t)=>t.degree-e.degree);let H=0,I=0;if(D.length>0){let e=0;for(const t of D)e+=t.degree,t.degree>I&&(I=t.degree);H=e/D.length}const R=T.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),F=[`${D.length} nodes, ${T.length} edges.`];D.length>0&&F.push(`Mean degree: ${Gn(H)}, max degree: ${I}.`);const W=D.slice(0,5);return t("div",{ref:M,id:s,className:Un,tabIndex:-1,onBlur:P,style:Kn,role:"region","aria-label":j,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{O&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Zn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Qn,children:F.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:Jn,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:oi,children:["Top ",W.length," of ",D.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:ei,children:"id"}),e("th",{style:ei,children:"degree"}),e("th",{style:ei,children:"in"}),e("th",{style:ei,children:"out"}),R&&e("th",{style:ei,children:"w. degree"}),R&&e("th",{style:ei,children:"w. in"}),R&&e("th",{style:ei,children:"w. out"})]})}),e("tbody",{children:W.map((o,n)=>t("tr",{children:[e("td",{style:ti,children:o.id}),e("td",{style:ti,children:o.degree}),e("td",{style:ti,children:o.inDeg}),e("td",{style:ti,children:o.outDeg}),R&&e("td",{style:ti,children:Gn(o.wDegree)}),R&&e("td",{style:ti,children:Gn(o.wInDeg)}),R&&e("td",{style:ti,children:Gn(o.wOutDeg)})]},n))})]})]})}function ri({summary:t}){return t?e("div",{role:"note",style:Wn,children:t}):null}function si({tableId:t}){return e("a",{href:"#"+t,style:Wn,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.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,Wn)},children:"Skip to data table"})}function ai({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Wn,children:o})}const li="var(--semiotic-focus, #005fcc)";function ci({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let d;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);d=e("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:li,strokeWidth:2,strokeDasharray:"4,2"})}else d=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:li,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:li,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function di(e){return Array.isArray(e)?e[0]:e}function ui(e,t,o,n){return Object.assign({data:di(e),x:t,y:o,__semioticHoverData:!0},n)}const hi={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 gi(e,t){return"function"==typeof t?t(e):e[t]}function fi(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 pi(o={}){const{fields:n,title:i,format:r,style:s={},className:a=""}=o;return o=>{if(!o||"object"!=typeof o)return null;let l;const c=[];if(i){const e=gi(o,i);l=fi(e,r)}if(n&&n.length>0)n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=gi(o,n);c.push({label:t,value:fi(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==o[t]){l=fi(o[t],r);break}if(!l){const e=Object.keys(o).filter(e=>!e.startsWith("_"));e.length>0&&(l=fi(o[e[0]],r))}}const d=Object.assign(Object.assign({},hi),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:d,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,o)=>t("div",{style:{marginTop:0===o&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},o))]})}}function yi(o={}){const{fields:n=[],title:i,format:r,style:s={},className:a="",showLabels:l=!0,separator:c=": "}=o;return o=>{if(!o||"object"!=typeof o)return null;const d=[];if(i){const e=gi(o,i);d.push({value:fi(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let t,n,i;"string"==typeof e?(t=e,n=e,i=r):(t=e.label,n=e.accessor||e.key||"",i=e.format||r);const s=fi(gi(o,n),i);d.push({label:l?t:void 0,value:s})}):Object.keys(o).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{d.push({label:l?e:void 0,value:fi(o[e],r)})});const u=Object.assign(Object.assign({},hi),s);return Array.isArray(d)&&0!==d.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u,children:d.map((e,o)=>t("div",{style:{marginBottom:d.length-1>o?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},o))}):null}}function mi(){return o=>{var n,i,r,s,a,l,c;const d=o.allSeries;if(!d||0===d.length){const t=null!==(i=null===(n=o.data)||void 0===n?void 0:n.value)&&void 0!==i?i:null===(r=o.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:hi,children:e("div",{children:fi(t)})})}const u=null!==(l=null!==(s=o.xValue)&&void 0!==s?s:null===(a=o.data)||void 0===a?void 0:a.time)&&void 0!==l?l:null===(c=o.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:hi,children:[null!=u&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:fi(u)}),d.map((o,n)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:o.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:fi(o.value)})]},n))]})}}function vi(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=di(!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!==(n=t.data)&&void 0!==n?n:{}:t),r=o(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:hi,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?pi(t):pi())}}function bi({x:t,y:o,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(t)&&Number.isFinite(o),u=n.useRef(null),[h,g]=n.useState(null);n.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>o?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!n.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if("string"==typeof o.className&&o.className.trim().length>0)return!0;const i=o.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=p?null:hi;return d?e("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+o,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function xi(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}function ki(e,t,o){const n=i(null),[r,a]=u(null);return s(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;a(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return i.observe(e),()=>i.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}const wi="undefined"==typeof window?s:h;function Ai(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Si(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),xi(e,e=>t(e.matches))},[]),e}(),o=i(t);o.current=t;const[a,c]=ki(e.sizeProp,e.responsiveWidth,e.responsiveHeight),d=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-d.left-d.right,g=c[1]-d.top-d.bottom,f=Ai(e.foregroundGraphics,c,d),p=Ai(e.backgroundGraphics,c,d),y=_e(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);s(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),C=i(0),j=l(()=>{C.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),M=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),_=l(()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),S.current()},[]);s(()=>()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return wi(()=>{P&&(Kt++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:a,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:M,onPointerLeave:_}}function Oi(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,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(n,0,0,n,0,0),i.translate(o.left,o.top),i}function Ci(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ji(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function Mi(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const _i=(e,t,o,n)=>{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,n.width*l,n.height),e.clip());const c=a.style.stroke||"#007bff",d=to(e,c)||c,u=a.style.strokeWidth||2,h=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=u,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const m=null!==(i=a.style.opacity)&&void 0!==i?i:1;Mi(e,a.path,d,u,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=no(a.curve),p=h&&h.length>0&&g&&g.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!p){e.strokeStyle=d;const v=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function C(){S&&(e.stroke(),S=!1)}for(let j=0;a.path.length>j;j++){const[M,_]=a.path[j],P=g[j],L=ji(P,h,d);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,_);else{const T=[];for(const N of h){const B=N.value;(w>B||B>P)&&(B>w||P>B)||w===B||P===B||T.push({t:(B-w)/(P-w)})}T.sort((e,t)=>e.t-t.t);for(const $ of T){const D=x+(M-x)*$.t,H=k+(_-k)*$.t,I=ji(w+(P-w)*Math.min($.t+1e-4,1),h,d);e.lineTo(D,H),C(),O(I,D,H)}e.lineTo(M,_)}x=M,k=_,w=P,A=L}else O(L,M,_),x=M,k=_,w=P,A=L}C()}else{e.beginPath();const R=a.strokeGradient&&a.path.length>=2?so(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=R||d,f)E().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[F,W]=a.path[0];e.moveTo(F,W);for(let z=1;a.path.length>z;z++)e.lineTo(a.path[z][0],a.path[z][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=io(e,a.style.fill,a.style.fill),f&&!p)E().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[G,q]=a.path[0];e.moveTo(G,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Pi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Li(e,t,o=.3){Pi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Ti(e,t,o=.6){var n,i,r,s,a;if(!Pi(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,d=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,u=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(d,u,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function Ni(e,t,o,n=.35){Pi(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Bi(e,t){const o=no(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=D().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const $i=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,n.width*a,n.height),e.clip());const l=io(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1])*o,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.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1]),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.stroke()}e.globalAlpha=1;continue}const d=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Bi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=ro(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,o,0,n);e.fillStyle=i||l,e.globalAlpha=d}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*d,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Bi(e,t),Ni(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const o=t.strokeGradient&&t.topPath.length>=2?so(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=no(t.curve);if(e.beginPath(),n)E().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 o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),o&&e.restore(),e.globalAlpha=1}},Ei=(e,t,o,n)=>{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 o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=io(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=io(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Ti(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Di(e,t){const{x:o,y:n,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=xn(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+i-a,n),a>0&&e.arcTo(o+i,n,o+i,n+a,a),e.lineTo(o+i,n+r-l),l>0&&e.arcTo(o+i,n+r,o+i-l,n+r,l),e.lineTo(o+c,n+r),c>0&&e.arcTo(o,n+r,o,n+r-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function Hi(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 Ii=(e,t,o,n)=>{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)Ri(e,t);else if(t.cornerRadii&&bn(t.cornerRadii)){const o=io(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),n=Hi(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,Di(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=io(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),n=Hi(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=io(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),n=Hi(t),i=t.fillGradient&&"string"==typeof o?ro(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Li(e,t),e.globalAlpha=1}};function Ri(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;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+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}function Fi(e){const[t,o,n]=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*o+.114*n>128?"#000":"#fff"}function Wi(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const zi=(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=to(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Li(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):Wi(t.value),n=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=Fi(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},Yi=(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;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=to(e,t.wickColor)||t.wickColor,c=60>n.height,d=c?Math.max(t.wickWidth,2):t.wickWidth,u=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=d,e.stroke()};if(c||u(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=to(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&u(),e.restore()}};function Gi(e,t){if(!t)return[];const o=new Set,n=[];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+"";o.has(r)||(o.add(r),n.push(r))}return n}function qi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function Xi(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function Vi(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let i=!1;const r=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),r=t.fn&&t.key&&!(t.key in o);if(!n&&!r)return o;i=!0;const s=Object.assign({},o);return n&&(s[e.key]=e.fn(o)),r&&(s[t.key]=t.fn(o)),s});return i?r:n}}const Ui=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ki(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${Ui[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${Ui[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Qi={line:[$i,_i,Ei],area:[$i,Ei],stackedarea:[$i,Ei],scatter:[Ei],bubble:[Ei],heatmap:[zi],bar:[Ii],swarm:[Ei],waterfall:[(e,t,o,n)=>{var i;Ii(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,a=null==s?void 0:s._connectorStroke;if(a){e.save(),e.strokeStyle=to(e,a)||a,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=o.y(s.cumEnd),c=n.x+n.w,d=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(d,l),e.stroke()}e.restore()}}],candlestick:[Yi],mixed:[$i,_i,Ei],custom:[$i,Ii,zi,_i,Ei,Yi]},Zi={top:20,right:20,bottom:30,left:40},Ji={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 er(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const tr={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 or({hover:o}){var n,i,r;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",a=null!==(n=o.data)&&void 0!==n?n:{},l=null!==(i=a.y)&&void 0!==i?i:a.value,c=null!==(r=a.x)&&void 0!==r?r:a.time;return t("div",{className:"semiotic-tooltip",style:tr,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e("div",{style:{opacity:.7,fontSize:11},children:s(c)})]})}or.ownsChrome=!0;const nr=g(function(o,a){var c,d,h,g,y,m,v,b,x,k,w,A,S;const{chartType:O,runtimeMode:C,data:j,chunkThreshold:M,chunkSize:_,xAccessor:P,yAccessor:L,colorAccessor:T,sizeAccessor:N,groupAccessor:B,lineDataAccessor:$,curve:E,normalize:D,baseline:H,stackOrder:I,binSize:R,valueAccessor:F,arrowOfTime:W="right",windowMode:z="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Q=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:oe,lineStyle:ne,pointStyle:ie,areaStyle:re,barStyle:se,waterfallStyle:ae,swarmStyle:le,barColors:ce,colorScheme:de,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:ye,lineGradient:be,areaGroups:xe,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,showAxes:je=!0,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:Te,yFormat:Ne,axisExtent:Be,tickFormatTime:$e,tickFormatValue:Ee,hoverAnnotation:De,tooltipContent:He,customHoverBehavior:Ie,customClickBehavior:Re,enableHover:Fe,hoverRadius:We=30,tooltipMode:ze,annotations:Ye,svgAnnotationRules:Ge,showGrid:qe,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Je,legendCategoryAccessor:et,onCategoriesChange:tt,backgroundGraphics:ot,foregroundGraphics:nt,canvasPreRenderers:it,svgPreRenderers:rt,title:st,categoryAccessor:at,brush:lt,onBrush:ct,decay:dt,pulse:ut,transition:ht,animate:gt,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,marginalGraphics:xt,pointIdAccessor:kt,xScaleType:wt,yScaleType:At,accessibleTable:St=!0,description:Ot,summary:Ct,linkedCrosshairName:jt,linkedCrosshairSourceId:Mt,customLayout:_t,layoutConfig:Pt}=o,Lt=f().replace(/:/g,""),Nt=i(!1),Bt=Si({sizeProp:Q,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:Zi,animate:gt,transitionProp:ht,themeDirtyRef:Nt}),$t=_n(),Et=Nn(),{reducedMotionRef:Dt,responsiveRef:Ht,size:It,currentTheme:Wt,transition:zt,introEnabled:Yt,tableId:Gt,rafRef:qt,renderFnRef:Xt,scheduleRender:Vt}=Bt;let Ut=Bt.margin;if(xt){const e=60,t=Object.assign({},Bt.margin);xt.top&&e>t.top&&(t.top=e),xt.bottom&&e>t.bottom&&(t.bottom=e),xt.left&&e>t.left&&(t.left=e),xt.right&&e>t.right&&(t.right=e),Ut=t}const Kt="function"==typeof nt?nt({size:It,margin:Ut}):nt,Qt="function"==typeof ot?ot({size:It,margin:Ut}):ot,Zt=It[0]-Ut.left-Ut.right,Jt=It[1]-Ut.top-Ut.bottom,eo=r(()=>me(j),[j]),oo=null!=De?De:Fe,no=i(null),io=i(null),[ro,so]=u(0),[ao,ho]=u(null),go=i(null),fo=i(null),[po,yo]=u(null),mo=i(Ji.primary),vo=i([]),Ao=i(et),So=i(tt);Ao.current=et,So.current=tt;const[jo,Mo]=u(!1),[_o,Po]=u([]),[Lo,To]=u([]),No="streaming"===C||["bar","swarm","waterfall"].includes(O),Bo=r(()=>{var e,t,o;return{chartType:O,runtimeMode:No?"streaming":"bounded",windowSize:Y,windowMode:z,arrowOfTime:No?W:"right",extentPadding:V,scalePadding:U,axisExtent:Be,xAccessor:P,yAccessor:L,timeAccessor:No?G:void 0,valueAccessor:F,colorAccessor:T,sizeAccessor:N,groupAccessor:B||($?"_lineGroup":void 0),categoryAccessor:at,lineDataAccessor:$,xScaleType:wt,yScaleType:At,xExtent:q,yExtent:X,sizeRange:K,binSize:R,normalize:D,baseline:H,stackOrder:I,boundsAccessor:ue,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:!0===ye?{topOpacity:.8,bottomOpacity:.05}:!1===ye?void 0:ye,areaGroups:xe?new Set(xe):void 0,lineGradient:be,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,lineStyle:ne,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:ae,colorScheme:de,barColors:ce,barStyle:se,annotations:Ye,decay:dt,pulse:ut,transition:zt,introAnimation:Yt,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:vt,heatmapValueFormat:bt,pointIdAccessor:kt,curve:E,themeCategorical:null===(e=null==Wt?void 0:Wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Wt),themeSequential:null===(t=null==Wt?void 0:Wt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Wt?void 0:Wt.colors)||void 0===o?void 0:o.diverging,customLayout:_t,layoutConfig:Pt,layoutMargin:Ut}},[O,Y,z,W,V,U,Be,P,L,G,F,wt,At,T,N,B,at,$,q,X,K,R,D,H,I,ue,he,ge,fe,ye,be,xe,we,Ae,Se,Oe,Ce,ne,ie,re,le,ae,se,de,ce,Ye,dt,ut,null==zt?void 0:zt.duration,null==zt?void 0:zt.easing,Yt,ft,pt,yt,mt,vt,bt,No,kt,E,Wt,_t,Pt,Ut]),$o=$n(Bo),Eo=i(null);Eo.current||(Eo.current=new Rt($o));const Do=l(()=>{var e,t;const o=Ao.current,n=So.current;if(!n||!o)return;const i=Gi(null!==(t=null===(e=Eo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);qi(i,vo.current)||(vo.current=i,n(i))},[]);s(()=>{var e;null===(e=Eo.current)||void 0===e||e.updateConfig($o),Nt.current=!0,Vt()},[$o,Vt]);const Ho=i(null);Ho.current||(Ho.current=new ve(e=>{const t=Eo.current;t&&t.ingest(e)&&(Nt.current=!0,Vt())},{chunkThreshold:M,chunkSize:_})),s(()=>{var e;null===(e=Ho.current)||void 0===e||e.updateChunkOptions({chunkThreshold:M,chunkSize:_})},[M,_]);const Io=l(e=>{var t;null===(t=Ho.current)||void 0===t||t.push(e)},[]),Ro=l(e=>{var t;null===(t=Ho.current)||void 0===t||t.pushMany(e)},[]),Fo=l(()=>{var e,t;null===(e=Ho.current)||void 0===e||e.clear(),null===(t=Eo.current)||void 0===t||t.clear(),Nt.current=!0,Vt()},[Vt]);p(a,()=>({push:Io,pushMany:Ro,remove:e=>{var t,o,n;null===(t=Ho.current)||void 0===t||t.flush();const i=null!==(n=null===(o=Eo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(go.current&&i.some(e=>{var t;return e===(null===(t=go.current)||void 0===t?void 0:t.data)})&&(go.current=null,yo(null)),Nt.current=!0,Vt()),i},update:(e,t)=>{var o,n,i;null===(o=Ho.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Eo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,Vt()),r},clear:Fo,getData:()=>{var e,t,o;return null===(e=Ho.current)||void 0===e||e.flush(),null!==(o=null===(t=Eo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Eo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Eo.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Io,Ro,Fo,Vt]),s(()=>{var e,t;if(j){if($&&eo.length>0&&"object"==typeof eo[0]&&null!==eo[0]){const t="string"==typeof $?$:"coordinates";if(Array.isArray(eo[0][t])){const o=[];for(const e of eo){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=Ho.current)||void 0===e||e.setBoundedData(o))}}null===(t=Ho.current)||void 0===t||t.setBoundedData(eo)}},[j,eo,$]);const{hoverHandlerRef:Wo,hoverLeaveRef:zo,onPointerMove:Yo,onPointerLeave:Go}=Bt;Wo.current=e=>{var t,o;if(!oo)return;const n=no.current;if(!n)return;const i=n.getBoundingClientRect(),r=e.clientX-i.left-Ut.left,s=e.clientY-i.top-Ut.top;if(0>r||r>Zt||0>s||s>Jt)return void(go.current&&(go.current=null,fo.current=null,yo(null),Ie&&(Ie(null),Nt.current=!0),Vt()));const a=Eo.current;if(!a||0===a.scene.length)return;const l=co(a.scene,r,s,We,a.quadtree,a.maxPointRadius),c="multi"===ze,d=()=>{go.current&&(go.current=null,fo.current=null,yo(null),Ie&&Ie(null),Vt())};if(!l&&!c)return void d();const u=c||!l?r:l.x,h=c||!l?s:l.y;let g=ui((null==l?void 0:l.datum)?Tt(l.datum,a.resolvedRibbons):{},u,h);if(c&&a.scene.length>0&&a.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=uo(lo(e.path,e.curve),t,o);if(null===r)continue;const s=bo(e.path,t);n.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=lo(e.topPath,e.curve),s=lo(e.bottomPath,e.curve),a=uo(r,t,o);if(null===a)continue;const l=uo(s,t,o),c=bo(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l: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 n}(a.scene,u,Math.max(We,Zt));if(e.length>0){const t=a.scales.y.invert,o=a.scales.x.invert,n=mo.current,i=o?o(u):u;if(l)g.xValue=i,g.xPx=u;else{const e={xValue:i};"string"==typeof P&&(e[P]=i),g=ui(e,u,h,{xValue:i,xPx:u})}g.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Tt(e.datum,a.resolvedRibbons)}})}}l||(null===(t=g.allSeries)||void 0===t?void 0:t.length)?(go.current=g,fo.current=null!==(o=null==l?void 0:l.node)&&void 0!==o?o:null,yo(g),Ie&&(Ie(g),Nt.current=!0),Vt()):d()},zo.current=()=>{go.current&&(go.current=null,fo.current=null,yo(null),Ie&&(Ie(null),Nt.current=!0),Vt())};const qo=i(()=>{});qo.current=e=>{if(!Re)return;const t=no.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Ut.left,i=e.clientY-o.top-Ut.top;if(0>n||n>Zt||0>i||i>Jt)return void Re(null);const r=Eo.current;if(!r||0===r.scene.length)return void Re(null);const s=co(r.scene,n,i,We,r.quadtree,r.maxPointRadius);Re(s?ui(s.datum||{},s.x,s.y):null)};const Xo=l(e=>qo.current(e),[]),Vo=i(-1),Uo=i(null),Ko=i(null),Qo=l(e=>{const t=Eo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Ko.current&&Ko.current.version===o)n=Ko.current.graph;else{const e=function(e){var t,o,n;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,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,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++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});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!==(n=r.group)&&void 0!==n?n:"_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;n=xo(e),Ko.current={version:o,graph:n}}const i=Vo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Vo.current=0;const o=n.flat[0];Uo.current={shape:o.shape,w:o.w,h:o.h};const i=Oo(Object.assign(Object.assign({},o),{datum:Tt(o.datum,t.resolvedRibbons)}));return go.current=i,yo(i),Ie&&Ie(i),void Vt()}const r=ko(n,i),s=wo(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return Vo.current=-1,Uo.current=null,go.current=null,fo.current=null,yo(null),Ie&&Ie(null),void Vt();Vo.current=s;const a=n.flat[s];Uo.current={shape:a.shape,w:a.w,h:a.h};const l=Oo(Object.assign(Object.assign({},a),{datum:Tt(a.datum,t.resolvedRibbons)}));go.current=l,yo(l),Ie&&Ie(l),Vt()},[Ie,Vt]),Zo=l(e=>{Vo.current=-1,Uo.current=null,Yo(e)},[Yo]);Xt.current=()=>{var e,t;qt.current=0;const o=no.current,n=io.current;if(!o||!n)return;const i=Eo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Dt.current?r+1e6:r),a=!Dt.current&&s,l=Nt.current||s;l&&!a&&(i.computeScene({width:Zt,height:Jt}),Do());const c=Ci(),d=function(e){if(!e)return Ji;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||Ji.axisStroke,tickText:s||Ji.tickText,crosshair:s?er(s,"66"):Ji.crosshair,hoverFill:c?er(c,"4D"):Ji.hoverFill,hoverStroke:s?er(s,"99"):Ji.hoverStroke,pointRing:c||Ji.pointRing,primary:r||Ji.primary}:Ji}(o);mo.current=d.primary;const u=null!==(e=null==ft?void 0:ft.threshold)&&void 0!==e?e:5e3,h=ft&&i.lastIngestTime>0&&r-i.lastIngestTime>u;if(l){const e=Oi(o,It,Ut,c);if(e){if(e.clearRect(-Ut.left,-Ut.top,It[0],It[1]),h&&(e.globalAlpha=null!==(t=null==ft?void 0:ft.dimOpacity)&&void 0!==t?t:.5),"transparent"!==oe&&!ot){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=oe||(t&&"transparent"!==t?t:null),i=n?to(e,n):null;i&&(e.fillStyle=i,e.fillRect(-Ut.left,-Ut.top,It[0],It[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Zt,Jt),e.clip()),it&&i.scales)for(const t of it)e.save(),t(e,i.scene,i.scales,{width:Zt,height:Jt}),e.restore();const n=_t?Qi.custom:Qi[O];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:Zt,height:Jt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Oi(n,It,Ut,c);if(e&&(e.clearRect(-Ut.left,-Ut.top,It[0],It[1]),oo&&go.current&&i.scales&&function(e,t,o,n,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,d=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const u="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?d:t.x,0),e.lineTo(c?d:t.x,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,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(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=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 o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,go.current,Zt,Jt,"object"==typeof oo?oo:{},fo.current,d),fo.current&&Array.isArray(De))){const t=De.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s="group"in o?o.group:void 0;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,fo.current,t,d)}}l&&o&&o.setAttribute("aria-label",zn(i.scene,O+" chart"));const g=Nt.current;if(Nt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!ao||e(ao.x.domain()[0])!==e(i.scales.x.domain()[0])||e(ao.x.domain()[1])!==e(i.scales.x.domain()[1])||e(ao.y.domain()[0])!==e(i.scales.y.domain()[0])||e(ao.y.domain()[1])!==e(i.scales.y.domain()[1])||ao.x.range()[0]!==i.scales.x.range()[0]||ao.x.range()[1]!==i.scales.x.range()[1]||ao.y.range()[0]!==i.scales.y.range()[0]||ao.y.range()[1]!==i.scales.y.range()[1])&&ho(i.scales),xt){const e=i.getData(),t="function"==typeof P?P:e=>e[P||"x"],o="function"==typeof L?L:e=>e[L||"y"];Po(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),To(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ye&&Ye.length>0&&so(e=>e+1),(null==ft?void 0:ft.showBadge)&&Mo(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(qt.current=requestAnimationFrame(()=>Xt.current()))},Bn({hydrated:$t,wasHydratingFromSSR:Et,storeRef:Eo,dirtyRef:Nt,renderFnRef:Xt,cleanup:()=>{var e;return null===(e=Ho.current)||void 0===e?void 0:e.clear()}}),s(()=>{Nt.current=!0,Vt()},[O,Zt,Jt,je,oe,ne,it,Vt]),Co(ft,Eo,Nt,Vt,jo,Mo);const Jo=r(()=>{if(Te||$e)return;const e=Eo.current;return(null==e?void 0:e.xIsDate)&&ao?Ki(ao.x.domain()):void 0},[Te,$e,ao]),en=Te||$e||Jo,tn=oo&&po?He?He(po):e(or,{hover:po}):null,on=tn?e(bi,{x:po.x,y:po.y,containerWidth:Zt,containerHeight:Jt,margin:Ut,className:"stream-frame-tooltip",children:tn}):null,nn=Uo.current,rn=e(ci,{active:Vo.current>=0,hoverPoint:po,margin:Ut,size:It,shape:null==nn?void 0:nn.shape,width:null==nn?void 0:nn.w,height:null==nn?void 0:nn.h}),sn=Xi(P,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),an=Xi(L,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),ln=sn.key,cn=an.key,dn=Vi(sn,an,Ye&&Ye.length>0||!1);if(jn||!$t&&Et){const o=Eo.current;o&&j&&(o.ingest({inserts:eo,bounded:!0}),o.computeScene({width:Zt,height:Jt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(d=null==o?void 0:o.scales)&&void 0!==d?d:null,s=en||(()=>{if((null==o?void 0:o.xIsDate)&&r)return Ki(r.x.domain())})();return t("div",{ref:Ht,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":Ot||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:Z?"100%":It[0],height:J?"100%":It[1]},children:[e(ri,{summary:Ct}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:It[0],height:It[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Ut.left},${Ut.top})`,children:Qt}),t("g",{transform:`translate(${Ut.left},${Ut.top})`,children:[oe&&e("rect",{x:0,y:0,width:Zt,height:Jt,fill:oe}),rt&&r&&rt.map((t,o)=>e(n.Fragment,{children:t(i,r,{width:Zt,height:Jt})},"svgpre-"+o)),i.map((o,n)=>function(o,n,i){var r,s,a,l,c;switch(o.type){case"line":{const t=o;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+n)}case"area":{const c=o;if(0===c.topPath.length)return null;const d=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const o=`${i?i+"-":""}area-clip-${n}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:o,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:d,fill:On(c.style.fill),fillOpacity:null!==(s=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==s?s:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${o})`})]},"area-"+n)}return e("path",{d:d,fill:On(c.style.fill),fillOpacity:null!==(l=null!==(a=c.style.fillOpacity)&&void 0!==a?a:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+n)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:On(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+n)}case"rect":{const t=o;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:On(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+n)}case"heatcell":{const i=o;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const o=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,s,a]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(i.fill),l=.299*r+.587*s+.114*a>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:o})]},"heatcell-"+n)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+n)}case"candlestick":{const i=o,r=Math.min(i.openY,i.closeY),s=Math.max(Math.abs(i.openY-i.closeY),1),a=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:s,fill:a,stroke:a,strokeWidth:1})]},"candle-"+n)}default:return null}}(o,n,Lt)).filter(Boolean)]})]}),e(vn,{width:Zt,height:Jt,totalWidth:It[0],totalHeight:It[1],margin:Ut,scales:r,showAxes:je,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:s,yFormat:Ne||Ee,axisExtent:Be,showGrid:qe,title:st,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Je,foregroundGraphics:Ft(Kt,null===(h=Eo.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:xt,xValues:[],yValues:[],annotations:Ye,svgAnnotationRules:Ge,annotationFrame:0,xAccessor:ln,yAccessor:cn,annotationData:dn(null==o?void 0:o.getData()),pointNodes:null==o?void 0:o.scene.filter(e=>"point"===e.type),curve:"string"==typeof E?E:void 0,linkedCrosshairName:jt,linkedCrosshairSourceId:Mt})]})}return t("div",{ref:Ht,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":Ot||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":It[0],height:J?"100%":It[1],overflow:"visible"},onKeyDown:Qo,children:[St&&e(si,{tableId:Gt}),St&&e(ni,{scene:null!==(y=null===(g=Eo.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:Gt,chartTitle:"string"==typeof st?st:void 0}),e(ri,{summary:Ct}),t("div",{role:"img","aria-label":Ot||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:oo?Zo:void 0,onMouseLeave:oo?Go:void 0,onClick:Re?Xo:void 0,children:[Qt&&e("svg",{style:{position:"absolute",left:0,top:0,width:It[0],height:It[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Ut.left},${Ut.top})`,children:Qt})}),e(pn,{width:Zt,height:Jt,totalWidth:It[0],totalHeight:It[1],margin:Ut,scales:ao,showAxes:je,axes:Me,showGrid:qe,xFormat:en,yFormat:Ne||Ee,axisExtent:Be}),e("canvas",{ref:no,"aria-label":zn(null!==(v=null===(m=Eo.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:io,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(ai,{hoverPoint:po}),e(vn,{width:Zt,height:Jt,totalWidth:It[0],totalHeight:It[1],margin:Ut,scales:ao,showAxes:je,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:en,yFormat:Ne||Ee,axisExtent:Be,showGrid:qe,title:st,legend:Xe,legendHoverBehavior:Ve,legendClickBehavior:Ue,legendHighlightedCategory:Ke,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Je,foregroundGraphics:Ft(Kt,null===(b=Eo.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:xt,xValues:_o,yValues:Lo,annotations:Ye,svgAnnotationRules:Ge,annotationFrame:ro,xAccessor:ln,yAccessor:cn,annotationData:dn(null===(x=Eo.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=Eo.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof E?E:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==oe&&!ot,linkedCrosshairName:jt,linkedCrosshairSourceId:Mt}),(lt||ct)&&e(pe,{width:Zt,height:Jt,totalWidth:It[0],totalHeight:It[1],margin:Ut,dimension:null!==(w=null==lt?void 0:lt.dimension)&&void 0!==w?w:"xy",scales:ao,onBrush:null!=ct?ct:()=>{},binSize:R,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(A=null==lt?void 0:lt.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=Eo.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===C}),(null==ft?void 0:ft.showBadge)&&e("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:jo?"#dc3545":"#28a745",color:"white"}),children:jo?"STALE":"LIVE"}),rn,on]})]})});function ir(e,t){var o;const{columns:n,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,d=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,u=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(n),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!g&&h.length>1&&(null!==(o=i.cornerRadius)&&void 0!==o?o:0)>0;for(let e=0;h.length>e;e++){const t=h[e],o=t.pieceData[0],n="number"==typeof(null==o?void 0:o._pctStart)?o._pctStart:t.pctStart,u=c+n*d,g=c+(n+("number"==typeof(null==o?void 0:o._pct)?o._pct:t.pct))*d,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:u,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==o?void 0:o._nonInteractive)?null:t.pieceData,category:t.name});(null==o?void 0:o._roundedEnds)?v.roundedEnds=o._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==o?void 0:o._gradientBand)&&(v._gradientBand=o._gradientBand),s.push(v)}return s}function rr(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=W(e,.25))&&void 0!==t?t:r,median:null!==(o=W(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=W(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function sr(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function ar(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}nr.displayName="StreamXYFrame";const lr={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:d}=e,{r:u,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=d(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=u(0>a?i:n+a),o=0>a?u(i+a)-u(i):u(n)-u(n+a);g.push(De(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=u(0>a?i+a:n),o=0>a?u(i)-u(i+a):u(n+a)-u(n);g.push(De(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(u){const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(De(r,Math.min(a,u),n,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),u=l(c);d.push(De(Math.min(a,u),r,Math.abs(u-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of d){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=u?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return d},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:d}=i,u=[],h="vertical"===d,g="radial"===d,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),d=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=d(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return u},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),d=r(n,e.name),u=d.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:u,style:d,datum:n})}}return l},pie:ir,donut:ir,boxplot:function(e,t){var o,n,i,r,s,a;const{scales:l,columns:c,config:d,getR:u,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,m=!1!==d.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],d=l[l.length-1],f=null!==(o=W(l,.25))&&void 0!==o?o:c,v=null!==(n=W(l,.5))&&void 0!==n?n:(c+d)/2,b=null!==(i=W(l,.75))&&void 0!==i?i:d,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>w>=e))&&void 0!==s?s:d,O=h(t.pieceData[0],t.name),C=[];if(m)for(const e of t.pieceData){const o=u(e);if(k>o||o>w){const n=y?t.middle:g(o),i=y?g(o):t.middle;C.push({px:n,py:i,value:o,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:C}),m)for(const t of C)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:d,projection:u}=r,h=[],g="vertical"===u,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,u=Array(f).fill(0);for(const e of t)u[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...u,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const o=d(r+(t+.5)*a);v+=` L ${e.middle+u[t]/y*m} ${o}`}v+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const o=d(r+(t+.5)*a);v+=` L ${e.middle-u[t]/y*m} ${o}`}v+=" Z"}else{v=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*m}`;v+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const a=null!==(o=W(t,.25))&&void 0!==o?o:r,l=null!==(n=W(t,.5))&&void 0!==n?n:(r+s)/2,c=null!==(i=W(t,.75))&&void 0!==i?i:s;x={q1Pos:d(a),medianPos:d(l),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:rr(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],d=r.bins||25,u=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/d||1,r=Array(d).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),d-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===r[t])continue;const n=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(De(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,d=[],u=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],i=t[t.length-1],r=(i-n)/u||1,c=Array(u).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(n)} ${t}`;for(let e=0;u>e;e++)m+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(n)}`;for(let e=0;u>e;e++){const o=l(n+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${o}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};d.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:rr(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,d=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(De(o,e.x,i-o,e.width,d,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(De(e.x,o,e.width,i-o,d,t,e.name))}}return l},funnel:function(e,t){var o,n,i,r,s,a,l,c;const{columns:d,getR:u,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===m.length)return f;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let o=0;for(const n of e.pieceData){const e=h?h(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),x||o>A&&(A=o)}if(x)for(const e of w){let t=0,o=0;for(let n=0;v.length>n;n++){const i=e.groups.get(v[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return f;const S=new Map;for(const e of v){const t=w[0].groups.get(e);S.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,C=x?.95*p:.9*t.width,j=k().domain([0,A]).range([0,C]),M=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let _=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,d=0===t,u=n.width,h=.55*u,m=n.x+(u-h)/2,b=new Map;if(x){let e=0;for(const t of v){const n=o.groups.get(t);n&&(e+=j(n.total))}let t=p,i=p;for(let r=0;v.length>r;r++){const a=v[r],l=o.groups.get(a);if(!l)continue;const c=j(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const k=g(l.pieces[0],a),w=null!==(s=S.get(a))&&void 0!==s?s:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=m,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=m,O.__funnelBarW=c),f.push(De(x,m,c,h,k,O,a)),b.set(a,{x:x,y:m,w:c,h:h})}}else{const e=o.stepTotal,t=j(e),s=p-t/2,a=v[0],l="_default"!==a,c=null!==(r=null===(i=o.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:n.pieceData[0],u=l?a:n.name,x=g(c,u),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:d,category:l?a:n.name});y&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=m,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=m,w.__funnelBarW=t),f.push(De(s,m,t,h,x,w,u)),b.set(a,{x:s,y:m,w:t,h:h})}if(t>0&&_.size>0){const t=x?v:[v[0]];for(const i of t){const t=_.get(i),r=b.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return g(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),d={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=o.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===i?n.name:i};f.push(d)}}_=b}return f},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:d}=e,u=[],h=d.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return u;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const m=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);m.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,d=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),S=o.x+e*a+l/2,O=v(y),C=v(0)-O,j=c(f.pieces[0],p?h:o.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:S+d/2,__barFunnelLabelY:v(y+A)});if(u.push(De(S,O,d,C,j,M,p?h:o.name)),A>0){const e=v(y+A),t=O-e,n=Object.assign({},j),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});u.push(De(S,e,d,t,n,i,p?h:o.name))}}}return u},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="horizontal"===c,h=e.config.gradientFill,g=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=u?De(s,o.x,a,o.width,n,null,"__track__"):De(o.x,s,o.width,a,n,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const o=d.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(u){const r=l(t),s=l(t+n);f=De(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=De(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=n}if(p>0&&d.length>o){const e=d.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},n.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},n.cornerRadii={tl:p,tr:p})}}return d}};class cr{constructor(e){this.rExtent=new Le,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Pe(e.windowSize),this.getO=We(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=Re(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=We(e.stackBy),this.getGroup=We(e.groupBy),this.getColor=We(e.colorAccessor),this.getConnector=We(e.connectorAccessor),this.getDataId=We(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Pe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const n=o.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(n),s=this.computeValueDomain(n,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let d,u;if(l){d=S().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;u=k().domain(s).range([n,o])}else a?(d=S().domain(r).range([0,e.height]).padding(c),u=k().domain(s).range([0,e.width])):(d=S().domain(r).range([0,e.width]).padding(c),u=k().domain(s).range([e.height,0]));this.scales={o:d,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(o,n);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const d=null!==(r=t.extentPadding)&&void 0!==r?r:.05,u=c-l,h=u>0?u*d:1;return l-=h,c+=h,l>0&&(l=0),a?k().domain([l,c]).range([0,e.width]):k().domain([l,c]).range([e.height,0])}):[];let h=n;this.rAccessors.length>1&&(h=n.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,r,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),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.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>d&&(d=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>d&&(d=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(d=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(d=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=d-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||u&&!this.config.baselinePadding&&0===d||"swimlane"===a||(d+=t)}return[c,d]}buildColumns(e,t,o,n,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==n){d=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of d)d.set(t,o/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;d?(c=h,g=d.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:u},u+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=lr[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,d=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(o)||d.set(o,[]),d.get(o).push({x:n,y:i,datum:t,category:a(t)})}const u=i.o.domain(),h=r.connectorStyle;for(const[t,i]of d)if(i.length>=2){i.sort((e,t)=>u.indexOf(e.category)-u.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=sr(r.colorScheme,r.themeCategorical,ft),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:ar(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?xt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,cr.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=C().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const n=d.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,S);if(!d)continue;c._transitionKey=d;const u=this.prevPositionMap.get(d);if("point"===c.type)u?(A.add(d),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(u.x!==c.x||u.y!==c.y||void 0!==u.r&&u.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=u.x,c.y=u.y,void 0!==u.r&&(c.r=u.r),w=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,u.x===c.x&&u.y===c.y&&u.w===c.w&&u.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=u.x,c.y=u.y,c.w=null!==(i=u.w)&&void 0!==i?i:c.w,c.h=null!==(r=u.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(u)A.add(d),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,u.startAngle===c.startAngle&&u.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=u.startAngle,c.endAngle=u.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(d,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(u=t.w)&&void 0!==u?u:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),s=wt(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=St(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=St(n.x,e._targetX,s),e.y=St(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=St(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=St(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=St(o.x,e._targetX,s),e.y=St(o.y,e._targetY,s),void 0!==o.w&&(e.w=St(o.w,e._targetW,s),e.h=St(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=St(o.startAngle,e._targetStartAngle,s),e.endAngle=St(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!Ie(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Ie(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Ie(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Ie(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=We(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!Ie(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=Re(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ie(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?We(this.config.stackBy):void 0),"groupBy"in e&&!Ie(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?We(this.config.groupBy):void 0),"colorAccessor"in e&&!Ie(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ie(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?We(this.config.connectorAccessor):void 0)}}function dr(e,t,o){const n=Wt(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function ur(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>zt(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function hr(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=qt(Math.atan2(i,n)),a=qt(e.startAngle),l=qt(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function gr(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function fr(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function pr(n){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=n,{rTickValues:f,axisExtent:p}=n,y="radial"===(null==d?void 0:d.projection),m="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||y?[]:(f||cn(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||yr)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,o)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),x&&e(o,{children:t(o,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function yr(e){return Math.round(100*e)/100+""}function mr(n){var s,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C,legendPosition:j="right",legendLayout:M,foregroundGraphics:_,annotations:P,svgAnnotationRules:L,xAccessor:T,yAccessor:N,annotationData:B,underlayRendered:$,children:E}=n,D="radial"===(null==g?void 0:g.projection),H="horizontal"===(null==g?void 0:g.projection),I=!1!==p,R=r(()=>f&&I&&g&&!D?g.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=g.o(e))&&void 0!==o?o:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,I,g,v,D]),F=n.rTickValues,W=n.tickLabelEdgeAlign,z=n.axisExtent,Y=r(()=>f&&g&&!D?(F||cn(g.r,5,z)).map(e=>({value:e,pixel:g.r(e),label:(b||yr)(e)})):[],[f,g,b,D,F,z]),G=i(new Map),q=i(null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0),X=null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0;q.current!==X&&(q.current=X,G.current=new Map);const V=r(()=>{if(!P||0===P.length)return null;const e=Qo(),t="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,n={scales:g?{x:t?g.r:o||g.r,y:t&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:T,yAccessor:N,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:G.current};return P.map((t,o)=>{if(L){const i=L(t,o,n);return null!=i?i:e(t,o,n)}return e(t,o,n)}).filter(Boolean)},[P,L,l,c,g,T,N,B]);return f||k||w||_||V&&V.length>0||x||E?t("svg",{role:"img",width:d,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!D&&!$&&e("g",{className:"ordinal-grid",children:Y.map((t,o)=>e("line",{x1:H?t.pixel:0,y1:H?0:t.pixel,x2:H?t.pixel:l,y2:H?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&g&&!D&&(()=>{const n={fontSize:"var(--semiotic-tick-font-size, 10px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(o,H?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),R.map((o,i)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n),children:o.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},n),children:o.label})})]},"cat-"+i)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!$&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Y.map((o,i)=>{const r=W?0===i?"start":i===Y.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n),children:o.label})]},"val-"+i)}),m&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,o=0>t||t>c?c:t;return e("line",{x1:0,y1:o,x2:l,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),R.map((o,i)=>t("g",{transform:`translate(${o.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n),children:o.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},n),children:o.label})})]},"cat-"+i)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((o,i)=>t("g",{transform:`translate(0,${o.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n),children:o.label})]},"val-"+i)),m&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),V,_,E]}),k&&e("text",{x:d/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof k?k:null}),Eo({legend:w,totalWidth:d,totalHeight:u,margin:h,legendPosition:j,title:k,legendLayout:M,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C})]}):null}function vr({width:t,height:o,totalWidth:n,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=i(null),u=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,s(()=>{if(!d.current)return;const e=y(d.current).select(".brush-g"),n=b?m():v();return n.extent([[0,0],[t,o]]),n.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[o,n]=e.selection;let i;i=x.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};p.current=r,h.current(r)}),e.call(n),u.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),u.current=null}},[t,o,b]),s(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=y(d.current).select(".brush-g"),o=l.r(e.r[0]),n=l.r(e.r[1]);b?(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1):(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1)},[l,b]),e("svg",{ref:d,width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function br(e,t){var o,n,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=An({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(n=null===(o=t.roundedEnds)||void 0===o?void 0:o.start)||void 0===n||n,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=to(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function xr(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function kr(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=I().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(n);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}cr.QUADTREE_THRESHOLD=500;const wr=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=o*n,t._gradientBand&&t._gradientBand.colors.length>0)br(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(xr(e,t),Ni(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?to(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=wn({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),kr(e,t)):(xr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(xr(e,t),Ni(e,t)),e.globalAlpha=1}}},Ar=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=to(e,"var(--semiotic-primary, #007bff)"),a=to(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?to(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?to(e,d)||d:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=u,e.lineWidth=h,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Sr=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?to(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Or=(e,t,o,n)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=to(e,o.style.stroke)||("string"==typeof o.style.fill?to(e,o.style.fill):o.style.fill)||to(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Cr=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function jr(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Mr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let _r=null;function Pr(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(_r||(_r=document.createElement("canvas")),_r.width=e,_r.height=e,_r)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(d);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Lr=new Map;function Tr(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Lr.get(o);if(void 0!==n)return n;const i=Pr({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Lr.set(o,i),i}function Nr(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function Br(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function $r(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Er=e=>[Or,...e],Dr={bar:Er([Ii]),clusterbar:Er([Ii]),point:Er([Ei]),swarm:Er([Ei]),pie:[wr],donut:[wr],boxplot:Er([Ar,Ei]),violin:Er([Sr]),histogram:Er([Ii]),ridgeline:Er([Sr]),timeline:Er([Ii]),funnel:[Ii,Cr,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?jr(i):null!=r?`${jr(i)} (${Mr(r)})`:jr(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=jr(i),e.measureText(c).width+16>n)continue}const d=o.__funnelValueLabelX,u=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ii,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||to(e,"var(--semiotic-border, #999)"),n=Tr(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=oo(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,to(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,d=r?$r(i):"",u=Br(n);e.font="bold 13px sans-serif";const h=r?e.measureText(d).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,m=y-f/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Nr(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Nr(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3))}e.lineWidth=1}],swimlane:Er([Ii]),custom:Er([Ii,Ei,wr,Ar,Sr,Cr])},Hr={top:50,right:40,bottom:60,left:70},Ir={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Rr({hover:o}){var n,i,r,s,a,l;const c=o.data||{},d=o.stats,u=o.category;if(Array.isArray(c)){const o=u||(null===(n=c[0])||void 0===n?void 0:n.category)||"";if(d)return t("div",{className:"semiotic-tooltip",style:Ir,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:["n = ",d.n]}),t("div",{children:["Min: ",d.min.toLocaleString()]}),t("div",{children:["Q1: ",d.q1.toLocaleString()]}),t("div",{children:["Median: ",d.median.toLocaleString()]}),t("div",{children:["Q3: ",d.q3.toLocaleString()]}),t("div",{children:["Max: ",d.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:Ir,children:[o&&e("div",{style:{fontWeight:"bold"},children:o+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const o=c.range||[];return t("div",{className:"semiotic-tooltip",style:Ir,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===o.length&&t("div",{style:{opacity:.8},children:[Number(o[0]).toFixed(1)," – ",Number(o[1]).toFixed(1)]})]})}const h=o.__oAccessor,g=o.__rAccessor,f=o.__chartType;if("swarm"===f||"point"===f){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:Ir,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const o=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:Ir,children:o.map(([e,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},e))})}return t("div",{className:"semiotic-tooltip",style:Ir,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}Rr.ownsChrome=!0;const Fr=g(function(o,a){var c,d,h,g,f,y,m,v,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:C="value",colorAccessor:j,stackBy:M,groupBy:_,multiAxis:P,timeAccessor:L,valueAccessor:T,categoryAccessor:N,projection:B="vertical",size:$=[600,400],responsiveWidth:E,responsiveHeight:D,margin:H,barPadding:R,roundedTop:F,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:de="sliding",windowSize:ue=200,pieceStyle:he,summaryStyle:ge,colorScheme:fe,barColors:pe,showAxes:ye=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:Ce,oFormat:je,rFormat:Me,rTickValues:_e,tickLabelEdgeAlign:Pe,axisExtent:Le,enableHover:Te=!0,hoverAnnotation:Ne,tooltipContent:Be,customHoverBehavior:$e,annotations:Ee,svgAnnotationRules:De,showGrid:He=!1,legend:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,legendCategoryAccessor:qe,onCategoriesChange:Xe,backgroundGraphics:Ve,foregroundGraphics:Ue,title:Ke,className:Qe,background:Ze,centerContent:Je,decay:et,pulse:tt,transition:ot,animate:nt,staleness:it,brush:rt,onBrush:st,accessibleTable:at=!0,description:lt,summary:ct,customLayout:dt,layoutConfig:ut}=o,ht=i(!0),gt=Si({sizeProp:$,responsiveWidth:E,responsiveHeight:D,userMargin:H,marginDefault:Hr,foregroundGraphics:Ue,backgroundGraphics:Ve,animate:nt,transitionProp:ot,themeDirtyRef:ht}),{reducedMotionRef:ft,responsiveRef:pt,size:yt,margin:mt,adjustedWidth:vt,adjustedHeight:bt,resolvedForeground:xt,resolvedBackground:kt,currentTheme:wt,transition:At,introEnabled:St,tableId:Ot,rafRef:Ct,renderFnRef:jt,scheduleRender:Mt}=gt,_t=_n(),Pt=Nn(),Lt=r(()=>me(S),[S]),Tt=null!=xe?xe:Oe,Nt=null!=we?we:Ce,Bt=null!=Ae?Ae:je,$t=null!=Se?Se:Me,Et=i(null),Dt=i(null),Ht=i([]),It=i(qe),Rt=i(Xe);It.current=qe,Rt.current=Xe;const[Wt,zt]=u(null),[Yt,Gt]=u(null),[qt,Vt]=u(0),[Ut,Kt]=u(!1),[Qt,Zt]=u(null),Jt=l(()=>{var e,t;Zt(null!==(t=null===(e=ro.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),eo=Te||Ne,oo="streaming"===A,no=r(()=>{var e,t,o;return{chartType:w,runtimeMode:oo?"streaming":"bounded",windowSize:ue,windowMode:de,extentPadding:le,projection:B,oAccessor:oo?void 0:O,rAccessor:oo?void 0:C,colorAccessor:j,stackBy:M,groupBy:_,multiAxis:P,timeAccessor:oo?L:void 0,valueAccessor:oo?T||("string"==typeof C||"function"==typeof C?C:void 0):void 0,categoryAccessor:oo?N||O:void 0,rExtent:se,oExtent:ae,axisExtent:Le,barPadding:R,roundedTop:F,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:oe,connectorAccessor:ne,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:fe,themeCategorical:null===(e=null==wt?void 0:wt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(wt),themeSequential:null===(t=null==wt?void 0:wt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==wt?void 0:wt.colors)||void 0===o?void 0:o.diverging,barColors:pe,decay:et,pulse:tt,transition:At,introAnimation:St,staleness:it,customLayout:dt,layoutConfig:ut,layoutMargin:mt}},[w,ue,de,le,B,O,C,j,M,_,P,L,T,N,se,ae,Le,R,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,te,oe,ne,ie,re,ce,he,ge,fe,pe,et,tt,null==At?void 0:At.duration,null==At?void 0:At.easing,St,it,oo,wt,dt,ut,mt]),io=$n(no),ro=i(null);ro.current||(ro.current=new cr(io));const so=l(()=>{var e,t;const o=It.current,n=Rt.current;if(!n||!o)return;const i=Gi(null!==(t=null===(e=ro.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);qi(i,Ht.current)||(Ht.current=i,n(i))},[]);s(()=>{var e;null===(e=ro.current)||void 0===e||e.updateConfig(io),ht.current=!0,Mt()},[io,Mt]);const ao=i(null);ao.current||(ao.current=new ve(e=>{const t=ro.current;t&&t.ingest(e)&&(ht.current=!0,Mt())}));const lo=l(e=>{var t;null===(t=ao.current)||void 0===t||t.push(e)},[]),co=l(e=>{var t;null===(t=ao.current)||void 0===t||t.pushMany(e)},[]),uo=l(()=>{var e,t;null===(e=ao.current)||void 0===e||e.clear(),null===(t=ro.current)||void 0===t||t.clear(),ht.current=!0,Mt()},[Mt]),ho=l(e=>{var t,o;null===(t=ao.current)||void 0===t||t.clearLastData(),null===(o=ao.current)||void 0===o||o.setReplacementData(e)},[]);p(a,()=>({push:lo,pushMany:co,replace:ho,remove:e=>{var t,o,n,i;null===(t=ao.current)||void 0===t||t.flush();const r=null!==(n=null===(o=ro.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=Dt.current)||void 0===i?void 0:i.data;!!Dt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Dt.current=null,zt(null)),ht.current=!0,Mt()}return r},update:(e,t)=>{var o,n,i;null===(o=ao.current)||void 0===o||o.flush();const r=null!==(i=null===(n=ro.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ht.current=!0,Mt()),r},clear:uo,getData:()=>{var e,t,o;return null===(e=ao.current)||void 0===e||e.flush(),null!==(o=null===(t=ro.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ro.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[lo,co,ho,uo,Mt]),s(()=>{var e;S&&(null===(e=ao.current)||void 0===e||e.setBoundedData(Lt))},[S,Lt]);const{hoverHandlerRef:go,hoverLeaveRef:fo,onPointerMove:po,onPointerLeave:yo}=gt;go.current=e=>{if(!eo)return;const t=Et.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-mt.left,i=e.clientY-o.top-mt.top;if(0>n||n>vt||0>i||i>bt)return void(Dt.current&&(Dt.current=null,zt(null),$e&&$e(null),Mt()));const r=ro.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Xt(i,t,o,n,r);e&&(s={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"rect":if(null==r.datum)break;e=dr(r,t,o);break;case"point":if(i)break;e=ur(r,t,o,n);break;case"wedge":if(null===r.datum)break;e=hr(r,t,o);break;case"boxplot":e=gr(r,t,o);break;case"violin":e=fr(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-vt/2:n,s?i-bt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Dt.current&&(Dt.current=null,zt(null),$e&&$e(null),Mt()));const l=ui(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w}));Dt.current=l,zt(l),$e&&($e(l),ht.current=!0),Mt()},fo.current=()=>{Dt.current&&(Dt.current=null,zt(null),$e&&($e(null),ht.current=!0),Mt())};const mo=i(-1),vo=i(null),bo=i(null),Ao=l(e=>{const t=ro.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(bo.current&&bo.current.version===o)n=bo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";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!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=xo(e),bo.current={version:o,graph:n}}const i=mo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),mo.current=0;const t=n.flat[0];vo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Oo(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});return Dt.current=o,zt(o),$e&&$e(o),void Mt()}const r=ko(n,i),s=wo(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return mo.current=-1,vo.current=null,Dt.current=null,zt(null),$e&&$e(null),void Mt();mo.current=s;const a=n.flat[s];vo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Oo(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});Dt.current=l,zt(l),$e&&$e(l),Mt()},[$e,Mt]),So=l(e=>{mo.current=-1,vo.current=null,po(e)},[po]);jt.current=()=>{var e,t;Ct.current=0;const o=Et.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=ro.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(ft.current?r+1e6:r),a=!ft.current&&s,l=ht.current;l&&!s&&(i.computeScene({width:vt,height:bt}),so(),Jt(),ht.current=!1),(l||a)&&o.setAttribute("aria-label",zn(i.scene,w+" chart"));const c=Ci(),d=yt[0]*c,u=yt[1]*c;o.width===d&&o.height===u||(o.width=d,o.height=u,o.style.width=yt[0]+"px",o.style.height=yt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,yt[0],yt[1]);const h=null!==(e=null==it?void 0:it.threshold)&&void 0!==e?e:5e3,g=it&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==it?void 0:it.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ze&&!Ve){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Ze||(e&&"transparent"!==e?e:null),i=t?to(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,yt[0],yt[1]))}const f="radial"===B;n.save(),n.beginPath(),n.rect(mt.left,mt.top,vt,bt),n.clip(),f?(n.save(),n.translate(mt.left+vt/2,mt.top+bt/2)):n.translate(mt.left,mt.top);const p=dt?Dr.custom:Dr[w]||[],y={width:vt,height:bt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Gt(i.scales),Vt(e=>e+1)),(null==it?void 0:it.showBadge)&&Kt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Ct.current=requestAnimationFrame(()=>jt.current()))},Bn({hydrated:_t,wasHydratingFromSSR:Pt,storeRef:ro,dirtyRef:ht,renderFnRef:jt,cleanup:()=>{var e;return null===(e=ao.current)||void 0===e?void 0:e.clear()}}),s(()=>{ht.current=!0,Mt()},[w,vt,bt,ye,Ze,Mt]),Co(it,ro,ht,Mt,Ut,Kt);const jo=eo&&Wt?Be?Be(Wt):e(Rr,{hover:Wt}):null,Mo="radial"===B,_o=jo?e(bi,{x:Wt?Mo?Wt.x+vt/2:Wt.x:0,y:Wt?Mo?Wt.y+bt/2:Wt.y:0,containerWidth:vt,containerHeight:bt,margin:mt,className:"stream-ordinal-tooltip",children:jo}):null,Po=Xi(O,void 0,"__semiotic_resolvedO",""),Lo=Xi(C,void 0,"__semiotic_resolvedR",""),To=Po.key,No=Lo.key,Bo=Vi(Po,Lo,Ee&&Ee.length>0||!1);if(jn||!_t&&Pt){const o=ro.current;o&&S&&(o.ingest({inserts:Lt,bounded:!0}),o.computeScene({width:vt,height:bt}));const i=null!==(c=null==o?void 0:o.scene)&&void 0!==c?c:[],r=null!==(d=null==o?void 0:o.scales)&&void 0!==d?d:null,s="radial"===B,a=s?mt.left+vt/2:mt.left,l=s?mt.top+bt/2:mt.top;return t("div",{ref:pt,className:"stream-ordinal-frame"+(Qe?" "+Qe:""),role:"img","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),style:{position:"relative",width:E?"100%":yt[0],height:D?"100%":yt[1]},children:[e(ri,{summary:ct}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:yt[0],height:yt[1],style:{position:"absolute",left:0,top:0},children:[kt&&e("g",{transform:`translate(${mt.left},${mt.top})`,children:kt}),t("g",{transform:`translate(${a},${l})`,children:[Ze&&e("rect",{x:0,y:0,width:vt,height:bt,fill:Ze}),i.map((o,i)=>function(o,i,r){var s,a,l,c,d,u,h,g,f;const p=("category"in o?o.category:void 0)||("group"in o?o.group:void 0)||"",y=e=>`ord-${o.type}-${p}-${i}-${e}`,m=`ord-${o.type}-${p}-${i}`;switch(o.type){case"rect":{const i=o,r=Cn(m)+"-grad",s=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.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;for(let o=0;t.length>o;o++)l.push(e("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=On(t.style.fill);l.push(e("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:On(i.style.fill);if(i.cornerRadii&&bn(i.cornerRadii)){const o=function(e){const{x:t,y:o,w:n,h:i}=e,{tl:r,tr:s,br:a,bl:l}=xn(e);let c=`M${t+r},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+i}`),c+=` L${t+l},${o+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+i-l}`),c+=` L${t},${o+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${o}`),c+=" Z",c}(i);return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:o,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const o=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+o},${l} A${o},${o} 0 0 0 ${r},${l+o} L${r},${l+d-o} A${o},${o} 0 0 0 ${r+o},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-o} A${o},${o} 0 0 1 ${r+c-o},${l+d} L${r+o},${l+d} A${o},${o} 0 0 1 ${r},${l+d-o} Z`;break;default:u=`M${r},${l+d} L${r},${l+o} A${o},${o} 0 0 1 ${r+o},${l} L${r+c-o},${l} A${o},${o} 0 0 1 ${r+c},${l+o} L${r+c},${l+d} Z`}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(n.Fragment,{children:[s&&e("defs",{children:s}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}case"point":{const t=o;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:On(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"wedge":{const n=o;if(n._gradientBand&&n._gradientBand.colors.length>0){const o=Cn(`${r?r+"-":""}gauge-grad-${n.category||m}-${i}`),{clipPath:s,slices:u}=An({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:null===(l=null===(a=n.roundedEnds)||void 0===a?void 0:a.start)||void 0===l||l,roundEnd:null===(d=null===(c=n.roundedEnds)||void 0===c?void 0:c.end)||void 0===d||d,colors:n._gradientBand.colors});return t("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:o,children:e("path",{d:s})})}),e("g",{clipPath:`url(#${o})`,children:u.map((t,o)=>e("path",{d:t.d,fill:On(t.color)},o))}),n.style.stroke&&"none"!==n.style.stroke&&e("path",{d:s,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},m)}let s;if(n.roundedEnds)s=wn({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=I().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),s=e(Sn)||""}return e("path",{d:s,transform:`translate(${n.cx},${n.cy})`,fill:On(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},m)}case"boxplot":{const n=o,i=n.columnWidth/2;return t("g","vertical"===n.projection?{children:[e("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:n.x-i,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:On(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-i,y1:n.medianPos,x2:n.x+i,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.x-.5*i,y1:n.minPos,x2:n.x+.5*i,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.x-.5*i,y1:n.maxPos,x2:n.x+.5*i,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-i,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:On(n.style.fill),fillOpacity:null!==(h=n.style.fillOpacity)&&void 0!==h?h:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.medianPos,y1:n.y-i,x2:n.medianPos,y2:n.y+i,stroke:n.style.stroke||"#333",strokeWidth:2}),e("line",{x1:n.minPos,y1:n.y-.5*i,x2:n.minPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1}),e("line",{x1:n.maxPos,y1:n.y-.5*i,x2:n.maxPos,y2:n.y+.5*i,stroke:n.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=o,n=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:On(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const o=t.bounds,i=o.x+o.width/2,r=o.y+o.height/2;o.height>o.width?n.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):n.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:n},m)}case"connector":return e("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:null!==(f=o.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=o,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:n,fill:On(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(o,i,Ot)).filter(Boolean)]})]}),e(mr,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:r,showAxes:ye,showCategoryTicks:be,oLabel:Tt,rLabel:Nt,oFormat:Bt,rFormat:$t,rTickValues:_e,tickLabelEdgeAlign:Pe,axisExtent:Le,showGrid:He,title:Ke,legend:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,foregroundGraphics:Ft(xt,null===(h=ro.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:Ee,svgAnnotationRules:De,annotationFrame:0,xAccessor:To,yAccessor:No,annotationData:Bo(null==o?void 0:o.getData())}),Je&&"radial"===B&&e("div",{style:{position:"absolute",left:mt.left+vt/2,top:mt.top+bt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je})]})}return t("div",{ref:pt,className:"stream-ordinal-frame"+(Qe?" "+Qe:""),role:"group","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:E?"100%":yt[0],height:D?"100%":yt[1],overflow:"visible"},onKeyDown:Ao,children:[at&&e(si,{tableId:Ot}),at&&e(ni,{scene:null!==(f=null===(g=ro.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:Ot,chartTitle:"string"==typeof Ke?Ke:void 0}),e(ri,{summary:ct}),t("div",{role:"img","aria-label":lt||("string"==typeof Ke?Ke:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?So:void 0,onMouseLeave:eo?yo:void 0,children:[kt&&e("svg",{style:{position:"absolute",top:0,left:0,width:yt[0],height:yt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${mt.left},${mt.top})`,children:kt})}),e(pr,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,showAxes:ye,showGrid:He,rFormat:$t,rTickValues:_e,axisExtent:Le}),e("canvas",{ref:Et,"aria-label":zn(null!==(m=null===(y=ro.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:yt[0],height:yt[1]}}),e(ai,{hoverPoint:Wt}),e(mr,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,showAxes:ye,showCategoryTicks:be,oLabel:Tt,rLabel:Nt,oFormat:Bt,rFormat:$t,rTickValues:_e,axisExtent:Le,showGrid:He,title:Ke,legend:Ie,legendHoverBehavior:Re,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:ze,legendPosition:Ye,legendLayout:Ge,foregroundGraphics:Ft(xt,Qt),annotations:Ee,svgAnnotationRules:De,annotationFrame:qt,xAccessor:To,yAccessor:No,annotationData:Bo(null===(v=ro.current)||void 0===v?void 0:v.getData()),underlayRendered:!0}),(rt||st)&&"radial"!==B&&e(vr,{width:vt,height:bt,totalWidth:yt[0],totalHeight:yt[1],margin:mt,scales:Yt,onBrush:st||(()=>{})}),Je&&"radial"===B&&e("div",{style:{position:"absolute",left:mt.left+vt/2,top:mt.top+bt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je}),(null==it?void 0:it.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===it.badgePosition?{top:4,left:4}:"bottom-left"===it.badgePosition?{bottom:4,left:4}:"bottom-right"===it.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ut?"#dc3545":"#28a745",color:"white"}),children:Ut?"STALE":"LIVE"}),e(ci,{active:mo.current>=0,hoverPoint:Wt,margin:mt,size:yt,shape:null===(b=vo.current)||void 0===b?void 0:b.shape,width:null===(x=vo.current)||void 0===x?void 0:x.w,height:null===(k=vo.current)||void 0===k?void 0:k.h}),_o]})]})});Fr.displayName="StreamOrdinalFrame";const Wr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},zr={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Yr{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?Gr(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function Gr(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,d,u,h]=e[a];qr(c,d,u,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;qr(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;n.x+=-c/d*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function qr(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,d=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+d*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+d*n.y}function Xr(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Vr(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,u=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(d(o,i),u=!0):r[n]||(u=c(n));if(u)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),u}function d(e,t){var o=[].concat(t).concat(e);n.push(o)}function u(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,d=0,u=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=d,i[t]=!0,d+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=d,i[p]=!0,d+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),m.push(a[b]),v+=a[b].length,s[b]=u.length,b===t){l.length=f;break}}u.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:u,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=u(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function Ur(e){return e.y0-e.y1>0?"up":"down"}function Kr(e,t){return t(e.source)==t(e.target)}function Qr(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function Zr(e){return e.target.x0-e.source.x1}function Jr(e,t){var o=ts(e),n=Zr(t)/Math.tan(o);return"up"==Ur(e)?e.y1-n:e.y1+n}function es(e,t){var o=ts(e),n=Zr(t)/Math.tan(o);return"up"==Ur(e)?e.y1+n:e.y1-n}function ts(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function os(e,t){return t(e)}function ns(e){return rs(e.source)}function is(e){return rs(e.target)}function rs(e){return(e.y0+e.y1)/2}function ss(e){return e.virtual?0:e.value}function as(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Kr(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Kr(e,t)?n+1:n}),o+n}function ls(e){return e.target.depth}function cs(e,t){return e.sourceLinks.length?e.depth:t-1}function ds(e,t){return e.y0-t.y0}function us(e,t){return t.y0-e.y0}function hs(e,t){return e.y1-t.y1}function gs(e,t){return t.y1-e.y1}function fs(e,t){return ys(e.source,t.source)||e.index-t.index}function ps(e,t){return ys(e.target,t.target)||e.index-t.index}function ys(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function ms(e,t){return vs(e)==vs(t)?"bottom"==e.circularLinkType?us(e,t):ds(e,t):vs(t)-vs(e)}function vs(e){return e.target.column-e.source.column}function bs(e,t){return xs(e)==xs(t)}function xs(e){return e.y0-e.y1>0?"up":"down"}function ks(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=z(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),ws(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),ws(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Kr(e,t)&&Qr(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?us:ds);var d=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+d,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+d),d+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?gs:hs),d=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+d,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+d),d+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function ws(e,t,o){e.sort(ms);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Kr(e,t)&&Qr(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&As(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function As(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Ss(e){return function(){return e}}function Os(e){return e.index}function Cs(e){return e.nodes}function js(e){return e.links}function Ms(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=rs(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=rs(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?as(t,o)-as(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==as(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function _s(e,t,o,n,i,r){var s=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});d();for(var a=1,l=r;l>0;--l)c(a*=.99,o),d();function c(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&as(i,o)>0){var l=X(i.sourceLinks,is),c=X(i.targetLinks,ns),d=l&&c?(l+c)/2:l||c;if(d){var u=(d-rs(i))*t*.3;i.y0+=u,i.y1+=u}}else if(0==s&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var h=X(i.sourceLinks,is),g=X(i.targetLinks,ns),f=((h&&g?(h+g)/2:h||g)-rs(i))*t;i.y0+=f,i.y1+=f}})})}function d(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||ys),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function Ps(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ps),e.targetLinks.sort(fs)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Ls(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,a=Os,l=cs,c=void 0,d=32,u=2,h=Cs,g=js;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return V(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=Xr(o,n)),"object"!=typeof i&&(i=e.target=Xr(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=Vr(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var d=l[i].slice(-2);c[d[0]]||(c[d[0]]={}),c[d[0]][d[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){os(e,t)!=os(i.source,t)&&os(e,t)!=os(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Kr(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,ss),q(e.targetLinks,ss)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(h,c,l);var g=r;if(null!==s){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=z(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,g,i),Ms(h,c,a),_s(h,c,a,g,g,d),Ps(h),ks(h,a,u,10,8),Ms(h,c,a),_s(h,c,a,g,g,d),Ps(h),ks(h,a,u,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return os(o.source,t)==os(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!bs(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=Jr(t,e);return e.y1-o}if(t.target.column>e.target.column)return Jr(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return os(o.target,t)==os(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!bs(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=es(t,e);return e.y0-o}if(t.source.column>e.source.column)return es(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=z(t,function(e){return e.y0}),s=G(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-r);function l(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>a?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),o.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),ks(h,a,u,10,8)}(f),f}return f.update=function(e){return Ps(e),ks(e,a,u,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ss(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:Ss(e),f):g},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:Ss(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Ss(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(d=+e,f):d},f.circularLinkGap=function(e){return arguments.length?(u=+e,f):u},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],f):[[e,t],[o,n]]},f.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],f):[o-e,n-t]},f}function Ts(e){const{sx:t,sTop:o,sBot:n,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,d=(r+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${r} ${i},${r}`,`L${i},${s}`,`C${l},${s} ${a},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:d},{x:i,y:d}],halfWidth:(n-o)/2}}}const Ns=e=>{let t,o,n,i,r,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=ie(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`;const d=e.sankeyWidth/2,u=ie(e.source.x1,e.target.x0),{pathD:h}=Ts({sx:e.source.x1,sTop:e.y0-d,sBot:e.y0+d,tx:e.target.x0,tTop:e.y1-d,tBot:e.y1+d,cp1X:u(.5),cp2X:u(.5)});return h};function Bs(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,d=i.leftFullExtent,u=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${u+h*n-h*g}L${c+n-g},${u+h*n}L${d-n+g},${u+h*n}L${d-n},${u+h*n-h*g}L${d-n},${l-h*o+h*g}L${d-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${d+n},${l+h*o}L${d+n},${u-h*n}L${c-n},${u-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const $s=new Set,Es=new WeakMap;function Ds(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Es.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Es.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;$s.has(e)||($s.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const Hs={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(ls))-1:0},justify:cs};function Is(e){return"string"==typeof e?e:e.id}const Rs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,d;if(0===e.length)return;const u="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===u?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Ls().extent(v).links(m).nodes(y).nodeAlign(Hs[h]||cs).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of m){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,d=n[0],u=n[1];if(r>0&&s>0&&(0>e||0>o||t>d||i>u)){const t=Math.min(d/r,u/s),n=-e*t+(d-r*t)/2,i=-o*t+(u-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of m)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=Is(e.source),o=Is(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(d=e.width)&&void 0!==d?d:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=u;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const d="vertical"===o.orientation?"down":"right",u=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=[],v=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=u?u(Ds(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),m.push("down"===d?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const d=h?h(Ds(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=d.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=d.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let u;if(u=e.circular&&e.circularPathData?Bs(e):Ns(e),!u)continue;const p={fill:d.fill||i,fillOpacity:null!==(c=d.fillOpacity)&&void 0!==c?c:g,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};v.push({type:"bezier",pathD:u,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===d?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===d?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},Fs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let d=0;const u=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?d++:o?(t.x=o.x,t.y=o.y,d++):u.push(t)}const h=d>0&&.3>=(e.length>0?u.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of u){const n=Ws(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=zs(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=zs(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const g=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===o.iterations?0:h?40:g,p=Ys(o.nodeSize,o.nodeSizeRange,e),y=e=>p(e);if(f>0){const o=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=se().force("charge",ae().strength(e=>-25*y(e))).force("center",le(a,l).strength(.8)).force("x",ce(a).strength(.15)).force("y",de(l).strength(.15));if(n.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));o.links(e),n.force("link",o)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;f>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,d;const u=o.nodeStyle,h=o.edgeStyle,g=Ys(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],m=[],v=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Ds(t,"nodeSize")),n=u?u(Ds(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(Ds(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(d=i.opacity)&&void 0!==d?d:.6};m.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=g(Ds(o,"nodeSize"));v.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function Ws(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function zs(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function Ys(e,t,o){var n,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],s=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>r[0];const a=null!==(n=z(s))&&void 0!==n?n:0,l=null!==(i=G(s))&&void 0!==i?i:1;if(a===l)return()=>(r[0]+r[1])/2;const c=k().domain([a,l]).range(r).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?r[0]:c(n)}}const Gs=qe,qs={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-r,c=n[0]/2,d=n[1]/2,u=(h=o.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=g.get("string"==typeof e.source?e.source:e.source.id),n=g.get(t);if(void 0===o||void 0===n)continue;const i=u(e);p[o][n]=i}const y=he().padAngle(i);s&&y.sortGroups(s);const m=y(p),v=m.groups,b=I().innerRadius(l).outerRadius(a);for(const t of v){const o=e[t.index],n=b.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+d,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const o=e[t.source.index].id,n=e[t.target.index].id,i=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);i&&(i.__chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,d=Math.min(n[0],n[1])/2,u=d-l,h=n[0]/2,g=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,y=o.edgeColorBy||"source",m=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Gs,v=new Map;e.forEach((e,t)=>{v.set(e.id,m[t%m.length])});const b=ue().radius(u),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=f?f(Ds(o,"nodeStyle")).fill||v.get(o.id)||m[t%m.length]:v.get(o.id)||m[t%m.length];const s=f?f(Ds(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};x.push({type:"arc",cx:h,cy:g,innerR:u,outerR:d,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=b(t);if(!n)continue;const i=Xs(n,h,g);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(p)l=p(Ds(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===y&&o?l=v.get(o.id)||l:t&&(l=v.get(t.id)||l)}const d=p?p(Ds(e,"edgeStyle")):{},u={fill:l,fillOpacity:null!==(a=d.fillOpacity)&&void 0!==a?a:c,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};k.push({type:"ribbon",pathD:i,style:u,datum:e})}if(!1!==o.showLabels){const t=(A=o.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=d+12;for(const o of e){const e=o.__arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;w.push({x:h+Math.cos(s)*n,y:g+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Xs(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const Vs=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Us(e){const[t,o,n]=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*o+.114*n>150?"#222":"#fff"}function Ks(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Qs(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}function Zs(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Vs}function Js(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function ea(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const ta={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),l=o.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,d=K(r,a);d.sum(c),d.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[u,h]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=oe();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,u,h);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,u,h);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([o,n]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(d,o,u,h);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([o,n]).padding(r)(e)}(d,o,u,h);break;case"partition":!function(e,t,o,n){var i;Q().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,o,u,h)}const g=d.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const n=g[t],r={id:Ks(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?oa(r,n,o):"treemap"===s||"partition"===s?na(r,n):"circlepack"===s&&ia(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,d,u,h,g;const f=[],p=[],y=[],m=o.treeOrientation||"vertical",v="radial"===m,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;v&&(e+=b,n+=x);const r=i(Ds(t,"nodeStyle"));let l=r.fill||Js(o);if(o.colorByDepth&&void 0!==t.depth){const e=Zs(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;v&&(i+=b,s+=x,a+=b,l+=x);const g=ea(i,s,a,l,m),f=r(Ds(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(d=o.themeSemantic)||void 0===d?void 0:d.secondary)||"#999",strokeWidth:null!==(u=f.strokeWidth)&&void 0!==u?u:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=Qs(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(v&&(s+=b,a+=x),v){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===m?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],d=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(Ds(o,"nodeStyle"));let l=a.fill||Js(t);if(t.colorByDepth&&void 0!==o.depth){const e=Zs(t);l=e[o.depth%e.length]}const d={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:d,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Qs(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>u)continue;let f=n(Ds(c,"nodeStyle")).fill||Js(t);if(t.colorByDepth&&void 0!==c.depth){const e=Zs(t);f=e[c.depth%e.length]}const p="string"==typeof f?Us(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";d.push(h?{x:c.x0+e/2,y:c.y0+u/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:d}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,d,u,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(Ds(o,"nodeStyle"));let c=l.fill||Js(t);if(t.colorByDepth&&void 0!==o.depth){const e=Zs(t);c=e[o.depth%e.length]}const d={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.push({type:"circle",cx:o.x,cy:o.y,r:e,style:d,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Qs(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(Ds(i,"nodeStyle")).fill||Js(t);if(t.colorByDepth&&void 0!==i.depth){const e=Zs(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?Us(a):null!==(u=null===(d=t.themeSemantic)||void 0===d?void 0:d.text)&&void 0!==u?u:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function oa(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function na(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function ia(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function ra(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const sa={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,s;const a=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),d=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,u=null!==(s=o.orbitEccentricity)&&void 0!==s?s:1,h="number"==typeof d?()=>d:d,g="number"==typeof u?()=>u:u,f=ra(o);f.metaMap.clear(),n.length=0,i.length=0;const p=new Map;function y(e){var t;const o=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,o+1),0===o?e:`${e}__${o}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));n.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,s,d,u,p){const m=a(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:o,depth:u,data:t,parentId:o},O=p?d/h(S)*A:d*A,C=R().value(e=>{var t;return(null===(t=a(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=C(k),M=g(S);for(let t=0;k.length>t;t++){const a=(j[t].startAngle+j[t].endAngle)/2,c=k[t],d=y(l(c)),h=r+O*Math.sin(a),g=s+O*Math.cos(a)*M;n.push({id:d,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:u,data:c}),f.metaMap.set(d,{ring:O,angle:a,depth:u,parentId:o,eccentricity:M}),i.push({source:o,target:d,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:d}}),e(c,d,h,g,O,u+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,d;const u=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=ra(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(Ds(t,"nodeSize")),n=u?u(Ds(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),o="object"==typeof e.target?e.target:m.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(Ds(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(d=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==d?d:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=ra(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},aa={sankey:Rs,force:Fs,chord:qs,tree:ta,cluster:ta,treemap:ta,circlepack:ta,partition:ta,orbit:sa};function la(e){return aa[e]}class ca{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Wr),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Yr(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Wr),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Yr(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],d="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},da(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=d(o),s=null==r?NaN:Number(r),a=Number.isFinite(s)?s:1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},da(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},da(i)),{data:o}));const u=`${n}\0${i}\0${e}`,h={source:n,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:u};o&&"object"==typeof o&&ua(o.bezier)&&(h.bezier=o.bezier),this.edges.set(u,h)}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,da(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,da(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=la(this.config.chartType);if(!c)return;let d=Array.from(this.nodes.values());const u=Array.from(this.edges.values());if(0===d.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of d)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(d,u,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&d.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of d)this.nodes.set(e.id,e);for(let e=0;u.length>e;e++){const t=u[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,d=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=d.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&d.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,o,n,i,r,s;const a=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=sr(this.config.colorScheme,this.config.themeCategorical,qe),d={nodes:a,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:ar(c),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{}};let u;try{u=this.config.customNetworkLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(n=u.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(i=u.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=u.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(s=u.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const c=la(this.config.chartType);if(!c)return;const{sceneNodes:d,sceneEdges:u,labels:h}=c.buildScene(a,l,this.config,e);this.sceneNodes=d,this.sceneEdges=u,this.labels=h}get isAnimating(){const e=la(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=la(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return o.tick(n,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),o=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,o),e.x1=St(e._prevX1,e._targetX1,o),e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,o),e.y1=St(e._prevY1,e._targetY1,o),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const d=e-c;a>d&&(t._pulseIntensity=1-d/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const s=i.id;if(!s)continue;const a=r.get(s);if(void 0===a)continue;const l=xt(o,a,n),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function da(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function ua(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!ha(e))return!1;return!0}return ha(t.points)}function ha(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function ga(e,t,o,n,i=30){let r=null,s=i,a=1/0;for(const t of e){const e=fa(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(r=e,a=o)}else s>e.distance&&(r=e,s=e.distance)}if(r)return r;for(const e of t){if(!1===e.interactive)continue;const t=ba(e,o,n);t&&s>t.distance&&(r=t,s=t.distance)}return r}function fa(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>zt(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=Wt(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=qt(Math.atan2(i,n)),a=qt(e.startAngle),l=qt(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}let pa=null,ya=null;function ma(){return ya||(pa=document.createElement("canvas"),pa.width=1,pa.height=1,ya=pa.getContext("2d")),ya}function va(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function ba(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=va(e),i=ma();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=va(e),i=ma();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function xa(i){const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,labels:d,title:u,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:m="right",legendLayout:v,foregroundGraphics:b,sceneNodes:x,annotations:k,svgAnnotationRules:w}=i;return t(o,{children:[t("svg",{role:"img",width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof u?u:"Network Chart"}),e("desc",{children:"string"==typeof u?u+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[d.map((t,o)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),k&&k.filter(e=>"widget"!==e.type).map((t,o)=>{if(w){const i=w(t,o,{width:r,height:s,sceneNodes:x});if(i)return e(n.Fragment,{children:i},"annotation-"+o)}return null}),b]}),u&&"string"==typeof u?e("text",{x:a/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:u}):u?e("foreignObject",{x:0,y:0,width:a,height:c.top,children:u}):null,Eo({legend:h,totalWidth:a,totalHeight:l,margin:c,legendPosition:m,title:u,legendLayout:v,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==k?void 0:k.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,o)=>{var n,i,r,s,a,l,d,u,h;const g=x.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!g)return null;const f=c.left+(null!==(n=g.cx)&&void 0!==n?n:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(i=g.x)&&void 0!==i?i:0),p=c.top+(null!==(r=g.cy)&&void 0!==r?r:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),y=null!==(a=t.dx)&&void 0!==a?a:0,m=null!==(l=t.dy)&&void 0!==l?l:-16,v=null!==(d=t.width)&&void 0!==d?d:32,b=null!==(u=t.height)&&void 0!==u?u:32,k=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{style:{position:"absolute",left:f+y-v/2,top:p+m-b/2,width:v,height:b,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+o)})]})}function ka(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function wa(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=ka(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=to(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Aa(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=to(e,i)||i,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Sa(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=ka(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function Oa(e,t){var o,n;if(!t.pathD)return;e.save();const i=ka(t),r=t.style.stroke||"#999";e.strokeStyle=to(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}xa.displayName="NetworkSVGOverlay";const Ca={top:20,right:80,bottom:20,left:80},ja={top:40,right:40,bottom:40,left:40},Ma=new Set(["chord","force","circlepack","orbit"]),_a=[800,600],Pa={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 La({data:o}){var n,i,r,s,a,l;if("edge"===o.nodeOrEdge){const e=o.data;return e?t("div",{className:"semiotic-tooltip",style:Pa,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=o.data;if(!c)return null;const d=c.__hierarchyNode;if(d){const o=[];let a=d;for(;a;){const e=null!==(s=null!==(i=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==i?i:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==s?s:c.id;null!=e&&o.unshift(e+""),a=a.parent}o.length>1&&o.shift();const l=o.length-1;return t("div",{className:"semiotic-tooltip",style:Pa,children:[e("div",{children:o.map((o,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===l?e("strong",{children:o}):e("span",{style:{opacity:.7},children:o})]},n))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const u=((null===(a=c.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Pa,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),u>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,h!==u&&` (weighted: ${h.toLocaleString()})`]})]})}La.ownsChrome=!0;const Ta=g(function(o,n){var a,c,d,h,g,f,y,m,v,b,x,k,w,A,S,O,C,j;const{chartType:M,nodes:_,edges:P,data:L,initialEdges:T,nodeIDAccessor:N="id",sourceAccessor:B="source",targetAccessor:$="target",valueAccessor:E="value",edgeIdAccessor:D,childrenAccessor:H,hierarchySum:R,orientation:F="horizontal",nodeAlign:W="justify",nodePaddingRatio:z=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Q="vertical",edgeType:Z="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:oe=!1,particleStyle:ne,nodeStyle:ie,edgeStyle:re,colorBy:se,colorScheme:ae="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:de=!1,nodeSize:ue=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:fe=!0,labelMode:pe,size:ye=_a,responsiveWidth:ve,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:Ce,customClickBehavior:je,onObservation:Me,chartId:_e,onTopologyChange:Pe,annotations:Le,svgAnnotationRules:Te,legend:Ne,legendPosition:Be,legendLayout:$e,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:He,legendIsolatedCategories:Ie,title:Re,foregroundGraphics:Fe,backgroundGraphics:We,decay:ze,pulse:Ye,transition:Ge,animate:qe,staleness:Xe,thresholds:Ve,accessibleTable:Ue=!0,description:Ke,summary:Qe,orbitMode:Ze,orbitSize:Je,orbitSpeed:et,orbitRevolution:tt,orbitRevolutionStyle:ot,orbitEccentricity:nt,orbitShowRings:it,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at}=o,lt=Ma.has(M)?ja:Ca,ct=i(!0),dt=Si({sizeProp:ye,responsiveWidth:ve,responsiveHeight:be,userMargin:xe,marginDefault:lt,foregroundGraphics:Fe,backgroundGraphics:We,animate:qe,transitionProp:Ge,themeDirtyRef:ct}),{reducedMotionRef:ut,responsiveRef:ht,size:ft,margin:pt,adjustedWidth:yt,adjustedHeight:mt,resolvedForeground:vt,resolvedBackground:bt,transition:xt,introEnabled:kt,tableId:wt,rafRef:At,renderFnRef:St,scheduleRender:Ot,currentTheme:Ct}=dt,jt=_n(),Mt=Nn(),_t=r(()=>me(_),[_]),Pt=r(()=>Array.isArray(P)?me(P):P,[P]),Lt=r(()=>Object.assign(Object.assign({},Wr),te),[te]),Tt=r(()=>Object.assign(Object.assign({},zr),ne),[ne]),Nt=r(()=>{var e;return{chartType:M,nodeIDAccessor:N,sourceAccessor:B,targetAccessor:$,valueAccessor:E,edgeIdAccessor:D,childrenAccessor:H,hierarchySum:R,orientation:F,nodeAlign:W,nodePaddingRatio:z,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Lt,showParticles:oe,particleStyle:Tt,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:fe,labelMode:pe,colorBy:se,colorScheme:ae,themeCategorical:null===(e=null==Ct?void 0:Ct.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(Ct),edgeColorBy:le,edgeOpacity:ce,colorByDepth:de,nodeSize:ue,nodeSizeRange:he,decay:ze,pulse:Ye,transition:xt,introAnimation:kt,staleness:Xe,thresholds:Ve,orbitMode:Ze,orbitSize:Je,orbitSpeed:et,orbitRevolution:tt,orbitRevolutionStyle:ot,orbitEccentricity:nt,orbitShowRings:it,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at}},[M,N,B,$,E,H,R,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,Lt,oe,Tt,ie,re,ge,fe,pe,se,ae,le,ce,de,ue,he,ze,Ye,null==xt?void 0:xt.duration,null==xt?void 0:xt.easing,kt,Xe,Ve,Ze,Je,et,tt,ot,nt,it,rt,Ct,st,at]),Bt=$n(Nt),$t=i(null),Et=i(0),Dt=i(0),Ht=i(!1),It=i(null);It.current||(It.current=new ca(Bt));const[Rt,Wt]=u(null),[zt,Yt]=u(0),[Gt,qt]=u(0),[Xt,Vt]=u(!1),[Ut,Kt]=u(null),Qt=i(null),Zt=i(new Map),Jt=i(0),eo=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!Zt.current.has(t+"")){const e=Array.isArray(ae)?ae:gt;Zt.current.set(t+"",e[Jt.current++%e.length])}return Zt.current.get(t+"")}}if(Zt.current.has(e.id))return Zt.current.get(e.id);const t=Array.isArray(ae)?ae:gt,o=se?t[Jt.current++%t.length]:t[0];return Zt.current.set(e.id,o),o},[se,ae]),oo=(null===(a=null==Ct?void 0:Ct.colors)||void 0===a?void 0:a.border)||(null===(c=null==Ct?void 0:Ct.colors)||void 0===c?void 0:c.secondary)||(null===(d=null==Ct?void 0:Ct.colors)||void 0===d?void 0:d.primary)||"#999",no=l(e=>{var t,o;return e?"object"==typeof e?e:null!==(o=null===(t=It.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==o?o:null:null},[]),io=l(e=>{if("function"==typeof le)return le(e);const t=no(e.source),o=no(e.target);return"target"===le&&o?eo(o):t?eo(t):oo},[le,eo,oo,no]),ro=l(e=>{if("function"==typeof Tt.color){const t=no(e.source);return t?Tt.color(e,t):oo}if(!(null==ne?void 0:ne.colorBy))return io(e);const t=Tt.colorBy,o=no(e.source),n=no(e.target);return"target"===t&&n?eo(n):o?eo(o):oo},[null==ne?void 0:ne.colorBy,Tt.color,Tt.colorBy,eo,io,oo,no]),so=("sankey"===M||!!st)&&oe||!!Ye||null!==(g=null===(h=It.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;s(()=>{var e;null===(e=It.current)||void 0===e||e.updateConfig(Bt),ct.current=!0,Ot()},[Bt,Ot]);const ao=l(()=>{var e,t;Kt(null!==(t=null===(e=It.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);s(()=>{var e;const t=It.current;if(t){t.buildScene([yt,mt]),ao();for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);ct.current=!0,Ot()}},[Ct,yt,mt,Ot,ao]);const lo=l(()=>{var e;const t=It.current;if(!t)return;t.runLayout([yt,mt]),t.buildScene([yt,mt]),ao(),ct.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill);const o=Array.isArray(ae)?ae:gt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];Zt.current.has(t.id)||Zt.current.set(t.id,o[e%o.length])}if(Jt.current=n.length,Yt(t.layoutVersion),Pe){const{nodes:e,edges:o}=t.getLayoutData();Pe(e,o)}},[yt,mt,Pe,ae,ao]),co=l(e=>{if(null==e||"object"!=typeof e)return;const t=It.current;t&&(t.ingestEdge(e)&&lo(),Ot())},[lo,Ot]),uo=l(e=>{const t=It.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&lo(),Ot()},[lo,Ot]),ho=l(()=>{var e;null===(e=It.current)||void 0===e||e.clear(),Zt.current.clear(),Jt.current=0,Yt(0),Wt(null),Qt.current=null,ct.current=!0,Ot()},[Ot]),go=l(()=>{const e=It.current;e&&(e.tension+=999,lo(),Ot())},[lo,Ot]);p(n,()=>({push:co,pushMany:uo,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=It.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=Qt.current)||void 0===n?void 0:n.data)?"function"==typeof N?N(Qt.current.data):Qt.current.data[N]:void 0;Qt.current&&"node"===Qt.current.nodeOrEdge&&t===e&&(Qt.current=null,Wt(null)),Zt.current.delete(e),lo(),ct.current=!0,Ot()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(Qt.current&&"edge"===Qt.current.nodeOrEdge){const o=Qt.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!D||!o||("function"==typeof D?D:e=>null==e?void 0:e[D])(o)===e,n&&(Qt.current=null,Wt(null))}lo(),ct.current=!0,Ot()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=It.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(ct.current=!0,Ot()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=It.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(lo(),ct.current=!0,Ot()),r},clear:ho,getTopology:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=It.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:go,getTension:()=>{var e,t;return null!==(t=null===(e=It.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[co,uo,ho,go,lo,Ot]);const fo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(M),po=fo?L||(Array.isArray(P)?void 0:P):void 0;s(()=>{var e;const t=It.current;if(t)if(fo&&po)t.ingestHierarchy(po,[yt,mt]),t.buildScene([yt,mt]),ao(),ct.current=!0,Ot();else{const o=_t,n=Array.isArray(Pt)?Pt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[yt,mt]),t.buildScene([yt,mt]),ao();for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&Zt.current.set(o.id,o.style.fill+"");const i=Array.isArray(ae)?ae:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];Zt.current.has(t.id)||Zt.current.set(t.id,i[e%i.length])}Jt.current=r.length,ct.current=!0,Ot()}},[_t,Pt,L,po,fo,yt,mt,Bt,Ot,ae,ao]),s(()=>{T&&T.length>0&&uo(T)},[]);const yo=l(e=>{if(Ce&&Ce(e),Me){const t=Date.now();Me(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:_e}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:_e})}},[Ce,Me,_e]),mo=l(e=>{if(je&&je(e),Me){const t=Date.now();Me(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:_e}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:_e})}},[je,Me,_e]),{hoverHandlerRef:vo,hoverLeaveRef:bo,onPointerMove:Ao,onPointerLeave:Oo}=dt;vo.current=e=>{if(!Se)return;const t=$t.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-pt.left,i=e.clientY-o.top-pt.top;if(0>n||n>yt||0>i||i>mt)return void(Qt.current&&(Qt.current=null,Wt(null),yo&&(yo(null),ct.current=!0),Ot()));const r=It.current;if(!r)return;const s=ga(r.sceneNodes,r.sceneEdges,n,i);if(!s)return void(Qt.current&&(Qt.current=null,Wt(null),yo&&(yo(null),ct.current=!0),Ot()));const a=ui(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});Qt.current=a,Wt(a),yo&&(yo(a),ct.current=!0),Ot()},bo.current=()=>{Qt.current&&(Qt.current=null,Wt(null),yo&&(yo(null),ct.current=!0),Ot())};const jo=i(()=>{});jo.current=e=>{if(!je&&!Me)return;const t=$t.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-pt.left,i=e.clientY-o.top-pt.top;if(0>n||n>yt||0>i||i>mt)return;const r=It.current;if(!r)return;const s=ga(r.sceneNodes,r.sceneEdges,n,i);mo(s?ui(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const Mo=l(e=>jo.current(e),[]),_o=i(-1),Po=i(null),Lo=i(-1),To=l(e=>{var t;const o=It.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=xo(n),r=_o.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),_o.current=0,Lo.current=-1;const t=i.flat[0];Po.current={shape:t.shape,w:t.w,h:t.h};const o=ui(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qt.current=o,Wt(o),yo&&(yo(o),ct.current=!0),void Ot()}const s=ko(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return wo(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const d=a*a+l*l;i>d&&(i=d,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=So(t.source),s=So(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=wo(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],Lo);if(null===a)return;if(e.preventDefault(),0>a)return _o.current=-1,Po.current=null,Lo.current=-1,Qt.current=null,Wt(null),yo&&(yo(null),ct.current=!0),void Ot();_o.current=a;const l=i.flat[a];Po.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qt.current=c,Wt(c),yo&&(yo(c),ct.current=!0),Ot()},[yo,Ot]),No=l(e=>{_o.current=-1,Po.current=null,Ao(e)},[Ao]);St.current=()=>{var e,t,o,n,i,r,s;At.current=0;const a=$t.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=It.current;if(!c)return;const d=performance.now(),u=Et.current?Math.min((d-Et.current)/1e3,.1):.016;Et.current=d;const h=c.advanceTransition(ut.current?d+1e6:d),g=!ut.current&&h,f=!ut.current&&c.tickAnimation([yt,mt],u);(h||ct.current||f)&&c.buildScene([yt,mt]);const p=Ci();if(!Oi(a,ft,pt,p))return;if(l.clearRect(-pt.left,-pt.top,ft[0],ft[1]),Ae){const e=to(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,yt,mt))}ze&&c.applyDecay(),Ye&&c.applyPulse(d),Ve&&c.applyThresholds(d),c.applyTopologyDiff(d);const y=null!==(e=null==Xe?void 0:Xe.threshold)&&void 0!==e?e:5e3,m=Xe&&c.lastIngestTime>0&&d-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Xe?void 0:Xe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":wa(e,o);break;case"line":Aa(e,o);break;case"ribbon":Sa(e,o);break;case"curved":Oa(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),Li(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),Ti(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&to(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:zr.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:zr.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let d=l;Math.random()<c&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,u,Tt);const t=.5*(null!==(o=Tt.speedMultiplier)&&void 0!==o?o:1);let n;if(Tt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(u,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:zr.radius,l=null!==(s=n.opacity)&&void 0!==s?s:zr.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:i(l),e.fillStyle=to(e,c)||c,e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Tt,ro)}}m&&(l.globalAlpha=1);const v=ct.current;if(ct.current=!1,v||g||f){const e=$t.current;e&&e.setAttribute("aria-label",Yn(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=v||g||f||Ht.current;b&&d-Dt.current>=33?(qt(e=>e+1),Dt.current=d,Ht.current=!1):Ht.current=!!b,(so||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Ht.current)&&(At.current=requestAnimationFrame(()=>St.current()))},Bn({hydrated:jt,wasHydratingFromSSR:Mt,storeRef:It,dirtyRef:ct,renderFnRef:St}),s(()=>{ct.current=!0,Ot()},[M,yt,mt,Ae,Ot]),Co(Xe,It,ct,Ot,Xt,Vt);const Bo=Se&&Rt?e(bi,{x:Rt.x,y:Rt.y,containerWidth:yt,containerHeight:mt,margin:pt,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(Rt):e(La,{data:Rt})}):null;if(jn||!jt&&Mt){const o=It.current;if(o){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(M),t=e?L||(Array.isArray(P)?void 0:P):void 0;if(e&&t)o.ingestHierarchy(t,[yt,mt]),o.buildScene([yt,mt]);else{const e=_t,t=Array.isArray(Pt)?Pt:[];(e.length>0||t.length>0)&&(o.ingestBounded(e,t,[yt,mt]),o.buildScene([yt,mt]))}}const n=null!==(f=null==o?void 0:o.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==o?void 0:o.sceneEdges)&&void 0!==y?y:[],r=null!==(m=null==o?void 0:o.labels)&&void 0!==m?m:[];return t("div",{ref:ht,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Ke||("string"==typeof Re?Re:"Network chart"),style:{position:"relative",width:ve?"100%":ft[0],height:be?"100%":ft[1]},children:[e(ri,{summary:Qe}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ft[0],height:ft[1],style:{position:"absolute",left:0,top:0},children:[bt&&e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt}),t("g",{transform:`translate(${pt.left},${pt.top})`,children:[Ae&&e("rect",{x:0,y:0,width:yt,height:mt,fill:Ae}),i.map((t,o)=>function(t,o){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:On(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:On(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:On(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),n.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:On(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:On(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=I().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Sn)||"";return e("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:On(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),r.map((t,o)=>function(t,o){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e(xa,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:r,sceneNodes:n,title:Re,legend:Ne,legendPosition:Be,legendLayout:$e,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:He,legendIsolatedCategories:Ie,foregroundGraphics:Ft(vt,null===(v=It.current)||void 0===v?void 0:v.customLayoutOverlays),annotations:Le,svgAnnotationRules:Te,annotationFrame:0})]})}const $o=It.current;return t("div",{ref:ht,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Ke||("string"==typeof Re?Re:"Network chart"),tabIndex:0,style:{position:"relative",width:ve?"100%":ft[0],height:be?"100%":ft[1],overflow:"visible"},onKeyDown:To,children:[Ue&&e(si,{tableId:wt}),Ue&&e(ii,{nodes:null!==(b=null==$o?void 0:$o.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==$o?void 0:$o.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:wt,chartTitle:"string"==typeof Re?Re:void 0}),e(ri,{summary:Qe}),t("div",{role:"img","aria-label":Ke||("string"==typeof Re?Re:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?No:void 0,onMouseLeave:Se?Oo:void 0,onClick:je||Me?Mo:void 0,children:[bt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${pt.left},${pt.top})`,children:bt})}),e("canvas",{ref:$t,"aria-label":Yn(null!==(w=null===(k=null==$o?void 0:$o.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==$o?void 0:$o.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(ai,{hoverPoint:Rt}),e(xa,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:(null==$o?void 0:$o.labels)||[],sceneNodes:null==$o?void 0:$o.sceneNodes,title:Re,legend:Ne,legendPosition:Be,legendLayout:$e,legendHoverBehavior:Ee,legendClickBehavior:De,legendHighlightedCategory:He,legendIsolatedCategories:Ie,foregroundGraphics:Ft(vt,Ut),annotations:Le,svgAnnotationRules:Te,annotationFrame:Gt}),e(ci,{active:_o.current>=0,hoverPoint:Rt,margin:pt,size:ft,shape:null===(O=Po.current)||void 0===O?void 0:O.shape,width:null===(C=Po.current)||void 0===C?void 0:C.w,height:null===(j=Po.current)||void 0===j?void 0:j.h}),Bo,(null==Xe?void 0:Xe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Xe.badgePosition?{top:4,left:4}:"bottom-left"===Xe.badgePosition?{bottom:4,left:4}:"bottom-right"===Xe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Xt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Xt?"STALE":"LIVE"})]})]})});function Na(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),o&&(l.description=o),n&&(l.summary=n),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function Ba(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function $a(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:vi(t)||o}}function Ea(e){return"string"==typeof e?e:"value"}function Da(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ha(e,t){if(!t)return Da(e);try{const o=t(e);return null==o?Da(e):o}catch(t){return Da(e)}}function Ia(e,t){return"function"==typeof t?t(e):e[t]}function Ra(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";o.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y0)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),o.push({label:i,accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y1)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),o}function Fa(o){const n=o.find(e=>"title"===e.role),i=o.filter(e=>"title"!==e.role);return o=>{const r=o.data;if(!r)return null;const s=n?Ha(Ia(r,n.accessor),n.format):null;return t("div",{className:"semiotic-tooltip",style:hi,children:[null!=s&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:s}),i.map((o,n)=>{const i=Ha(Ia(r,o.accessor),o.format);return t("div",{style:n>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[o.label,": "]}),e("span",{children:i})]},n)})]})}}function Wa({categoryAccessor:o,valueAccessor:n,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const d=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,u=Ia(d,o),h=Ia(d,n),g=i?Ia(d,i):void 0;return t("div",{className:"semiotic-tooltip",style:hi,children:[e("div",{style:{fontWeight:"bold"},children:Da(u)}),e("div",{style:{marginTop:4},children:Ha(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||Ea(i),": ",Da(g)]})]})}}Ta.displayName="StreamNetworkFrame";const za=d(null);function Ya({colors:t,categories:o,colorScheme:n="category10",children:i}){const s=r(()=>{if(t)return t;if(o){const e=Array.isArray(n)?n:ht[n]||gt,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,n]);return e(za.Provider,{value:s,children:i})}function Ga(){return a(za)}function qa(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Xa(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(qa(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Va(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}Ya.displayName="CategoryColorProvider";const[Ua,Ka]=be(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Va(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Va(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Qa,Za]=be(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ja(e){const t=f(),o=e.clientId||t,{name:n}=e,i=Ka(e=>e.selections.get(n)),s=Ka(e=>e.setClause),a=Ka(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?Xa(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(n,{clientId:o,type:"point",fields:t})},[o,n,s]),selectInterval:l(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(n,{clientId:o,type:"interval",fields:t})},[o,n,s]),clear:l(()=>{a(n,o)},[a,n,o]),clientId:o}}function el(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:i,selectPoints:r,clear:s}=Ja({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,s,t]),predicate:n,isActive:i}}function tl(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ol(e){const{name:t,xField:o,yField:n}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=Ja({name:t}),d=o&&n?"xyBrush":o?"xBrush":"yBrush",u=l(e=>{if(!e)return void c();const t={};"xyBrush"===d&&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])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===d&&tl(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===d&&tl(e)&&n&&(t[n]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[d,o,n,a,c]);return{brushInteraction:r(()=>({brush:d,during:u,end:u}),[d,u]),predicate:i,isActive:s,clear:c}}function nl(e,t,o){const n=Ka(e=>e.selections.get(t));return r(()=>{if(!n||0===n.clauses.size)return e;const t=Xa(n,o);return e.filter(t)},[e,n,o])}function il(e={}){const{limit:t=50,types:o,chartId:n}=e,i=Za(e=>e.version),s=Za(e=>e.observations),a=Za(e=>e.clearObservations),l=r(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[s,o,n,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const rl=d(!1),sl=d(null),al="undefined"==typeof window?s:h;function ll(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function cl(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function dl(e){const t=a(sl),o=f(),n=ll(e),r=i([]);cl(r.current,n)||(r.current=n);const s=r.current;al(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),al(()=>{t&&t.registerCategories(o,s)},[t,o,s])}function ul({selections:e}){const t=Ka(e=>e.setResolution);return s(()=>{for(const[o,n]of Object.entries(e))n.resolution&&t(o,n.resolution)},[e,t]),null}function hl({categoryColors:t,interaction:o,selectionName:n,field:a}){const c=Object.entries(t),d=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=el({name:n,fields:[a]}),f=Ja({name:n,clientId:"__linked-legend-isolate__"}),[p,y]=u(new Set),[m,v]=u(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,s(()=>{"isolate"===o&&(p.size>0?b.current({[a]:Array.from(p)}):x.current())},[o,p,a]);const k=l(e=>{"highlight"===o&&(e?(v(e.label),g.onHover({[a]:e.label})):(v(null),g.onHover(null)))},[o,a,g]),w=l(e=>{"isolate"===o&&y(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===d.length?new Set:o})},[o,d.length]),[A,[S]]=ki([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(No,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===o?k:void 0,customClickBehavior:"isolate"===o?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function gl({children:o,selections:n,showLegend:s,legendPosition:a="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:d="category"}){const h=Ga(),[g,f]=u({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const o=ll(t);f(t=>{var n;return cl(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(g))for(const o of t)e.push(o);return ll(e)},[g]),v=r(()=>{var e;const t=null!=h?h:{},o=p.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of m)t[e]||o[e]||(o[e]=gt[n%gt.length],n++);const i=Object.assign({},t);for(const n of m)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[h,m]),b=void 0===s||s,x=b&&Object.keys(v).length>0;return e(Ua,{children:t(Qa,{children:[n&&e(ul,{selections:n}),e(sl.Provider,{value:y,children:e(Ya,{colors:v,children:t(rl.Provider,{value:x,children:[b&&"top"===a&&e(hl,{categoryColors:v,interaction:l,selectionName:c,field:d}),o,b&&"bottom"===a&&e(hl,{categoryColors:v,interaction:l,selectionName:c,field:d})]})})})]})})}function fl({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(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?n(s,t,o):o?o(i):ft[r%ft.length];return{label:i+"",color:a}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:a,label:""}]}}function pl(e){return e?"string"==typeof e?{name:e}:e:null}function yl(e,t,o){return t?(n,...i)=>{var r;const s=Object.assign({},e(n,...i));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(s,o.selectedStyle);else{const e=null!==(r=null==o?void 0:o.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(s,o.unselectedStyle)}return s}:e}const ml=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],vl={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},bl={light:Se,dark:Oe,"high-contrast":Ce,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function xl(e){return bl[e]}function kl(e,t=":root"){var o,n,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(o=e.tooltip)||void 0===o?void 0:o.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(n=e.tooltip)||void 0===n?void 0:n.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&a.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&a.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`}function wl(e){var t,o,n,i,r,s;return{semiotic: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({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.text)||e.colors.text,$type:"color"},radius:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}}const Al=n.createContext(void 0),Sl="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function Ol(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return xl(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Cl({theme:e}){const t=_e(e=>e.setTheme),o=_e(e=>e.theme),i=n.useRef(o);i.current=o;const r=n.useRef(null);n.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=i.current===Ce?Se:i.current,t("high-contrast")),xi(o,e=>{var o,n;e.matches?(r.current=i.current===Ce?null!==(o=r.current)&&void 0!==o?o:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===Ce?"high-contrast":t)}(t,null!==(n=r.current)&&void 0!==n?n:Se),r.current=null)})},[e,t]);const s=n.useRef(!1);return Sl(()=>{s.current?void 0!==e&&t(Ol(e)):s.current=!0},[e,t]),null}function jl({children:t}){var o,i,r,s,a;const l=_e(e=>e.theme),c=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({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-cell-border":l.colors.cellBorder||l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(o=l.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),null!=l.typography.tickSize?{"--semiotic-tick-font-size":l.typography.tickSize+"px"}:{}),null!=l.typography.labelSize?{"--semiotic-axis-label-font-size":l.typography.labelSize+"px"}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),d=n.useContext(Al),u={};return d&&(u["data-semiotic-theme"]=d),e("div",Object.assign({style:c},u,{children:t}))}function Ml({theme:o,children:i}){const r="string"==typeof o&&xl(o)?o:void 0,s=n.useMemo(()=>function(e){return void 0!==e?je(Se,Ol(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ce:Se}(o),[o]);return e(Me,{initialState:{theme:s},children:t(Al.Provider,{value:r,children:[e(Cl,{theme:o}),e(jl,{children:i})]})})}function _l(){return _e(e=>e.theme)}const Pl="#007bff";function Ll(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function Tl(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 Nl(){var e;const t=_l(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function Bl(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=ht[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:Pl}function $l(e,t,o){const n=Ga(),i=Nl();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=vt(o.map(e=>({_cat:e})),"_cat",s);return t=>n[t]||e(t)}return vt(o.map(e=>({_cat:e})),"_cat",s)}if(n&&Object.keys(n).length>0){const o=vt(e,t,s);return e=>n[e]||o(e)}return vt(e,t,s)}if(n&&Object.keys(n).length>0){const e=vt([{_:"a"}],"_",s);return t=>n[t]||e(t)}},[e,t,o,n,i])}function El(e,t,o){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(o);return n.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,o])}function Dl({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:i,chartType:a,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const p=f(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,o),m=Ja({name:(null==e?void 0:e.name)||"__unused__"}),v=el({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||o||[]}),b=Za(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=u(null),A=g||o[0],S=r(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[h,k,A]),O=l(e=>{var o,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const o=Ll(e,t,y.xField);null!=o&&function(e,t,o){const n=Zo.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(Zo={positions:new Map(Zo.positions).set(e,{xValue:t,sourceId:o})},en())}(y.name||"hover",o,p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&tn(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[A];w(null!=o?o+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const r=Tl(e),s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,v,y,p,i,a,c,b,h,A]),C=l(e=>{var t,o,n,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=Ll(e,t,y.xField);null!=o&&function(e,t,o){const n=Zo.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(Zo.positions);return t.delete(e),Zo={positions:t},en(),!1}Zo={positions:new Map(Zo.positions).set(e,{xValue:t,sourceId:o,locked:!0})},en()}(y.name||"hover",o,p)}if(e&&d){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),d(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(i||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:c};if(e){const o=Tl(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),b&&b(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[d,i,b,a,c,y,p]);return s(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{on(e,p),tn(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:C,crosshairSourceId:p}}function Hl(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function Il({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const d=a(rl),u=null!==a(sl),h=void 0!==n?n:!d&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[c,t,e,g]);dl(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const n=fl({data:e,colorBy:t,colorScale:o,getColor:mt,categories:f}),i=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?n:void 0},[h,t,e,o,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const o=e[t];return"number"==typeof o?o:l[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return p&&("right"===i&&!n("right")&&110>o.right?o.right=110:"left"===i&&!n("left")&&110>o.left?o.left=110:"top"===i&&!n("top")&&50>o.top?o.top=50:"bottom"===i&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[l,s,p,i]);return{legend:p,margin:y,legendPosition:i}}function Rl(e,t,o){const[n,i]=u(null),[s,a]=u(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=l(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]),h=r(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return s.has(n)}}:null},[e,t,n,s]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}const Fl={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 Wl(e,t,o){var n,i,r,s,a,l,c;const d=Fl[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?d.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?d.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:d.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:d.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||d.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:d.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:d.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:zl(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function zl(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function Yl({componentName:o,message:n,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:o}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Gl extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e(Yl,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ql;const Xl="undefined"!=typeof process&&"production"!==(null===(ql=process.env)||void 0===ql?void 0:ql.NODE_ENV);function Vl({componentName:t,width:o,height:n,children:i}){return e(Gl,{fallback:i=>e(Yl,{componentName:t,message:i.message,width:o,height:n}),children:i})}const Ul={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"},Kl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ql(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Ul),{width:o,height:n}),children:i||"No data available"}):null}function Zl(t,o,n,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:o,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(n/40)),s=Math.max(8,Math.floor(n/(3*r))),a=Math.max(6,Math.floor(n/(2.5*r))),l=Math.floor((n-(r*(s+a)-a))/2);return e("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Kl),{position:"absolute",top:l+n*(s+a),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:s,opacity:.5+n%2*.2})},n))})}function Jl(e,t,o,n){if(!Xl)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function ec(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function tc(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function oc(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=ec(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function nc({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=tc(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=oc(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function ic({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} 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}function rc({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!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 o=tc(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=oc(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function sc(e){const t=_e(e=>e.theme.colors.selectionOpacity);return r(()=>{var o,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}function ac(e){const{data:t,rawData:o,colorBy:n,colorScheme:i,legendInteraction:s,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:S,width:O,height:C}=e,j=void 0===o,M=r(()=>me(t),[t]),[_,P]=u([]),L=l(e=>{P(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:N,hoverSelectionHook:B,customHoverBehavior:$,customClickBehavior:E,crosshairSourceId:D}=Dl({selection:c,linkedHover:d,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:T}),H=Hl(d,D),I=$l(M,n,i),R=r(()=>{if(!n)return[];const e=new Set;for(const t of M){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[M,n]),F=r(()=>j&&_.length>0?_:R,[j,_,R]),W=Rl(s,n,F),z=r(()=>B||(W.legendSelectionHook?W.legendSelectionHook:N),[B,W.legendSelectionHook,N]),Y=sc(c),G=Nl(),q=Ga(),X=r(()=>{if(I)return I;if(!n||0===F.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:ft,t="__streamCat",o=vt(F.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||o(e)||"#999"},[I,n,F,i,G,q]),{legend:V,margin:U,legendPosition:K}=Il({data:M,colorBy:n,colorScale:X,showLegend:m,legendPosition:a,userMargin:v,defaults:b,categories:F}),Q=r(()=>{const e={};return V&&(e.legend=V,e.legendPosition=K),s&&"none"!==s&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),j&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=L),e},[V,K,s,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,j,n,L]),Z=Array.isArray(o)?me(o):o,J=Zl(w,O,C,A),ee=J?null:Ql(Z,O,C,S);return{data:M,colorScale:I,allCategories:F,legendState:W,effectiveSelectionHook:z,activeSelectionHook:N,customHoverBehavior:$,customClickBehavior:E,legend:V,margin:U,legendPosition:K,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:H,resolvedSelection:Y}}function lc(e,t){const{variant:o,frameRef:n,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);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,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i,r;const s=null!==(i=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(o(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,n);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function cc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function dc(e){const{colorBy:t,colorScale:o,color:n,pointRadius:i=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,d=r?Object.assign({},r):{};if(void 0===d.fillOpacity&&(d.fillOpacity=a),void 0===d.fill)if(t){if(o){const n=p?p(e):e;d.fill=mt(n,t,o)}}else d.fill=l?l(e):n||Pl;return void 0===d.r&&(d.r=s?s(e):i),d},[t,o,n,i,s,a,l,c,p]),m=r(()=>cc(y,{stroke:d,strokeWidth:u,opacity:h}),[y,d,u,h]);return r(()=>yl(m,null!=g?g:null,f),[m,g,f])}function uc(e){const{accessor:t,data:o,isPushMode:n}=e,s=i(null),[a,c]=u(0),d=l(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,o=!0),i>s.current[1]&&(s.current[1]=i,o=!0)):(s.current=[i,i],o=!0))}o&&c(e=>e+1)},[n,t]),h=l(()=>{n&&(s.current=null,c(e=>e+1))},[n]),g=r(()=>{var e;if(n)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!t||0===o.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const e of o){const t=i(e);if(null==t)continue;const o="number"==typeof t?t:Number(t);Number.isFinite(o)&&(r>o&&(r=o),o>a&&(a=o))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,a]);return{domain:g,trackPushed:d,reset:h}}function hc(e){var t;if(!e)return;const o="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=o.method)&&void 0!==t?t:"linear"},null!=o.bandwidth&&{bandwidth:o.bandwidth}),null!=o.order&&{order:o.order}),null!=o.color&&{color:o.color}),null!=o.strokeWidth&&{strokeWidth:o.strokeWidth}),null!=o.strokeDasharray&&{strokeDasharray:o.strokeDasharray}),null!=o.label&&{label:o.label})}function gc(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}function fc(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const pc="__forecastSegment";let yc=null;function mc(){return fc(this,void 0,void 0,function*(){return yc||(yc=yield import("./semiotic-statisticalOverlays-C3DsOgr_.js")),yc})}const vc="__semiotic_resolvedX",bc="__semiotic_resolvedY";function xc(e){const{data:t,xAccessor:o,yAccessor:n,forecast:a,anomaly:l,groupBy:c}=e,d="string"==typeof o?o:vc,h="string"==typeof n?n:bc,g=r(()=>{if(!a&&!l)return t;const e="function"==typeof o,i="function"==typeof n;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[vc]=o(t)),i&&(r[bc]=n(t)),r}):t},[t,a,l,o,n]),[f,p]=u(null),[y,m]=u([]),v=i(a),b=i(l);return s(()=>{if(!a&&!l)return void((v.current||b.current)&&(p(null),m([]),v.current=a,b.current=l));let e=!1;const t=a!==v.current||l!==b.current;if(v.current=a,b.current=l,t&&(p(null),m([])),a){const t=c&&"string"==typeof c&&"object"==typeof a?Object.assign(Object.assign({},a),{_groupBy:c}):a;(function(...e){return fc(this,void 0,void 0,function*(){return(yield mc()).buildForecast(...e)})})(g,d,h,t,l).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else l&&function(...e){return fc(this,void 0,void 0,function*(){return(yield mc()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[g,a,l,d,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:d,yAccessorKey:h}}const kc=g(function(t,o){const s=i(null),a=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:S,marginalGraphics:O,pointIdAccessor:C,annotations:j,regression:M,forecast:_,anomaly:P,xExtent:L,yExtent:T,frameProps:N={},selection:B,linkedHover:$,linkedBrush:E,onObservation:D,onClick:H,hoverHighlight:I,chartId:R,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,color:q,stroke:X,strokeWidth:V,opacity:U}=t,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:ie,xLabel:re,yLabel:se}=a,ae=r(()=>me(c),[c]),le=void 0===c,{domain:ce,trackPushed:de,reset:ue}=uc({accessor:x,data:ae,isPushMode:le}),he=l(e=>{var t;de([e]),null===(t=s.current)||void 0===t||t.push(e)},[de]),ge=l(e=>{var t;de(e),null===(t=s.current)||void 0===t||t.pushMany(e)},[de]);lc(o,{variant:"xy",frameRef:s,overrides:{push:he,pushMany:ge,clear:()=>{var e;ue(),null===(e=s.current)||void 0===e||e.clear()}},deps:[he,ge,ue]});const fe=ac({data:ae,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:B,linkedHover:$,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:D,onClick:H,hoverHighlight:I,chartType:"Scatterplot",chartId:R,showLegend:ee,userMargin:d,marginDefaults:a.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:K,height:Q}),pe=pl(E),ye=ol({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof f?f:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof p?p:void 0)}),ve=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,be=n.useRef(ye.brushInteraction);be.current=ye.brushInteraction;const xe=l(e=>{const t=be.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(fe.earlyReturn)return fe.earlyReturn;Jl("Scatterplot",ae,"xAccessor",f),Jl("Scatterplot",ae,"yAccessor",p);const ke=r(()=>x?null!=ce?ce:[0,1]:void 0,[x,ce]),we=r(()=>x?e=>bt(e,x,k,ke):void 0,[x,k,ke]),Ae=dc({colorBy:v,colorScale:fe.colorScale,color:q,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:X,strokeWidth:V,opacity:U,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Se=r(()=>Fa([{label:re||Ea(f),accessor:f,role:"x",format:h},{label:se||Ea(p),accessor:p,role:"y",format:g},...v?[{label:Ea(v),accessor:v,role:"color"}]:[],...x?[{label:Ea(x),accessor:x,role:"size"}]:[]]),[f,p,re,se,v,x,h,g]),{effectiveData:Oe,statisticalAnnotations:Ce}=xc({data:ae,xAccessor:f,yAccessor:p,forecast:_,anomaly:P}),je=r(()=>{const e=hc(M);return e||0!==Ce.length?[...e?[e]:[],...j||[],...Ce]:j},[M,j,Ce]),Me=nc({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(Me)return e(Yl,{componentName:"Scatterplot",message:Me,width:K,height:Q});const _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({chartType:"scatter"},null!=c&&{data:Oe}),{xAccessor:f,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[K,Q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:fe.margin,showAxes:a.showAxes,xLabel:re,yLabel:se,xFormat:h,yFormat:g,enableHover:Z,showGrid:J}),fe.legendBehaviorProps),Na({title:te,description:oe,summary:ne,accessibleTable:ie,className:u,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:S,defaultTooltipContent:Se})),Ba({linkedHover:$,onObservation:D,onClick:H,hoverHighlight:I,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior})),O&&{marginalGraphics:O}),C&&{pointIdAccessor:C}),je&&je.length>0&&{annotations:je}),L&&{xExtent:L}),T&&{yExtent:T}),pe&&{brush:{dimension:ve},onBrush:xe}),fe.crosshairProps),N);return e(Vl,{componentName:"Scatterplot",width:K,height:Q,children:e(nr,Object.assign({ref:s},_e))})});function wc(e,t){return Je(1===t?.5:e/(t-1))}kc.displayName="Scatterplot";const Ac=g(function(t,n){var s,a;const l=i(null);lc(n,{variant:"xy",frameRef:l});const c=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:d,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:S,anomaly:O,xExtent:C,yExtent:j,frameProps:M={},selection:_,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:N,chartId:B,loading:$,loadingContent:E,emptyContent:D,legendInteraction:H,stroke:I,strokeWidth:R,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,title:q,description:X,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=d||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let o=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];o=[...Z].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[Z,m,p,y]);Jl("ConnectedScatterplot",J,"xAccessor",p),Jl("ConnectedScatterplot",J,"yAccessor",y);const te=ac({data:J,rawData:d,colorBy:void 0,colorScheme:void 0,legendInteraction:H,selection:_,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:N,chartType:"ConnectedScatterplot",chartId:B,showLegend:void 0,userMargin:u,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:$,loadingContent:E,emptyContent:D,width:W,height:z}),oe=null!==(a=null===(s=te.resolvedSelection)||void 0===s?void 0:s.unselectedOpacity)&&void 0!==a?a:.5,ne=r(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,d=s.length;e.lineCap="round";for(let t=0;d-1>t;t++){const o=s[t],n=s[t+1],u=wc(t,d),h=!a||!l||l(null!==(i=o.datum)&&void 0!==i?i:o)||l(null!==(r=n.datum)&&void 0!==r?r:n),g=a?h?1:oe:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=u,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,oe]),ie=r(()=>[ne],[ne]),re=r(()=>(t,n,i)=>{var r,s;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const l=a.length,c=100>l,d=[];for(let t=0;l-1>t;t++){const o=a[t],n=a[t+1],i=wc(t,l),u="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,h="number"==typeof(null===(s=n.style)||void 0===s?void 0:s.opacity)?n.style.opacity:1,g=Math.min(u,h);c&&d.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),d.push(e("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(o,{children:d})},[b]),se=r(()=>[re],[re]),ae=r(()=>e=>{var t,o;const n=ee.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?wc(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),le=dc({colorScale:void 0,baseStyleExtras:ae,stroke:I,strokeWidth:R,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),de=r(()=>Fa([{label:K||Ea(p),accessor:p,role:"x",format:g},{label:Q||Ea(y),accessor:y,role:"y",format:f},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,g,f]),ue=nc({componentName:"ConnectedScatterplot",data:d,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:ge}=xc({data:J,xAccessor:p,yAccessor:y,forecast:S,anomaly:O}),fe=hc(A),pe=fe||ge.length>0?[...fe?[fe]:[],...w||[],...ge]:w,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=d&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:le,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:Y,showGrid:G}),Na({title:q,description:X,summary:V,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:x,defaultTooltipContent:de})),Ba({linkedHover:P,onObservation:L,onClick:T,hoverHighlight:N,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:se}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),j&&{yExtent:j}),te.crosshairProps),M);return te.earlyReturn?te.earlyReturn:ue?e(Yl,{componentName:"ConnectedScatterplot",message:ue,width:W,height:z}):e(Vl,{componentName:"ConnectedScatterplot",width:W,height:z,children:e(nr,Object.assign({ref:l},ye))})});function Sc(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:i,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},d=!0===a||Array.isArray(a)&&null!=r&&a.includes(r);let u;return s?u=s(e,r):o?n&&(u=mt(e,o,n)):u=i||Pl,void 0!==u&&(c.stroke=u,d&&(c.fill=u,c.fillOpacity=l)),c},[t,o,n,i,s,a,l]),p=r(()=>cc(f,{stroke:c,strokeWidth:d,opacity:u}),[f,c,d,u]);return r(()=>yl(p,null!=h?h:null,g),[p,h,g])}Ac.displayName="ConnectedScatterplot";const Oc=g(function(t,o){var n,a;const c=i(null);lc(o,{variant:"xy",frameRef:c});const d=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:C=3,fillArea:j=!1,areaOpacity:M=.3,lineWidth:_=2,lineGradient:P,tooltip:L,pointIdAccessor:T,annotations:N,directLabel:B,gapStrategy:$="break",anomaly:E,forecast:D,band:H,xExtent:I,yExtent:R,frameProps:F={},selection:W,linkedHover:z,onObservation:Y,onClick:G,hoverHighlight:q,hoverRadius:X,chartId:V,loading:U,loadingContent:K,emptyContent:Q,legendInteraction:Z,legendPosition:J,xScaleType:ee,yScaleType:te,color:oe,stroke:ne,strokeWidth:ie,opacity:re}=t,{width:se,height:ae,enableHover:le,showGrid:ce,showLegend:de,title:ue,description:he,summary:ge,accessibleTable:fe,xLabel:pe,yLabel:ye}=d,ve=r(()=>me(h),[h]);Jl("LineChart",ve,"xAccessor",v),Jl("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=xc({data:ve,xAccessor:v,yAccessor:b,forecast:D,anomaly:E,groupBy:x}),ke="__compoundGroup",we=!(!D||!x),Ae=we?ke:D?pc:x,Se=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const o=Object.assign({},t);return o[ke]=`${e(t)}__${t[pc]||"observed"}`,o})},[be,we,x]),Oe=we?Se:be,Ce=w||x,je=r(()=>{if(!D)return;const e=D.upperBounds,t=D.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=be;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[D,be,b]),Me=l(e=>{const t="function"==typeof v?v(e):e[v],o="function"==typeof b?b(e):e[b];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[v,b]),_e=void 0!==(null===(n=Oe[0])||void 0===n?void 0:n[k]),Pe=r(()=>{if(_e)return Oe;if(Ae){const e=Oe.reduce((e,t)=>{const o="function"==typeof Ae?Ae(t):t[Ae];if(!e[o]){const n={[k]:[]};"string"==typeof Ae&&(n[Ae]=o),we&&(n[pc]=t[pc],"string"==typeof x&&(n[x]=t[x])),e[o]=n}return e[o][k].push(t),e},{});return Object.values(e)}return[{[k]:Oe}]},[Oe,Ae,k,_e]),{gapProcessedLineData:Le,hasGaps:Te}=r(()=>{if("interpolate"===$){let e=!1;const t=[];for(const o of Pe){const n=(o[k]||[]).filter(t=>!Me(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[k]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===$){let e=!1;const t=[];for(const o of Pe){const n=o[k]||[];let i=[],r=0;const s=Ae&&"string"==typeof Ae?o[Ae]:void 0;for(const a of n)if(Me(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[k]: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({},o),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===$){let e=!1;const t="string"==typeof b?b:"y",o=[];for(const n of Pe){const i=n[k]||[],r=[];for(const o of i)Me(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,$,k,Me,Ae,b]),Ne="object"==typeof B?B:{},Be=Ne.position||"end",$e=Ne.fontSize||11,Ee=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],o=new Set;for(const n of Le){const i=n[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Be?i[i.length-1]:i[0]))&&void 0!==e?e:t(n);if(null==r)continue;const s=r+"";""!==s&&o.add(s)}return Array.from(o)},[B,Ce,Le,k,Be]),De=r(()=>{if(!B)return d.marginDefaults;const e=Ee.reduce((e,t)=>Math.max(e,t.length*(.6*$e)),0),t=e+10,o="end"===Be?"right":"left";return Object.assign(Object.assign({},d.marginDefaults),{[o]:Math.max(d.marginDefaults[o]||0,t)})},[B,Ee,$e,Be,d.marginDefaults]),He=ac({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:Z,legendPosition:J,selection:W,linkedHover:z,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:G,hoverHighlight:q,chartType:"LineChart",chartId:V,showLegend:(!B||void 0!==de)&&de,userMargin:g,marginDefaults:De,loading:U,loadingContent:K,emptyContent:Q,width:se,height:ae}),Ie=He.colorScale,Re=He.customHoverBehavior,Fe=He.customClickBehavior,We=He.crosshairProps,ze=Sc({lineWidth:_,colorBy:Ce,colorScale:Ie,color:oe,fillArea:j,areaOpacity:M,stroke:ne,strokeWidth:ie,opacity:re,effectiveSelectionHook:He.effectiveSelectionHook,resolvedSelection:He.resolvedSelection}),[Ye,Ge]=u(null);s(()=>{if(!D)return void Ge(null);let e=!1;return function(...e){return fc(this,void 0,void 0,function*(){return(yield mc()).createSegmentLineStyle(...e)})}(ze,D).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[ze,D]);const qe=Ye||ze,Xe=r(()=>{if(O)return e=>{const t={r:C,fillOpacity:1};return Ce?Ie&&(t.fill=mt(e.parentLine||e,Ce,Ie)):t.fill=oe||Pl,t}},[O,C,Ce,Ie,oe]),Ve=Array.isArray(j)?"mixed":j?"area":"line",Ue=r(()=>{var e;if(!B||!Ce)return[];const t="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],n="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const o=t[k]||[];if(0===o.length)continue;const r="end"===Be?o[o.length-1]:o[0],s=null!==(e=n(r))&&void 0!==e?e:n(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,n])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(n),["string"==typeof b?b:"y"]:o(n),dx:"end"===Be?6:-6,dy:0,color:Ie?Ie(e):Pl,fontSize:$e}));r.sort((e,t)=>{const o="string"==typeof b?b:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",o=r[e-1],n=r[e];$e+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=$e+2)}return r},[B,Ce,Ie,Le,k,v,b,Be,$e]),Ke=He.margin,Qe=x||w,Ze=r(()=>Fa([{label:pe||Ea(v),accessor:v,role:"x",format:p},{label:ye||Ea(b),accessor:b,role:"y",format:y},...Qe?[{label:Ea(Qe),accessor:Qe,role:"group"}]:[],...Ra(H,y)]),[v,b,pe,ye,Qe,p,y,H]),Je=nc({componentName:"LineChart",data:_e?(null===(a=be[0])||void 0===a?void 0:a[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),et=r(()=>_e||Ae||Te?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Oe,[Le,k,_e,Ae,Oe,Te]),tt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ve},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=X&&{hoverRadius:X}),null!=h&&{data:et}),{xAccessor:v,yAccessor:b,xScaleType:ee,yScaleType:te}),I&&{xExtent:I}),!R||null==R[0]&&null==R[1]?je?{yExtent:je}:{}:{yExtent:R}),{groupAccessor:"break"===$&&Te?"_gapSegment":Ae||void 0}),H&&{band:H}),{curve:S,lineStyle:qe}),O&&{pointStyle:Xe}),{size:[se,ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Ke,showAxes:d.showAxes,xLabel:pe,yLabel:ye,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),{enableHover:le,showGrid:ce}),He.legendBehaviorProps),ue&&{title:ue}),he&&{description:he}),ge&&{summary:ge}),void 0!==fe&&{accessibleTable:fe}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?mi():vi(L)||Ze}),"multi"===L&&{tooltipMode:"multi"}),(z||Y||G||q)&&{customHoverBehavior:Re}),(Y||G||z)&&{customClickBehavior:Fe}),T&&{pointIdAccessor:T}),((null==N?void 0:N.length)||xe.length||Ue.length)&&{annotations:[...N||[],...xe,...Ue]}),We),F);return He.earlyReturn?He.earlyReturn:Je?e(Yl,{componentName:"LineChart",message:Je,width:se,height:ae}):e(Vl,{componentName:"LineChart",width:se,height:ae,children:e(nr,Object.assign({ref:c},tt))})});function Cc(e){var t;const{safeData:o,data:n,areaBy:i,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:d,strokeWidth:u,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:S,yFormat:O,groupField:C}=e,j=void 0!==(null===(t=o[0])||void 0===t?void 0:t[s]),M=r(()=>{if(null==n)return[];if(!j&&!i)return o;let e;if(j)e=o;else{const t=i,n=o.reduce((e,o)=>{const n="function"==typeof t?t(o):o[t];if(!e[n]){const o={[s]:[]};"string"==typeof t&&(o[t]=n),e[n]=o}return e[n][s].push(o),e},{});e=Object.values(n)}return e.flatMap(e=>{const t=e[s]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[n,o,i,s,j]),_=r(()=>e=>{const t={};if(a){if(l){const o=mt(e,a,l);t.fill=o,y?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=c||Pl;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[a,l,c,p,y,m]),P=r(()=>cc(_,{stroke:d,strokeWidth:u,opacity:h}),[_,d,u,h]);return{flattenedData:M,lineStyle:r(()=>yl(P,null!=g?g:null,f),[P,g,f]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=mt(e.parentLine||e,a,l)):t.fill=c||Pl,t}},[v,b,a,l,c]),defaultTooltipContent:r(()=>Fa([{label:w||Ea(x),accessor:x,role:"x",format:S},{label:A||Ea(k),accessor:k,role:"y",format:O},...C?[{label:Ea(C),accessor:C,role:"group"}]:[],...Ra(e.band,O)]),[x,k,w,A,C,S,O,e.band])}}function jc(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}Oc.displayName="LineChart";const Mc=g(function(t,o){const n=i(null);lc(o,{variant:"xy",frameRef:n});const s=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:C=!1,pointRadius:j=3,tooltip:M,annotations:_,forecast:P,anomaly:L,band:T,xExtent:N,yExtent:B,frameProps:$={},selection:E,linkedHover:D,onObservation:H,onClick:I,hoverHighlight:R,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ne,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=s,le=r(()=>me(a),[a]),ce=b||f,de=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:jc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Jl("AreaChart",le,"xAccessor",h),Jl("AreaChart",le,"yAccessor",g);const ue=ac({data:le,rawData:a,colorBy:ce,colorScheme:x,legendInteraction:G,legendPosition:q,selection:E,linkedHover:D,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:H,onClick:I,hoverHighlight:R,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:l,marginDefaults:s.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=xc({data:le,xAccessor:h,yAccessor:g,forecast:P,anomaly:L,groupBy:f}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:ve}=Cc({safeData:he,data:a,areaBy:f,lineDataAccessor:v,colorBy:ce,colorScale:ue.colorScale,color:X,stroke:V,strokeWidth:U,opacity:K,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:w,showLine:S,lineWidth:O,showPoints:C,pointRadius:j,xAccessor:h,yAccessor:g,xLabel:se,yLabel:ae,xFormat:d,yFormat:u,groupField:f||b,band:T}),be=nc({componentName:"AreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=a&&{data:fe}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),T&&{band:T}),de&&{gradientFill:de}),A&&{lineGradient:A}),{curve:k,lineStyle:pe}),C&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue.margin,showAxes:s.showAxes,xLabel:se,yLabel:ae,xFormat:d,yFormat:u,enableHover:J}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:ee}),ue.legendBehaviorProps),Na({title:oe,description:ne,summary:ie,accessibleTable:re,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===M?{tooltipContent:mi(),tooltipMode:"multi"}:$a({tooltip:M,defaultTooltipContent:ve})),Ba({linkedHover:D,onObservation:H,onClick:I,hoverHighlight:R,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),N&&{xExtent:N}),B&&{yExtent:B}),ue.crosshairProps),$);return ue.earlyReturn?ue.earlyReturn:be?e(Yl,{componentName:"AreaChart",message:be,width:Q,height:Z}):e(Vl,{componentName:"AreaChart",width:Q,height:Z,children:e(nr,Object.assign({ref:n},xe))})});function _c(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}Mc.displayName="AreaChart";const Pc=g(function(o,n){const s=i(null),a=Wl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:O=!1,pointRadius:C=3,curve:j="linear",areaOpacity:M=.6,gradientFill:_,tooltip:P,annotations:L,xExtent:T,yExtent:N,frameProps:B={},selection:$,linkedHover:E,onObservation:D,onClick:H,hoverHighlight:I,chartId:R,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,pointIdAccessor:q,windowSize:X}=o,{width:V,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:oe,xLabel:ne,yLabel:ie}=a,re=r(()=>"function"==typeof y?e=>_c(y(e)):e=>_c(e[y]),[y]),se=r(()=>"function"==typeof m?e=>_c(m(e)):e=>_c(e[m]),[m]),ae=r(()=>"function"==typeof v?e=>_c(v(e)):e=>_c(e[v]),[v]),[le,ce]=u([]),de=i([]),ue=null==c,he=r(()=>me(ue?le:c),[ue,le,c]),ge=r(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let s=0,a=null,l=null,c=[];const d=(e,t)=>e>t?"A":t>e?"B":null,u=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:u(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=o(r),y=n(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=d(p,y);if(null!==m)if(null!=a){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=p-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(f-l.x),t=l.a+n*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:u(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],a)}else for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{a=m;for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:u(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=a?a:"A");return r}(he,re,se,ae),[he,re,se,ae]),fe=r(()=>A?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),s=o(e),a=n(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-B"})}return r}(he,re,se,ae):[],[A,he,re,se,ae]),pe=r(()=>[...ge,...fe],[ge,fe]),ye=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(n,()=>{const e=e=>{const t=X&&e.length>X?e.slice(e.length-X):e;de.current=t,ce(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...de.current,t]),pushMany:t=>e([...de.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of de.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],s=de.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>ue?de.current:he,getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ue,he,q,X]);const ve=ac({data:he,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:G,selection:$,linkedHover:E,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:D,onClick:H,hoverHighlight:I,chartType:"DifferenceChart",chartId:R,showLegend:Z,userMargin:d,marginDefaults:a.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:V,height:U}),be=r(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[Z,b,x,k,w]),xe=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:M}},[k,w,M]),ke=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:S,fill:"none"}),[k,w,S]),we=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=l(o=>{var n;const i=o.data,r=o.allSeries,s=null!==(n=o.xValue)&&void 0!==n?n:null==i?void 0:i.__x;let a=null==i?void 0:i.__valA,l=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(a=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(l=t.value)}if(null!=s&&(null==a||null==l)){const e=he.find(e=>re(e)===s);e&&(null==a&&(a=se(e)),null==l&&(l=ae(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",d=g&&null!=s?g(s):null!=s?s+"":"";return t("div",{className:"semiotic-tooltip",style:hi,children:[d&&e("div",{style:{fontWeight:600,marginBottom:4},children:d}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(a)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(l)]})]}),null!=a&&null!=l&&Number.isFinite(a)&&Number.isFinite(l)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(a-l)]})]})},[he,re,se,ae,g,k,w,b,x]),Se="multi"===P,Oe=r(()=>!1===P?()=>null:Se?Ae:vi(P)||Ae,[P,Se,Ae]),Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:pe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ye,curve:j,areaStyle:xe,lineStyle:ke},O&&{pointStyle:we}),{size:[V,U],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ve.margin,showAxes:a.showAxes,xLabel:ne,yLabel:ie,xFormat:g,yFormat:f,enableHover:K,showGrid:Q}),_&&{gradientFill:!0===_?{topOpacity:.85,bottomOpacity:.15}:_}),be&&{legend:be,legendPosition:ve.legendPosition}),Na({title:J,description:ee,summary:te,accessibleTable:oe,className:h,animate:o.animate,axisExtent:o.axisExtent})),{tooltipContent:Oe}),Se&&{tooltipMode:"multi"}),Ba({linkedHover:E,onObservation:D,onClick:H,hoverHighlight:I,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),N&&{yExtent:N}),ve.crosshairProps),B);return ve.earlyReturn?ve.earlyReturn:e(Vl,{componentName:"DifferenceChart",width:V,height:U,children:e(nr,Object.assign({ref:s},Ce))})});"function"==typeof Pc&&(Pc.displayName="DifferenceChart");const Lc=g(function(t,o){const n=i(null),s=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:S=!1,baseline:O="zero",stackOrder:C,tooltip:j,annotations:M,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:N,onObservation:B,onClick:$,hoverHighlight:E,chartId:D,loading:H,loadingContent:I,emptyContent:R,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=s,ie=r(()=>me(a),[a]),re=y||f;lc(o,{variant:"xy",frameRef:n});const se=ac({data:ie,rawData:a,colorBy:re,colorScheme:m,legendInteraction:F,legendPosition:W,selection:T,linkedHover:N,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:B,onClick:$,hoverHighlight:E,chartType:"StackedAreaChart",chartId:D,showLegend:Q,userMargin:l,marginDefaults:s.marginDefaults,loading:H,loadingContent:I,emptyContent:R,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:de}=Cc({safeData:ie,data:a,areaBy:f,lineDataAccessor:p,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:oe,yLabel:ne,xFormat:d,yFormat:u,groupField:f||y}),ue=nc({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:h,yAccessor:g}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=a&&{data:ae}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:v,normalize:S,baseline:S?"zero":O,stackOrder:C,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ne,xFormat:d,yFormat:u,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),se.legendBehaviorProps),Na({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent})),"multi"===j?{tooltipContent:mi(),tooltipMode:"multi"}:$a({tooltip:j,defaultTooltipContent:de})),Ba({linkedHover:N,onObservation:B,onClick:$,hoverHighlight:E,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),M&&M.length>0&&{annotations:M}),_&&{xExtent:_}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:ue?e(Yl,{componentName:"StackedAreaChart",message:ue,width:X,height:V}):e(Vl,{componentName:"StackedAreaChart",width:X,height:V,children:e(nr,Object.assign({ref:n},he))})});Lc.displayName="StackedAreaChart";const Tc=g(function(t,o){var n;const s=i(null);lc(o,{variant:"xy",frameRef:s});const a=Wl(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:d,xAccessor:u="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:S={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,showLegend:$,legendPosition:E,legendInteraction:D}=t,{width:H,height:I,enableHover:R,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=Zl(T,H,I,N),V=X?null:Ql(l,H,I,B),U=r(()=>me(l),[l]),K=function(){var e;const t=_l();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Q=null!==(n=null!=y?y:K)&&void 0!==n?n:"blues",Z=null!=$&&$,J=null!=E?E:"right",{margin:ee}=Il({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:te,customClickBehavior:oe,crosshairSourceId:ne}=Dl({selection:C,linkedHover:j,fallbackFields:[],onObservation:M,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});sc(C);const ie=Hl(j,ne);Rl(D,void 0,[]);const re=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),se=r(()=>{const e=U.map(re);return[Math.min(...e),Math.max(...e)]},[U,re]),ae=r(()=>"custom"===Q&&m?m:O({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:ot,cividis:nt,turbo:it}[Q]||Xe).domain(se),[Q,m,se]),le=r(()=>Fa([{label:G||Ea(u),accessor:u,role:"x",format:f},{label:q||Ea(h),accessor:h,role:"y",format:p},{label:Ea(g),accessor:g,role:"value",format:b}]),[u,h,G,q,g,f,p,b]),ce=nc({componentName:"Heatmap",data:l,accessors:{xAccessor:u,yAccessor:h,valueAccessor:g}}),de=r(()=>{if(Z)return{gradient:{colorFn:e=>ae(e),domain:se,label:"string"==typeof g?g:"value",format:b}}},[Z,ae,se,g,b]),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({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:u,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==Q?Q:void 0,showValues:v,heatmapValueFormat:b,size:[H,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:R}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),de&&{legend:de,legendPosition:J}),Na({title:F,description:W,summary:z,accessibleTable:Y,className:d,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:x,defaultTooltipContent:le})),Ba({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te,customClickBehavior:oe})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ie),S);return X||V||(ce?e(Yl,{componentName:"Heatmap",message:ce,width:H,height:I}):e(Vl,{componentName:"Heatmap",width:H,height:I,children:e(nr,Object.assign({ref:s},ue))}))});Tc.displayName="Heatmap";const Nc=g(function(t,o){const n=i(null),s=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:a,margin:c,className:d,xFormat:u,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:C,xExtent:j,yExtent:M,frameProps:_={},selection:P,linkedHover:L,linkedBrush:T,onObservation:N,onClick:B,hoverHighlight:$,chartId:E,loading:D,loadingContent:H,emptyContent:I,legendInteraction:R,legendPosition:F,color:W,stroke:z,strokeWidth:Y,opacity:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=s,ne=r(()=>me(a),[a]),ie=void 0===a,re=ac({data:ne,rawData:a,colorBy:m,colorScheme:v,legendInteraction:R,legendPosition:F,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:$,chartType:"BubbleChart",chartId:E,showLegend:K,userMargin:c,marginDefaults:s.marginDefaults,loading:D,loadingContent:H,emptyContent:I,width:q,height:X}),{domain:se,trackPushed:ae,reset:le}=uc({accessor:p,data:ne,isPushMode:ie}),ce=l(e=>{var t;ae([e]),null===(t=n.current)||void 0===t||t.push(e)},[ae]),de=l(e=>{var t;ae(e),null===(t=n.current)||void 0===t||t.pushMany(e)},[ae]);lc(o,{variant:"xy",frameRef:n,overrides:{push:ce,pushMany:de,clear:()=>{var e;le(),null===(e=n.current)||void 0===e||e.clear()}},deps:[ce,de,le]});const ue=pl(T);ol({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof g?g:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof f?f:void 0)});const he=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=se?se:[0,1],[se]),fe=l(e=>bt(e,p,y,ge),[p,y,ge]),pe=dc({colorBy:m,colorScale:re.colorScale,color:W,fillOpacity:b,radiusFn:fe,baseStyleExtras:he,stroke:z,strokeWidth:Y,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ye=r(()=>Fa([{label:te||Ea(g),accessor:g,role:"x",format:u},{label:oe||Ea(f),accessor:f,role:"y",format:h},{label:Ea(p),accessor:p,role:"size"},...m?[{label:Ea(m),accessor:m,role:"color"}]:[]]),[g,f,te,oe,p,m,u,h]),ve=nc({componentName:"BubbleChart",data:a,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(ve)return e(Yl,{componentName:"BubbleChart",message:ve,width:q,height:X});const be=hc(C),xe=be?[be,...O||[]]:O,ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=a&&{data:ne}),{xAccessor:g,yAccessor:f,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:pe,colorScheme:v,size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:te,yLabel:oe,xFormat:u,yFormat:h,enableHover:V,showGrid:U}),re.legendBehaviorProps),Na({title:Q,description:Z,summary:J,accessibleTable:ee,className:d,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:w,defaultTooltipContent:ye})),Ba({linkedHover:L,onObservation:N,onClick:B,hoverHighlight:$,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),xe&&xe.length>0&&{annotations:xe}),j&&{xExtent:j}),M&&{yExtent:M}),re.crosshairProps),_);return re.earlyReturn?re.earlyReturn:e(Vl,{componentName:"BubbleChart",width:q,height:X,children:e(nr,Object.assign({ref:n},ke))})});Nc.displayName="BubbleChart";const Bc="__splomIdx",$c={top:4,bottom:4,left:4,right:4};function Ec({frameRef:t,cellSize:o,onBrush:n}){const r=i(null),a=o-$c.left-$c.right,l=o-$c.top-$c.bottom;return s(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),o=b().extent([[0,0],[a,l]]).on("brush end",e=>{var o;const i=null===(o=t.current)||void 0===o?void 0:o.getScales();if(!i)return;if(!e.selection)return void n(null);const[[r,s],[a,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(s)],[i.x.invert(a),i.y.invert(l)]];n(c)});return e.call(o),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[a,l,t,n]),e("svg",{ref:r,width:o,height:o,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${$c.left},${$c.top})`})})}function Dc({data:o,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:c,colorBy:d,colorScale:u,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const m=i(null),v=Ja({name:h,clientId:`splom-${n}-${r}`}),b=ol({name:h,xField:n,yField:r}),x=Ja({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,o=null==t?void 0:t[Bc];void 0!==o&&(k({[Bc]:[o]}),null==y||y(t,e.x+$c.left,e.y+$c.top))},[k,y]),S=l(e=>{const t={opacity:c,r:a};return t.fill=d?mt(e,d,u):Pl,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=f),t},[d,u,c,a,p,v.isActive,v.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:s,height:s},children:[e(nr,{ref:m,chartType:"scatter",data:o,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:S,margin:$c,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(Ec,{frameRef:m,cellSize:s,xField:n,yField:r,onBrush:w})]})}function Hc({data:o,field:n,label:i,cellSize:s,bins:a,colorBy:l,colorScale:c,brushSelectionName:d,hoverSelectionName:u,mode:h}){const g=Ja({name:d,clientId:"splom-diag-"+n}),f=Ja({name:u,clientId:`splom-diag-${n}-hover`}),p="hover"===h?f:g,y=p.isActive,m=p.predicate,v=r(()=>{const e=o.map(e=>e[n]).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)/a||1,r="string"==typeof l?l:null,c=r?[...new Set(o.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],d=new Map(c.map((e,t)=>[e,t])),u=Array(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const s=Math.min(Math.floor((o-t)/i),a-1);if(u[s]++,y&&!m(e)||h[s]++,r){const t=d.get(e[r]+"");void 0!==t&&(g[s][t]++,y&&!m(e)||f[s][t]++)}}const p=Math.max(...u,1),v=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/p*(s-24),r={x:t/a*s,w:s/a-1,h:i,y0:o,category:c[n]};return o+=i,r})});return{bars:u.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*s,w:s/a-1,h:e/p*(s-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[o,n,a,s,y,m,l]);return t("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):Pl,opacity:y?.3:.6},`bg-${o}-${n}`))):v.bars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:Pl,opacity:y?.3:.6},"bg-"+o)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):Pl,opacity:.7},`sel-${o}-${n}`))):v.selectedBars.map((t,o)=>e("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:Pl,opacity:.7},"sel-"+o)))]})}function Ic({label:t,cellSize:o}){return e("svg",{width:o,height:o,children:e("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Rc(o){const{data:i,fields:s,fieldLabels:a={},colorBy:c,colorScheme:d,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:C,chartId:j}=o,M="splom",_="splom-hover",P=b?"hover":v?"brush":"hover",L=Ka(e=>e.clearSelection),[T,N]=u(null),B=l(()=>{L(_),N(null)},[L,_]),$=r(()=>(i||[]).map((e,t)=>void 0!==e[Bc]?e:Object.assign(Object.assign({},e),{[Bc]:t})),[i]),E=$l($,c,d),D=void 0!==A?A:!!c,H=r(()=>{if(!D||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set($.map(t=>t[e]))].map(e=>({label:e+"",color:E?E(e+""):Pl})):null},[D,c,$,E]),I=r(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>h+"px").join(" "),gridTemplateRows:s.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[s,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[H&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:H.map(o=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:o.color}}),e("span",{style:{fontSize:11},children:o.label})]},o.label))}),t("div",{style:I,onMouseLeave:"hover"===P?B:void 0,children:[s.map((o,i)=>t(n.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:a[o]||o}),s.map((t,n)=>i===n?"label"===y?e(Ic,{label:a[o]||o,cellSize:h},"diag-"+o):e(Hc,{data:$,field:o,label:a[o]||o,cellSize:h,bins:m,colorBy:c,colorScale:E,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,mode:P},"diag-"+o):e(Dc,{data:$,xField:t,yField:o,fieldLabels:a,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:E,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,s)=>{e?(N({datum:e,xField:t,yField:o,colIndex:n,rowIndex:i,px:null!=r?r:0,py:null!=s?s:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(N(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${o}-${t}`))]},"row-"+o)),e("div",{})," ",s.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:a[t]||t},"col-label-"+t))]}),T&&"hover"===P&&(()=>{const o=T.datum,n=a[T.xField]||T.xField,i=a[T.yField]||T.yField,r=c?"function"==typeof c?c(o):o[c]:null,s=S?"function"==typeof S?S(o):o[S]:"Row "+o[Bc];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:s+""}),t("div",{children:[n,": ",null!=o[T.xField]?Number(o[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=o[T.yField]?Number(o[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function Fc(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e(gl,{selections:i,children:e(Rc,Object.assign({},t))})}function Wc({width:t,height:o,margin:n,scales:r,brushDirection:a,extent:l,onBrush:c}){const d=i(null),u=i(null),h=i(!1),g=t+n.left+n.right,f=o+n.top+n.bottom;return s(()=>{if(!d.current||!r)return;const e=y(d.current).select(".brush-group"),n="x"===a?m().extent([[0,0],[t,o]]):v().extent([[0,0],[t,o]]);return n.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?r.x:r.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(n),u.current=n,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[r,t,o,a,c]),s(()=>{if(!u.current||!r||!d.current)return;const e=y(d.current).select(".brush-group"),t="x"===a?r.x:r.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(u.current.move,o)}else e.call(u.current.move,null);h.current=!1},[l,r,a]),e("svg",{ref:d,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function zc(o){var n,a;const{data:c,width:d=600,height:h=400,margin:g,className:f,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:C,colorScheme:j,curve:M="linear",lineWidth:_=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:N=3,enableHover:B=!0,showGrid:$=!1,showLegend:E,legendPosition:D,tooltip:H,minimap:I={},renderBefore:R=!1,onBrush:F,brushExtent:W,yExtent:z,frameProps:Y={},loading:G,loadingContent:q,emptyContent:X}=o,V=Zl(G,d,h,q),U=V?null:Ql(c,d,h,X),K=r(()=>me(c),[c]),[Q,Z]=u(null),J=null!=W?W:Q,ee=l(e=>{W||Z(e),null==F||F(e)},[W,F]),te=i(null),[oe,ne]=u(null);s(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=te.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?ne(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ie=void 0!==(null===(n=K[0])||void 0===n?void 0:n[O]),re=r(()=>{if(ie)return K;if(S){const e=K.reduce((e,t)=>{const o="function"==typeof S?S(t):t[S];if(!e[o]){const t={[O]:[]};"string"==typeof S&&(t[S]=o),e[o]=t}return e[o][O].push(t),e},{});return Object.values(e)}return[{[O]:K}]},[K,S,O,ie]),se=r(()=>ie||S?re.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):K,[re,O,ie,S,K]),ae=$l(K,C,j),le=Sc({lineWidth:_,colorBy:C,colorScale:ae,fillArea:P,areaOpacity:L}),ce=r(()=>{if(I.lineStyle)return I.lineStyle},[I.lineStyle]),de=Sc({lineWidth:1,colorBy:C,colorScale:ae}),ue=null!=ce?ce:de,he=r(()=>{if(T)return e=>{const t={r:N,fillOpacity:1};return t.fill=C?mt(e.parentLine||e,C,ae):Pl,t}},[T,N,C,ae]),{legend:ge,margin:fe,legendPosition:pe}=Il({data:re,colorBy:C,colorScale:ae,showLegend:E,legendPosition:D,userMargin:g}),ye=I.height||60,ve=r(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=I.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=I.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=I.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:fe.left,right:null!==(a=null===(s=I.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:fe.right}},[I.margin,fe]),be=I.brushDirection||"x",xe=nc({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(xe)return e(Yl,{componentName:"MinimapChart",message:xe,width:d,height:h});const ke=P?"area":"line",we=r(()=>Fa([{label:v||Ea(w),accessor:w,role:"x",format:x},{label:b||Ea(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ke,data:se,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:le},T&&{pointStyle:he}),{size:[d,h],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:fe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:B,showGrid:$}),ge&&{legend:ge,legendPosition:pe}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===H?()=>null:vi(H)||we}),J&&{xExtent:J}),z&&{yExtent:z}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),Y),Se=Object.assign({chartType:ke,data:se,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:ue,size:[d,ye+ve.top+ve.bottom],margin:ve,showAxes:null!==(a=I.showAxes)&&void 0!==a&&a,background:I.background,enableHover:!1},z&&{yExtent:z}),Oe=t("div",{style:{position:"relative",width:d,overflow:"hidden"},children:[e(nr,Object.assign({ref:te},Se)),e(Wc,{width:d-ve.left-ve.right,height:ye,margin:ve,scales:oe,brushDirection:be,extent:J,onBrush:ee})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e(nr,Object.assign({},Ae))},"main");return V||U||e(Vl,{componentName:"MinimapChart",width:d,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[R?Oe:Ce,R?Ce:Oe]})})}Fc.displayName="ScatterplotMatrix",zc.displayName="MinimapChart";const Yc=g(function(n,s){const a=i(null);lc(s,{variant:"xy",frameRef:a});const l=Wl(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:d,className:u,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:M,pointIdAccessor:_,annotations:P,frameProps:L={},selection:T,linkedHover:N,onObservation:B,onClick:$,hoverHighlight:E,chartId:D,loading:H,loadingContent:I,emptyContent:R,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=n,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=l,ie=r(()=>me(c),[c]),re=ac({data:ie,rawData:c,colorBy:w,colorScheme:A,legendInteraction:F,legendPosition:W,selection:T,linkedHover:N,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:B,onClick:$,hoverHighlight:E,chartType:"QuadrantChart",chartId:D,showLegend:Q,userMargin:d,marginDefaults:l.marginDefaults,loading:H,loadingContent:I,emptyContent:R,width:X,height:V});Jl("QuadrantChart",ie,"xAccessor",f),Jl("QuadrantChart",ie,"yAccessor",p);const se=r(()=>{if(!ie.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of ie){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(o>y&&(o=y),y>n&&(n=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[ie,f,p,y,m]),ae=r(()=>{if(!S||0===ie.length)return;const e=ie.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ie,S]),le=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ce=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=le(e),o=ce(e),n=null!=y?t>=y:void 0,i=null!=m?o>=m:void 0;return void 0===i||void 0===n?z||Pl:i&&n?v.topRight.color:i&&!n?v.topLeft.color:!i&&n?v.bottomRight.color:v.bottomLeft.color},[le,ce,y,m,v,z]),ue=r(()=>S?e=>bt(e,S,O,ae):void 0,[S,O,ae]),he=dc({colorBy:w,colorScale:re.colorScale,color:z,pointRadius:C,fillOpacity:j,radiusFn:ue,fallbackFill:de,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ge=r(()=>{if(!ie.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=ie[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ie,f,p,w,S]),fe=r(()=>Fa([...ge?[{label:ge,accessor:ge,role:"title"}]:[],{label:oe||Ea(f),accessor:f,role:"x",format:h},{label:ne||Ea(p),accessor:p,role:"y",format:g},...w?[{label:Ea(w),accessor:w,role:"color"}]:[],...S?[{label:Ea(S),accessor:S,role:"size"}]:[]]),[ge,f,p,oe,ne,w,S,h,g]),pe=nc({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ye=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=y?n.x(y):s/2,c=null!=m?n.y(m):a/2;if(null!=y&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const d=Math.max(0,Math.min(s,l)),u=Math.max(0,Math.min(a,c)),h=[{config:v.topLeft,x:0,y:0,w:d,h:u},{config:v.topRight,x:d,y:0,w:s-d,h:u},{config:v.bottomLeft,x:0,y:u,w:d,h:a-u},{config:v.bottomRight,x:d,y:u,w:s-d,h:a-u}];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(d,0),e.lineTo(d,a),e.stroke(),e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([])}]},[y,m,v,b]),ve=r(()=>x?[...ye,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=y?o.x(y):i/2,a=null!=m?o.y(m):r/2;(null==y||isFinite(s))&&(null==m||isFinite(a))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=v.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(v.topLeft.label,8,8),e.fillStyle=v.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(v.topRight.label,i-8,8),e.fillStyle=v.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(v.bottomLeft.label,8,r-8),e.fillStyle=v.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(v.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ye,[ye,x,k,v,y,m]),be=r(()=>{const e=L.canvasPreRenderers||[];return[...ve,...e]},[ve,L.canvasPreRenderers]),xe=r(()=>{var n;const i={stroke:b.stroke||"#999",strokeWidth:null!==(n=b.strokeWidth)&&void 0!==n?n:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(n,r,s)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const a=s.width,l=s.height,c=null!=y?r.x(y):a/2,d=null!=m?r.y(m):l/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(d))return null;const u=Math.max(0,Math.min(a,c)),h=Math.max(0,Math.min(l,d));return t(o,{children:[[{config:v.topLeft,x:0,y:0,w:u,h:h},{config:v.topRight,x:u,y:0,w:a-u,h:h},{config:v.bottomLeft,x:0,y:h,w:u,h:l-h},{config:v.bottomRight,x:u,y:h,w:a-u,h:l-h}].map((t,o)=>{var n;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):null}),e("line",{x1:u,y1:0,x2:u,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:a,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(o,{children:[e("text",{x:8,y:8+k,fill:v.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.topLeft.label}),e("text",{x:a-8,y:8+k,fill:v.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.topRight.label}),e("text",{x:8,y:l-8,fill:v.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:v.bottomLeft.label}),e("text",{x:a-8,y:l-8,fill:v.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:v.bottomRight.label})]})]})}]},[y,m,v,b,x,k]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:ie}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:he,colorScheme:A,size:[X,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,showAxes:l.showAxes,xLabel:oe,yLabel:ne,xFormat:h,yFormat:g,enableHover:U,showGrid:K}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),re.legendBehaviorProps),Z&&{title:Z}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?fe:vi(M)||fe}),(N||B||$||E)&&{customHoverBehavior:re.customHoverBehavior}),(B||$||N)&&{customClickBehavior:re.customClickBehavior}),_&&{pointIdAccessor:_}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:be}),re.crosshairProps),L),be.length>0&&{canvasPreRenderers:be}),{svgPreRenderers:xe});return re.earlyReturn?re.earlyReturn:pe?e(Yl,{componentName:"QuadrantChart",message:pe,width:X,height:V}):e(Vl,{componentName:"QuadrantChart",width:X,height:V,children:e(nr,Object.assign({ref:a},ke))})});Yc.displayName="QuadrantChart";const Gc="__ma_unitized",qc="__ma_series";function Xc(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Vc(e,t){return t[0]+e*(t[1]-t[0])}const Uc=g(function(t,o){var s;const a=i(null),c=i([]),d=i(t.series);d.current=t.series,p(o,()=>{const e=()=>{var e;return(null!==(e=d.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!a.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=r&&isFinite(r)&&a.current.push(Object.assign(Object.assign({},n),{[Gc]:Xc(r,i),[qc]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!a.current)return;const o=e(),n=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const i=o[t],r=i.extent||c.current[t];if(!r)continue;const s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=s&&isFinite(s)&&n.push(Object.assign(Object.assign({},e),{[Gc]:Xc(s,r),[qc]:i.label||"Series "+(t+1)}))}a.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},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 u=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:$,stroke:E,strokeWidth:D,opacity:H}=t,{width:I,height:R,enableHover:F,showGrid:W,showLegend:z=!0,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V}=u,U=r(()=>me(h),[h]),K=r(()=>me(v),[v]),Q=K,Z=2===K.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||Z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${K.length}. Rendering as a standard multi-line chart.`);const J=Zl(L,I,R,T),ee=J?null:Ql(h,I,R,N),te=Nl(),oe=r(()=>{let e;if(Array.isArray(b))e=b;else if(te&&te.length>0)e=te;else{const t=ht[b];e=Array.isArray(t)?t:gt}return Q.map((t,o)=>t.color||e[o%e.length])},[Q,b,te]),ne=r(()=>K.map((e,t)=>e.label||"Series "+(t+1)),[K]),{unitizedData:ie,extents:re}=r(()=>{if(0===U.length){const e=K.map(e=>e.extent||null).filter(Boolean);return e.length===K.length&&(c.current=e),{unitizedData:[],extents:e.length===K.length?e:[]}}const e=K.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(U,e.yAccessor));if(c.current=e,!Z){const t=[];for(const e of U)for(let o=0;K.length>o;o++){const n=K[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Gc]:i,[qc]:ne[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of U)for(let n=0;2>n;n++){const i=K[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[Gc]:Xc(r,e[n]),[qc]:ne[n]}))}return{unitizedData:t,extents:e}},[U,K,Z,ne]),se=r(()=>{if(Z&&re.length>=2)return[{orient:"left",label:ne[0],tickFormat:K[0].format||(e=>{const t=Vc(e,re[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ne[1],tickFormat:K[1].format||(e=>{const t=Vc(e,re[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Z,re,K,ne]),ae=ac({data:r(()=>ie.length>0?ie:ne.map(e=>({[qc]:e})),[ie,ne]),rawData:h,colorBy:qc,colorScheme:oe,legendInteraction:B,legendPosition:$,selection:O,linkedHover:C,fallbackFields:[qc],unwrapData:!1,onObservation:j,onClick:M,hoverHighlight:_,chartType:"MultiAxisLineChart",chartId:P,showLegend:z,userMargin:g,marginDefaults:Z?Object.assign(Object.assign({},u.marginDefaults),{left:70,right:70}):u.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:I,height:R});if(ae.earlyReturn)return ae.earlyReturn;const le=r(()=>{const e=new Map;return ne.forEach((t,o)=>e.set(t,oe[o])),e},[ne,oe]),ce=Sc({lineWidth:k,resolveStroke:l(e=>le.get(e[qc])||oe[0],[le,oe]),stroke:E,strokeWidth:D,opacity:H,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),de=r(()=>{if(!1===w)return()=>null;return vi(w)||(e=>{var t;const o=e.data||e,i=o[qc],r=ne.indexOf(i),s=o[Gc],a=Z&&r>=0&&re[r]?Vc(s,re[r]):s,l=r>=0&&(null===(t=K[r])||void 0===t?void 0:t.format)?K[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(o):o[m];return n.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},n.createElement("div",{style:{fontWeight:600,marginBottom:4,color:oe[r]||"inherit"}},i),n.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),n.createElement("div",null,`${i}: ${l(a)}`))})},[w,ne,oe,re,Z,K,m]),ue=nc({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),he=Z?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ie}),{xAccessor:m,yAccessor:Gc,groupAccessor:qc,lineStyle:ce,colorScheme:oe,size:[I,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:u.showAxes}),se&&{axes:se}),{xLabel:V}),Z?{}:{yLabel:ne[0]}),{xFormat:y}),Z&&he&&{yExtent:he}),{enableHover:F}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:W,curve:x}),ae.legendBehaviorProps),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:de}),A&&{annotations:A}),(C||j||M||_)&&{customHoverBehavior:ae.customHoverBehavior}),(j||M||C)&&{customClickBehavior:ae.customClickBehavior}),ae.crosshairProps),S);return J||ee||(ue?e(Yl,{componentName:"MultiAxisLineChart",message:ue,width:I,height:R}):e(Vl,{componentName:"MultiAxisLineChart",width:I,height:R,children:e(nr,Object.assign({ref:a},ge))}))});function Kc(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}Uc.displayName="MultiAxisLineChart";const Qc=g(function(t,o){const n=i(null);lc(o,{variant:"xy",frameRef:n});const s=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:a,margin:l,className:c,xFormat:d,yFormat:u,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,chartId:j,loading:M,loadingContent:_,emptyContent:P}=t,{width:L,height:T,enableHover:N,showGrid:B,title:$,description:E,summary:D,accessibleTable:H,xLabel:I,yLabel:R}=s,F=Zl(M,L,T,_),W=F?null:Ql(a,L,T,P),z=r(()=>me(a),[a]),Y=null==p||null==y;Jl("CandlestickChart",z,"xAccessor",h),Jl("CandlestickChart",z,"highAccessor",g),Jl("CandlestickChart",z,"lowAccessor",f),Y||(Jl("CandlestickChart",z,"openAccessor",p),Jl("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=Dl({selection:A,linkedHover:S,onObservation:O,onClick:C,chartType:"CandlestickChart",chartId:j}),V=Hl(S,X),U=r(()=>{const e=s.marginDefaults,o="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?o:Object.assign(Object.assign({},o),Kc(l))},[l,s.marginDefaults,t.mode]),K=r(()=>{const e=[{label:I||Ea(h),accessor:h,role:"x",format:d}];return Y?(e.push({label:"High",accessor:g,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:p,format:u}),e.push({label:"High",accessor:g,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:y,format:u})),Fa(e)},[h,I,d,u,g,f,p,y,Y]),Q=nc({componentName:"CandlestickChart",data:a,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!Y&&{openAccessor:p,closeAccessor:y})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=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!=a&&{data:z}),{xAccessor:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:s.showAxes,xLabel:I,yLabel:R,xFormat:d,yFormat:u,enableHover:N,showGrid:B}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),Na({title:$,description:E,summary:D,accessibleTable:H,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:v,defaultTooltipContent:K})),Ba({linkedHover:S,onObservation:O,onClick:C,customHoverBehavior:G,customClickBehavior:q})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),V),w);return F||W||(Q?e(Yl,{componentName:"CandlestickChart",message:Q,width:L,height:T}):e(Vl,{componentName:"CandlestickChart",width:L,height:T,children:e(nr,Object.assign({ref:n},ee))}))});function Zc(e){const t=i(null);return lc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Wl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>Kc(e.margin),[e.margin])}}function Jc(e){var t;const o=Zc(e),{resolved:n,normalizedMargin:i}=o,r=ac({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Qc.displayName="CandlestickChart";const ed=g(function(t,o){const{data:n,layout:i,layoutConfig:r,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:d,annotations:u,onObservation:h,onClick:g,selection:f,linkedHover:p,chartId:y,loading:m,loadingContent:v,emptyContent:b,colorScheme:x,frameProps:k={}}=t,{frameRef:w,resolved:A,safeData:S,setup:O,earlyReturn:C}=Jc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorScheme:x,selection:f,linkedHover:p,onObservation:h,onClick:g,chartId:y,loading:m,loadingContent:v,emptyContent:b,margin:c,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(C)return C;const{width:j,height:M,enableHover:_,showGrid:P,title:L,description:T,summary:N,accessibleTable:B,xLabel:$,yLabel:E}=A,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:S}),{customLayout:i,layoutConfig:r,xExtent:s,yExtent:a,colorScheme:x,size:[j,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:O.margin,showAxes:l,xLabel:$,yLabel:E,enableHover:_,showGrid:P}),O.legendBehaviorProps),Na({title:L,description:T,summary:N,accessibleTable:B,className:d,animate:t.animate,axisExtent:t.axisExtent})),null!=t.tooltip&&{tooltipContent:t.tooltip}),Ba({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),u&&u.length>0&&{annotations:u}),O.crosshairProps),k);return e(Vl,{componentName:"XYCustomChart",width:j,height:M,children:e(nr,Object.assign({ref:w},D))})});ed.displayName="XYCustomChart";const td=g(function(t,o){const{nodes:n,edges:i,layout:s,layoutConfig:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:d="target",margin:u,className:h,colorScheme:g,frameProps:f={}}=t,{frameRef:p,resolved:y,normalizedMargin:m}=Zc({imperativeRef:o,imperativeVariant:"network",margin:u,width:t.width,height:t.height,enableHover:t.enableHover,title:t.title,mode:t.mode}),v=r(()=>me(null!=n?n:[]),[n]),b=r(()=>me(null!=i?i:[]),[i]),{width:x,height:k,enableHover:w,title:A,description:S,summary:O,accessibleTable:C}=y,j=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=n&&{nodes:v}),null!=i&&{edges:b}),{customNetworkLayout:s,layoutConfig:a,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:d,colorScheme:g,size:[x,k],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:m,className:h,title:A,description:S,summary:O,accessibleTable:C,enableHover:w}),f);return e(Vl,{componentName:"NetworkCustomChart",width:x,height:k,children:e(Ta,Object.assign({ref:p},j))})});td.displayName="NetworkCustomChart";const od=g(function(t,o){const{data:n,layout:i,layoutConfig:r,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:d="vertical",margin:u,className:h,colorScheme:g,showAxes:f=!1,annotations:p,onObservation:y,onClick:m,selection:v,linkedHover:b,chartId:x,loading:k,loadingContent:w,emptyContent:A,frameProps:S={}}=t,{frameRef:O,resolved:C,safeData:j,setup:M,earlyReturn:_}=Jc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:g,selection:v,linkedHover:b,onObservation:y,onClick:m,chartId:x,loading:k,loadingContent:w,emptyContent:A,margin:u,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(_)return _;const{width:P,height:L,enableHover:T,showGrid:N,title:B,description:$,summary:E,accessibleTable:D}=C,H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:j}),{customLayout:i,layoutConfig:r,oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:d,colorScheme:g,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:M.margin,enableHover:T,showAxes:f,showGrid:N,annotations:p}),Na({title:B,description:$,summary:E,accessibleTable:D,className:h,animate:t.animate,axisExtent:t.axisExtent})),Ba({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior})),S);return e(Vl,{componentName:"OrdinalCustomChart",width:P,height:L,children:e(Fr,Object.assign({ref:O},H))})});function nd({ref:e,frameRef:t,setup:o}){return p(e,()=>({push:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.push(e)},pushMany:e=>{var o;return null===(o=t.current)||void 0===o?void 0:o.pushMany(e)},remove:e=>{var o,n;return null!==(n=null===(o=t.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[]},update:(e,o)=>{var n,i;return null!==(i=null===(n=t.current)||void 0===n?void 0:n.update(e,o))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==o?o:[]},getScales:()=>{var e,o;return null!==(o=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==o?o:null}}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function id(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=mt(e,t,o)}else c.fill=Bl(n,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,i,s,a,f,p,y]),v=r(()=>cc(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:d,opacity:u}),[m,l,c,d,u]);return r(()=>yl(v,null!=h?h:null,g),[v,h,g])}od.displayName="OrdinalCustomChart";const rd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,regression:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:$,legendPosition:E,color:D,stroke:H,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=n,te=r(()=>me(a),[a]),oe=ac({data:te,rawData:a,colorBy:f,colorScheme:p,legendInteraction:$,legendPosition:E,selection:C,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:n.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:Y,height:G}),{effectiveLegendProps:ne,effectiveMargin:ie}=nd({ref:o,frameRef:s,setup:oe});if(oe.earlyReturn)return oe.earlyReturn;Jl("BarChart",te,"categoryAccessor",d),Jl("BarChart",te,"valueAccessor",u);const re=El(te,y,u),se=Nl(),ae=r(()=>new Map,[te]),le=id({colorBy:f,colorScale:oe.colorScale,color:D,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:H,strokeWidth:I,opacity:R,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ce=r(()=>Wa({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),de=nc({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(de)return e(Yl,{componentName:"BarChart",message:de,width:Y,height:G});const ue=hc(A),he=ue?[ue,...w||[]]:w,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:re}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:q,showAxes:n.showAxes,oLabel:J,rLabel:ee,rFormat:g}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:y}),ne),Na({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:k,defaultTooltipContent:ce})),Ba({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),he&&he.length>0&&{annotations:he}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"BarChart",width:Y,height:G,children:e(Fr,Object.assign({ref:s},ge))})});rd.displayName="BarChart";const sd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:d="category",stackBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:$,legendPosition:E,color:D,stroke:H,strokeWidth:I,opacity:R,categoryFormat:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=r(()=>me(a),[a]),ee=p||u,te=ac({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:$,legendPosition:E,selection:C,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:l,marginDefaults:n.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const oe=Nl(),ne=r(()=>new Map,[J]),ie=id({colorBy:ee,colorScale:te.colorScale,color:D,themeCategorical:oe,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:H,strokeWidth:I,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>Wa({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),se=nc({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=nd({ref:o,frameRef:s,setup:te}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:G}),ae),Na({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:w,defaultTooltipContent:re})),Ba({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return se?e(Yl,{componentName:"StackedBarChart",message:se,width:W,height:z}):e(Vl,{componentName:"StackedBarChart",width:W,height:z,children:e(Fr,Object.assign({ref:s},ce))})});sd.displayName="StackedBarChart";const ad={RdBu:rt,PiYG:st,PRGn:at,BrBG:lt,RdYlBu:ct,RdYlGn:dt,Spectral:ut},ld="__likert_neutral_neg",cd="__likert_neutral_pos";function dd(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function ud(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function hd(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:ld,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:cd,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function gd(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===ld?r=o:o.__likertLevel===cd?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const fd=new Map,pd=g(function(t,o){const s=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:m="count",levels:v,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,valueFormat:T,loading:N,loadingContent:B,emptyContent:$,legendInteraction:E,legendPosition:D,categoryFormat:H,stroke:I,strokeWidth:R,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=s,J="horizontal"===b,ee=void 0===c,te=!y,oe=function(){var e;const t=_l();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ne=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const o=ad[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(v.length,oe),[x,v.length,oe]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],ne[t]||"#888");return e},[v,ne]),{processedData:re,reAggregate:se,accumulatorRef:ae}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:s,countAccessor:a,isDiverging:c,frameRef:d}){const u=!s,h=r(()=>dd(o,"question"),[o]),g=r(()=>u?dd(n,"score"):null,[u,n]),f=r(()=>u?null:dd(s,"level"),[u,s]),p=r(()=>u?null:dd(a,"count"),[u,a]),y=e||[],m=i([]),v=r(()=>{if(0===y.length)return[];let e=ud(y,t,h,g,f,p);return c&&(e=hd(e,t),e=gd(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var o;let n=ud(e,t,h,g,f,p);c&&(n=hd(n,t),n=gd(n,t)),null===(o=d.current)||void 0===o||o.replace(n)},[t,h,g,f,p,c,d]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:a}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:s="right"}){const a=i(new Set),c=i([]),[d,h]=u(0),g=Ga(),f=Nl(),p=l(e=>{const o=e[t];return null!=o?o+"":null},[t]),y=l(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||a.current.has(t)||(a.current.add(t),c.current.push(t),n=!0)}n&&h(e=>e+1)},[e,t,p]),m=l(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),i=c.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(a.current=new Set(n),c.current=n,h(e=>e+1))},[e,t]),v=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{a.current=new Set,c.current=[],h(e=>e+1)},[]);dl(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===n)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:f&&f.length>0?f:ft,s=t,a=i.map(e=>({[s]:e})),l=vt(a,s,r);return fl({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:mt})},[e,t,n,o,g,f,d]),w=r(()=>{if(k)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[k,s]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:ee,colorBy:le,colorScheme:ne,showLegend:q,legendPosition:D}),de=l(ce.wrapPush(e=>{ae.current.push(e),se(ae.current)}),[ce.wrapPush,se,ae]),ue=l(ce.wrapPushMany(e=>{ae.current.push(...e),se(ae.current)}),[ce.wrapPushMany,se,ae]);p(o,()=>({push:de,pushMany:ue,remove:e=>{var t,o;return null!==(o=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=a.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ae.current=[],ce.resetCategories(),null===(e=a.current)||void 0===e||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}}),[de,ue,ce.resetCategories,ae]);const he=ac({data:re,rawData:c,colorBy:le,colorScheme:ne,legendInteraction:E,legendPosition:D,selection:C,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:d,marginDefaults:s.marginDefaults,loading:N,loadingContent:B,emptyContent:$,width:W,height:z});if(he.earlyReturn)return he.earlyReturn;const ge=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),fe=id({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:fd,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:R,opacity:F,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{var t,o;const n=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);if(i===ld||i===cd)return{fill:ge};const r=n||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===ld||o===cd?pe:o,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=o===ld||o===cd?2*s:s,l=t.__likertCount||0;return n.createElement("div",{className:"semiotic-tooltip",style:hi},n.createElement("div",{style:{fontWeight:"bold"}},r),n.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[pe]),me=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),nc({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,f,y,m,v,te]),ve=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),be=r(()=>!1!==q?Object.assign(Object.assign({},he.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:D||he.legendPosition||"bottom"}):he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,D,q,ve]),xe=r(()=>{const e=Object.assign({},he.margin);if(ee&&!1!==q){const t=D||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ce.streamingMarginAdjust)for(const[t,o]of Object.entries(ce.streamingMarginAdjust))o>e[t]&&(e[t]=o);return J&&100>e.left&&(e.left=100),e},[he.margin,ce.streamingMarginAdjust,J,ee,q,D]),ke=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:fe,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Q,rLabel:Z||(J?void 0:"Percentage"),rFormat:ke}),H&&{oFormat:H}),{showGrid:G}),be),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),{tooltipContent:!1===w?()=>null:!0===w?ye:vi(w)||ye}),(j||M||_||P)&&{customHoverBehavior:he.customHoverBehavior}),(M||_||j)&&{customClickBehavior:he.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return me?e(Yl,{componentName:"LikertChart",message:me,width:W,height:z}):e(Vl,{componentName:"LikertChart",width:W,height:z,children:e(Fr,Object.assign({ref:a},we))})});function yd({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=pl("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=ol({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof n?n:"value")}),a=i(s.brushInteraction);a.current=s.brushInteraction;const c=l(e=>{if(r){a.current.end(e?e.r:null)}null==t||t(e)},[t,r]),d=!!(e||o||t);return{hasBrush:d,handleBrush:c,brushStreamProps:d?{brush:{dimension:"r"},onBrush:c}:{}}}pd.displayName="LikertChart";const md=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);lc(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:C,frameProps:j={},selection:M,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,chartId:N,loading:B,loadingContent:$,emptyContent:E,legendInteraction:D,legendPosition:H,color:I,stroke:R,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,oe=r(()=>me(a),[a]),ne=ac({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:D,legendPosition:H,selection:M,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:N,showLegend:U,userMargin:l,marginDefaults:n.marginDefaults,loading:B,loadingContent:$,emptyContent:E,width:G,height:q}),ie=yd({brushProp:S,onBrushProp:O,linkedBrush:C,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=r(()=>{if(!y)return;const e=oe.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[oe,y]),se=Nl(),ae=r(()=>new Map,[oe]),le=id({colorBy:f,colorScale:ne.colorScale,color:I,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:R,strokeWidth:F,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?bt(e,y,m,re):v})}),ce=r(()=>Wa({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),de=nc({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(de)return e(Yl,{componentName:"SwarmPlot",message:de,width:G,height:q});const 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({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:g}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),ne.legendBehaviorProps),Na({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:k,defaultTooltipContent:ce})),Ba({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"SwarmPlot",width:G,height:q,children:e(Fr,Object.assign({ref:s},ue))})});function vd(o){return n=>{var i;const r=n.category||n.data&&(null===(i=n.data[0])||void 0===i?void 0:i.category)||"",s=n.stats||(n.data||n).stats;if(s&&null!=s.median)return t("div",{className:"semiotic-tooltip",style:hi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==o?void 0:o.valueAccessor){const i=o.valueAccessor,s=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return t("div",{className:"semiotic-tooltip",style:hi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:hi,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}md.displayName="SwarmPlot";const bd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);lc(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:N,stroke:B,strokeWidth:$,opacity:E,showCategoryTicks:D,categoryFormat:H}=t,{width:I,height:R,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=n,K=r(()=>me(a),[a]),Q=ac({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"BoxPlot",chartId:j,showLegend:z,userMargin:l,marginDefaults:n.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:I,height:R});if(Q.earlyReturn)return Q.earlyReturn;const Z=Nl(),J=r(()=>new Map,[K]),ee=id({colorBy:f,colorScale:Q.colorScale,color:N,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:$,opacity:E,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=r(()=>vd(),[]),oe=nc({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return e(Yl,{componentName:"BoxPlot",message:oe,width:I,height:R});const 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({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[I,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:V,rLabel:U,rFormat:g}),H&&{oFormat:H}),{showGrid:W,showCategoryTicks:D}),Q.legendBehaviorProps),Na({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:v,defaultTooltipContent:te})),Ba({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"BoxPlot",width:I,height:R,children:e(Fr,Object.assign({ref:s},ne))})});bd.displayName="BoxPlot";const xd=g(function(o,n){const s=Wl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=i(null);lc(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:$,legendPosition:E,color:D,stroke:H,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:W}=o,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=s,ee=r(()=>me(l),[l]),te=ac({data:ee,rawData:l,colorBy:y,colorScheme:m,legendInteraction:$,legendPosition:E,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:s.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:z,height:Y}),oe=yd({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(te.earlyReturn)return te.earlyReturn;const ne=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,o=-1/0;for(const n of ee){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[ee,h]),ie=Nl(),re=r(()=>new Map,[ee]),se=id({colorBy:y,colorScale:te.colorScale,color:D,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:H,strokeWidth:I,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ae=r(()=>o=>{const n=o.data||o,i=n.category||o.category||"",r=n.count,s=n.range;return t("div",{className:"semiotic-tooltip",style:hi,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=nc({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(le)return e(Yl,{componentName:"Histogram",message:le,width:z,height:Y});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:g,normalize:f}),k?{rExtent:k}:ne&&{rExtent:ne}),{size:[z,Y],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:s.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),Na({title:V,description:U,summary:K,accessibleTable:Q,className:d,animate:o.animate,axisExtent:o.axisExtent})),$a({tooltip:b,defaultTooltipContent:ae})),Ba({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"Histogram",width:z,height:Y,children:e(Fr,Object.assign({ref:a},ce))})});xd.displayName="Histogram";const kd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);lc(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:N,emptyContent:B,legendInteraction:$,legendPosition:E,color:D,stroke:H,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:W}=t,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=r(()=>me(a),[a]),te=ac({data:ee,rawData:a,colorBy:y,colorScheme:m,legendInteraction:$,legendPosition:E,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:n.marginDefaults,loading:T,loadingContent:N,emptyContent:B,width:z,height:Y}),oe=yd({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=Nl(),ie=r(()=>new Map,[ee]),re=id({colorBy:y,colorScale:te.colorScale,color:D,themeCategorical:ne,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:H,strokeWidth:I,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=r(()=>vd({valueAccessor:u}),[u]),ae=nc({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ae)return e(Yl,{componentName:"ViolinPlot",message:ae,width:z,height:Y});const 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({chartType:"violin"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[z,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),Na({title:V,description:U,summary:K,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:b,defaultTooltipContent:se})),Ba({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),oe.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"ViolinPlot",width:z,height:Y,children:e(Fr,Object.assign({ref:s},le))})});kd.displayName="ViolinPlot";const wd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);lc(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,chartId:M,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:N,color:B,stroke:$,strokeWidth:E,opacity:D,showCategoryTicks:H,categoryFormat:I}=t,{width:R,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=n,Q=r(()=>me(a),[a]),Z=ac({data:Q,rawData:a,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:N,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:C,hoverHighlight:j,chartType:"RidgelinePlot",chartId:M,showLegend:Y,userMargin:l,marginDefaults:n.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:R,height:F});if(Z.earlyReturn)return Z.earlyReturn;const J=Nl(),ee=r(()=>new Map,[Q]),te=id({colorBy:y,colorScale:Z.colorScale,color:B,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:$,strokeWidth:E,opacity:D,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=r(()=>vd(),[]),ne=nc({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ne)return e(Yl,{componentName:"RidgelinePlot",message:ne,width:R,height:F});const ie=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:"ridgeline"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:p}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:H,oSort:!1,amplitude:f}),Z.legendBehaviorProps),Na({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:b,defaultTooltipContent:oe})),Ba({linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"RidgelinePlot",width:R,height:F,children:e(Fr,Object.assign({ref:s},ie))})});wd.displayName="RidgelinePlot";const Ad=g(function(o,n){const s=Wl(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=i(null);lc(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,stepAccessor:u="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:N,stroke:B,strokeWidth:$,opacity:E,categoryFormat:D}=o,H="vertical"===y,{width:I,height:R,enableHover:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q}=s,X=H?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},V=r(()=>me(l),[l]),U=f||g,K=!U,Q=ac({data:V,rawData:l,colorBy:U,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"FunnelChart",chartId:j,showLegend:W,userMargin:c,marginDefaults:X,loading:M,loadingContent:_,emptyContent:P,width:I,height:R});if(Q.earlyReturn)return Q.earlyReturn;Jl("FunnelChart",V,"stepAccessor",u),Jl("FunnelChart",V,"valueAccessor",h);const Z=Nl(),J=r(()=>new Map,[V]),ee=r(()=>{if(K)return N||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,N,Z,p]),te=id({colorBy:ee?void 0:U,colorScale:Q.colorScale,color:null!=ee?ee:N,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:B,strokeWidth:$,opacity:E,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection}),oe=r(()=>o=>{var n,i,r,s,a,l;const c=(null==o?void 0:o.data)||o,d=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",u=null!==(r=null!==(i=null!==(n=null==c?void 0:c.__funnelValue)&&void 0!==n?n:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:hi,children:[d&&e("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[u+"",y]})]})},[]),ne=nc({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(ne)return e(Yl,{componentName:"FunnelChart",message:ne,width:I,height:R});const ie=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:H?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:te,size:[I,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),D&&{oFormat:D}),{showGrid:H}),!H&&{connectorOpacity:m}),{showLabels:v}),Q.legendBehaviorProps),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?oe:vi(b)||oe}),(A||S||O||C)&&{customHoverBehavior:Q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"FunnelChart",width:I,height:R,children:e(Fr,Object.assign({ref:a},ie))})});Ad.displayName="FunnelChart";const Sd=g(function(t,o){var n;const s=Wl(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);lc(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:k,regression:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:$,color:E,stroke:D,strokeWidth:H,opacity:I,categoryFormat:R}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=s,Z=r(()=>me(l),[l]),J=ac({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:$,selection:O,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:c,marginDefaults:s.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:F,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=El(Z,m,h),te=Nl(),oe=r(()=>new Map,[Z]),ne=id({colorBy:p,colorScale:J.colorScale,color:E,themeCategorical:te,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=r(()=>Wa({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),re=nc({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(re)return e(Yl,{componentName:"DotPlot",message:re,width:F,height:W});const se=hc(w),ae=se?[se,...k||[]]:k,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({chartType:"point"},null!=l&&{data:ee}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:K,rLabel:Q,rFormat:f}),R&&{oFormat:R}),{showGrid:Y,oSort:m}),J.legendBehaviorProps),Na({title:q,description:X,summary:V,accessibleTable:U,className:d,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:x,defaultTooltipContent:ie})),Ba({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Vl,{componentName:"DotPlot",width:F,height:W,children:e(Fr,Object.assign({ref:a},le))})});Sd.displayName="DotPlot";const Od=g(function(t,o){var n,s;const a=Wl(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:N,strokeWidth:B,opacity:$}=t,{width:E,height:D,enableHover:H,showLegend:I,title:R,description:F,summary:W,accessibleTable:z}=a,Y=r(()=>me(c),[c]),G=f||h,q=ac({data:Y,rawData:c,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:C,showLegend:I,userMargin:d,marginDefaults:a.marginDefaults,loading:j,loadingContent:M,emptyContent:_,width:E,height:D});if(q.earlyReturn)return q.earlyReturn;const X=Nl(),V=r(()=>new Map,[Y]),U=id({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:p,categoryIndexMap:V,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:N,strokeWidth:B,opacity:$,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=r(()=>Wa({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Q=nc({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:J}=nd({ref:o,frameRef:l,setup:q}),ee=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:"pie"},null!=c&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Z),Na({title:R,description:F,summary:W,accessibleTable:z,className:u,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:v,defaultTooltipContent:K})),Ba({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Q?e(Yl,{componentName:"PieChart",message:Q,width:E,height:D}):e(Vl,{componentName:"PieChart",width:E,height:D,children:e(Fr,Object.assign({ref:l},ee))})});Od.displayName="PieChart";const Cd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:N,strokeWidth:B,opacity:$}=t,{width:E,height:D,enableHover:H,showLegend:I,title:R,description:F,summary:W,accessibleTable:z}=n,Y=r(()=>me(a),[a]),G=f||d,q=ac({data:Y,rawData:a,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:C,showLegend:I,userMargin:l,marginDefaults:n.marginDefaults,loading:j,loadingContent:M,emptyContent:_,width:E,height:D});if(q.earlyReturn)return q.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(E,D)),V=Nl(),U=r(()=>new Map,[Y]),K=id({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:p,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:N,strokeWidth:B,opacity:$,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=r(()=>Wa({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),Z=nc({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=nd({ref:o,frameRef:s,setup:q}),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({chartType:"donut"},null!=a&&{data:Y}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:X,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),Na({title:R,description:F,summary:W,accessibleTable:z,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:v,defaultTooltipContent:Q})),Ba({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(Yl,{componentName:"DonutChart",message:Z,width:E,height:D}):e(Vl,{componentName:"DonutChart",width:E,height:D,children:e(Fr,Object.assign({ref:s},te))})});function jd(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function Md(e){return Math.max(0,Math.min(1,e))}function _d(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Pd(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Ld(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Md(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=Md(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],i=o[e+1];if(t.offset>n||n>i.offset)continue;const r=i.offset-t.offset,s=r>0?(n-t.offset)/r:0,a=_d(t.color),l=_d(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,d,u]=a,[h,g,f]=l;return Pd(c+(h-c)*s,d+(g-d)*s,u+(f-u)*s)}return o[o.length-1].color}function Td(e,t,o){return`${e}-${t}`}Cd.displayName="DonutChart";const Nd=g(function(o,n){const s=Wl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),a=i(null),l="context"===o.mode,{compactMode:c}=s,{value:d,min:u=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:k,valueFormat:w,showScaleLabels:A=!c,sweep:S=240,fillZones:O=!0,tooltip:C,annotations:j,frameProps:M={},className:_,stroke:P,strokeWidth:L,opacity:T}=o,{width:N,height:B,title:$,description:E,summary:D,accessibleTable:H}=s,I=f&&"object"==typeof f?f:void 0,R=Math.max(u,Math.min(h,d)),F=h-u||1,W=(R-u)/F,{gaugeData:z,pieceStyle:Y,gaugeAnnotations:G}=r(()=>function(e){const{min:t,max:o,value:n,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:d=240}=e,u=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/u;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:o,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=a?h:1,t=Td("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(d)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(Ld(c.colorStops,e*(t+.5)/o));const i=Td("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),y.set(i,{fill:n[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const n=g[o],i=(n.value-e)/u,r=(e-t)/u,l=(n.value-t)/u,c=Math.max(0,(a?Math.min(h,l):l)-r),d=a?Math.max(0,i-c):0;if(c>0){const e=Td("fill",o);p.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(d>0){const e=Td("bg",o);p.push({category:e,value:d,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&o>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:m}}({min:u,max:h,value:d,thresholds:g,fillColor:p,backgroundColor:y,fillZones:O,showScaleLabels:A,gradientFill:I}),[d,u,h,g,p,y,A,O,I]),q=r(()=>cc(Y,{stroke:P,strokeWidth:L,opacity:T}),[Y,P,L,T]),{sweepRad:X,startAngleDeg:V}=jd(S),U=function(e=240){const{sweepRad:t,offsetRad:o}=jd(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(S),K=Math.min(10,Math.max(1,Math.min(N,B)/12)),Q=U.cx,Z=U.cy,J=Math.max(4,Math.min((N-2*K)/U.width,(B-2*K)/U.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=N/2-Q*J,oe=B/2-Z*J,ne=2*(J+4),ie=r(()=>{if(c&&null==k)return null;if(null!=k)return"function"==typeof k?k(R,u,h):k;const o=w?w(R):Math.round(R)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:o}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[k,R,u,h,w,A,J,c]),re=r(()=>l&&null==k?{type:"gauge-value",text:w?w(R):Math.round(R)+""}:null,[l,k,R,w]),se=r(()=>{if(!b)return null;const e=-Math.PI/2+V*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,V,X,ee,x]),ae=r(()=>(o,n,i)=>{if("gauge-needle"===o.type){const r=(i.width||N)/2,s=(i.height||B)/2,a=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:o.tipX,y2:o.tipY,stroke:o.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:o.color})]},"gauge-needle-"+n)}if("gauge-label"===o.type){const r=-Math.PI/2+V*Math.PI/180+(o.value-u)/F*X,s=(i.width||N)/2,a=(i.height||B)/2,l=ee-1,c=J+1,d=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${s},${a})`,children:[e("line",{x1:d,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:o.label})]},"gauge-label-"+n)}return"gauge-value"===o.type?e("text",{x:(i.width||N)/2,y:(i.height||B)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:o.text},"gauge-value-"+n):null},[N,B,u,F,V,X,ee,J]),le=r(()=>{const e=[...G,...j||[]];return se&&e.push(se),re&&e.push(re),e},[G,j,se,re]),ce=r(()=>o=>{var n;const i=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n[0])||(null==o?void 0:o.data)||o,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(R):"Remaining"})]})},[R]);if(0===z.length)return e(Yl,{componentName:"GaugeChart",message:"No data to display",width:N,height:B});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:q,innerRadius:ee,startAngle:V,sweepAngle:S},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[N,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:oe-ne/2,bottom:B-oe-ne/2,left:te-ne/2,right:N-te-ne/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===C?()=>null:vi(C)||ce,svgAnnotationRules:ae}),le.length>0&&{annotations:le}),$&&{title:$}),E&&{description:E}),D&&{summary:D}),void 0!==H&&{accessibleTable:H}),_&&{className:_}),null!=o.animate&&{animate:o.animate}),M);return e(Vl,{componentName:"GaugeChart",width:N,height:B,children:e(Fr,Object.assign({ref:a},de))})});Nd.displayName="GaugeChart";const Bd=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:d="category",groupBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:N,legendInteraction:B,legendPosition:$,color:E,stroke:D,strokeWidth:H,opacity:I,categoryFormat:R}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=r(()=>me(a),[a]),J=p||u,ee=ac({data:Z,rawData:a,colorBy:J,colorScheme:y,legendInteraction:B,legendPosition:$,selection:O,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:l,marginDefaults:n.marginDefaults,loading:L,loadingContent:T,emptyContent:N,width:F,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=Nl(),oe=r(()=>new Map,[Z]),ne=id({colorBy:J,colorScale:ee.colorScale,color:E,themeCategorical:te,colorScheme:y,categoryIndexMap:oe,userPieceStyle:S.pieceStyle,stroke:D,strokeWidth:H,opacity:I,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>Wa({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),re=nc({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=nd({ref:o,frameRef:s,setup:ee}),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({chartType:"clusterbar"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:f}),R&&{oFormat:R}),{showGrid:Y}),se),Na({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:k,defaultTooltipContent:ie})),Ba({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e(Yl,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e(Vl,{componentName:"GroupedBarChart",width:F,height:W,children:e(Fr,Object.assign({ref:s},le))})});Bd.displayName="GroupedBarChart";const $d=g(function(t,o){const n=Wl(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:a,margin:l,className:c,categoryAccessor:d="category",subcategoryAccessor:u,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:N,legendPosition:B,color:$,stroke:E,strokeWidth:D,opacity:H,categoryFormat:I,rTickValues:R,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ne}=n,ie=r(()=>me(a),[a]),re=p||u,se=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof d?d(e):e[d])),o=Math.max(1,e.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===g?V:X)-2*o)/(o-1))):1},[m,t.mode,ie,d,g,X,V]),ae=ac({data:ie,rawData:a,colorBy:re,colorScheme:y,legendInteraction:N,legendPosition:B,selection:S,linkedHover:O,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:M,chartType:"SwimlaneChart",chartId:_,showLegend:Q,userMargin:l,marginDefaults:n.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=yd({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h});if(ae.earlyReturn)return ae.earlyReturn;const ce=Nl(),de=r(()=>new Map,[ie]),ue=id({colorBy:re,colorScale:ae.colorScale,color:$,themeCategorical:ce,colorScheme:y,categoryIndexMap:de,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:E,strokeWidth:D,opacity:H,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=r(()=>Wa({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ge=nc({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:pe}=nd({ref:o,frameRef:s,setup:ae}),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:ie}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ue,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:se,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:n.showAxes,oLabel:!1===W?void 0:oe,rLabel:ne,rFormat:f}),R&&{rTickValues:R}),null!=F&&{tickLabelEdgeAlign:F}),I&&{oFormat:I}),void 0!==W&&{showCategoryTicks:W}),{showGrid:K}),fe),Na({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent})),$a({tooltip:v,defaultTooltipContent:he})),Ba({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=Y&&{trackFill:Y}),null!=G&&{roundedTop:G}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e(Yl,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e(Vl,{componentName:"SwimlaneChart",width:X,height:V,children:e(Fr,Object.assign({ref:s},ye))})});function Ed(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function Dd(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function Hd(e){return"function"==typeof e?e:t=>t[e]||1}function Id({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=mt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=mt(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function Rd(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:d,legendInteraction:u,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:k,loading:w,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,C=r(()=>me(o),[o]),j=r(()=>me(t),[t]),M=Zl(w,x,k,A),_=M?null:Ql("nodes"===O?void 0===t?void 0:j:void 0===o?void 0:C,x,k,S),P=r(()=>n?Dd(j,C,i,s):j,[n,j,C,i,s]),L=$l(P,a,l),T=Nl(),N=r(()=>{if(Array.isArray(l))return l;if(T&&T.length>0)return T;if("string"==typeof l){const e=ht[l];if(Array.isArray(e)&&e.length>0)return e}return gt},[l,T]),B=r(()=>{if(!a)return[];const e=new Set;for(const t of P){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[P,a]),$=Rl(u,a,B),{legend:E,margin:D,legendPosition:H}=Il({data:P,colorBy:a,colorScale:L,showLegend:c,legendPosition:d,userMargin:b,defaults:v,categories:B}),I=Dl({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:R,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y}=I;return{safeNodes:P,safeEdges:C,colorScale:L,effectivePalette:N,themeCategorical:T,allCategories:B,legendState:$,legend:E,margin:D,legendPosition:H,customHoverBehavior:R,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y,loadingEl:M,emptyEl:_}}$d.displayName="SwimlaneChart";const Fd=g(function(t,o){var n;const s=i(null);lc(o,{variant:"network",frameRef:s});const a=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:u,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:C,frameProps:j={},onObservation:M,onClick:_,chartId:P,selection:L,linkedHover:T,loading:N,loadingContent:B,emptyContent:$,legendInteraction:E,legendPosition:D,stroke:H,strokeWidth:I,opacity:R}=t,F=null!==(n=null!=h?h:g)&&void 0!==n?n:"id",{width:W,height:z,enableHover:Y,showLegend:G,showLabels:q=!1,title:X,description:V,summary:U,accessibleTable:K}=a,Q=Rd({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:m,colorScheme:v,showLegend:G,legendPosition:D,legendInteraction:E,selection:L,linkedHover:T,onObservation:M,onClick:_,chartType:"ForceDirectedGraph",chartId:P,marginDefaults:a.marginDefaults,userMargin:d,width:W,height:z,loading:N,loadingContent:B,emptyContent:$,emptyDataKey:"nodes"}),Z=r(()=>new Map,[]),J=r(()=>e=>{const t={};return t.fill=m?mt(e.data||e,m,Q.colorScale):Bl(void 0,Q.themeCategorical,v,void 0,Z),"number"==typeof b&&(t.r=b),t},[m,Q.colorScale,b,Q.themeCategorical,v,Z]),ee=r(()=>cc(J,{stroke:H,strokeWidth:I,opacity:R}),[J,H,I,R]),te=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),oe=r(()=>cc(te,{stroke:H,strokeWidth:I,opacity:R}),[te,H,I,R]),ne=r(()=>{if(q&&y)return"function"==typeof y?y:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==o?o:e[y])&&void 0!==n?n:e.id}},[q,y]),ie=rc({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:F}});return ie?e(Yl,{componentName:"ForceDirectedGraph",message:ie,width:W,height:z}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:e(Vl,{componentName:"ForceDirectedGraph",width:W,height:z,children:e(Ta,Object.assign({ref:s,chartType:"force"},null!=l&&{nodes:Q.safeNodes},null!=c&&{edges:Q.safeEdges},{size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,nodeIDAccessor:F,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ee,edgeStyle:oe,colorBy:m,colorScheme:Q.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:ne,showLabels:q,enableHover:Y,tooltipContent:!1===C?()=>null:vi(C)||void 0,customHoverBehavior:T||M||_?Q.customHoverBehavior:void 0,customClickBehavior:M||_?Q.customClickBehavior:void 0,legend:Q.legend,legendPosition:Q.legendPosition},E&&"none"!==E&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},{className:u,title:X,description:V,summary:U,accessibleTable:K},null!=t.animate&&{animate:t.animate},j))})});Fd.displayName="ForceDirectedGraph";const Wd=g(function(t,o){const n=i(null);lc(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",padAngle:v=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:C,chartId:j,selection:M,linkedHover:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:N,stroke:B,strokeWidth:$,opacity:E}=t,{width:D,height:H,enableHover:I,showLabels:R=!0,title:F,description:W,summary:z,accessibleTable:Y}=s,G=Rd({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:N,selection:M,linkedHover:_,onObservation:O,onClick:C,chartType:"ChordDiagram",chartId:j,marginDefaults:s.marginDefaults,userMargin:c,width:D,height:H,loading:P,loadingContent:L,emptyContent:T}),q=r(()=>new Map,[]),X=G.safeNodes.length>0,V=r(()=>{if(X)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(p)i.fill=mt(e.data||e,p,G.colorScale);else{const r=Array.isArray(y)?y:ht[y]||gt,s=Array.isArray(r)?r:gt,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[X,p,G.colorScale,y]),U=r(()=>V?cc(V,{stroke:B,strokeWidth:$,opacity:E}):void 0,[V,B,$,E]),K=r(()=>{if(X)return Id({edgeColorBy:m,colorBy:p,colorScale:G.colorScale,nodeStyleFn:U||(e=>({fill:Bl(void 0,G.themeCategorical,y,void 0,q)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[X,m,p,G.colorScale,U,w,G.themeCategorical,y,q]),Q=r(()=>K?cc(K,{stroke:B,strokeWidth:$,opacity:E}):void 0,[K,B,$,E]),Z=r(()=>{if(!R)return;const e=k||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[R,k,f]),J=rc({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(Yl,{componentName:"ChordDiagram",message:J,width:D,height:H}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:e(Vl,{componentName:"ChordDiagram",width:D,height:H,children:e(Ta,Object.assign({ref:n,chartType:"chord"},G.safeNodes.length>0&&{nodes:G.safeNodes},null!=l&&{edges:G.safeEdges},{size:[D,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,padAngle:v,groupWidth:b,sortGroups:x,nodeStyle:U,edgeStyle:Q,colorBy:p,colorScheme:G.effectivePalette,edgeColorBy:m,edgeOpacity:w,nodeLabel:Z,showLabels:R,enableHover:I,tooltipContent:!1===A?()=>null:vi(A)||void 0,customHoverBehavior:_||O||C?G.customHoverBehavior:void 0,customClickBehavior:O||C?G.customClickBehavior:void 0},N&&"none"!==N&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},{className:d,title:F,description:W,summary:z,accessibleTable:Y},null!=t.animate&&{animate:t.animate},S))})});Wd.displayName="ChordDiagram";const zd=g(function(t,o){const n=i(null);lc(o,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,o,i;return null!==(i=null===(o=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}});const s=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:a,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",orientation:v="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:C={},onObservation:j,onClick:M,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:N,emptyContent:B,showLegend:$,legendPosition:E,legendInteraction:D,stroke:H,strokeWidth:I,opacity:R}=t,{width:F,height:W,enableHover:z,showLabels:Y=!0,title:G,description:q,summary:X,accessibleTable:V}=s,U=Rd({nodes:a,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:$,legendPosition:E,legendInteraction:D,selection:P,linkedHover:L,onObservation:j,onClick:M,chartType:"SankeyDiagram",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:N,emptyContent:B}),K=r(()=>new Map,[]),Q=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?mt(e.data||e,p,U.colorScale):Bl(void 0,U.themeCategorical,y,void 0,K),t},[p,U.colorScale,U.themeCategorical,y,K]),Z=r(()=>cc(Q,{stroke:H,strokeWidth:I,opacity:R}),[Q,H,I,R]),J=r(()=>Id({edgeColorBy:m,colorBy:p,colorScale:U.colorScale,nodeStyleFn:Z,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[m,p,U.colorScale,Z,A]),ee=r(()=>cc(J,{stroke:H,strokeWidth:I,opacity:R}),[J,H,I,R]),te=r(()=>{if(!Y)return;const e=w||f;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[Y,w,f]),oe=rc({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return oe?e(Yl,{componentName:"SankeyDiagram",message:oe,width:F,height:W}):U.loadingEl?U.loadingEl:U.emptyEl?U.emptyEl:e(Vl,{componentName:"SankeyDiagram",width:F,height:W,children:e(Ta,Object.assign({ref:n,chartType:"sankey"},U.safeNodes.length>0&&{nodes:U.safeNodes},null!=l&&{edges:U.safeEdges},{size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:h,valueAccessor:g,orientation:v,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:Z,edgeStyle:ee,colorBy:p,colorScheme:U.effectivePalette,edgeColorBy:m,edgeOpacity:A,edgeSort:S,nodeLabel:te,showLabels:Y,enableHover:z,tooltipContent:!1===O?()=>null:vi(O)||void 0,customHoverBehavior:L||j||M?U.customHoverBehavior:void 0,customClickBehavior:j||M?U.customClickBehavior:void 0,legend:U.legend,legendPosition:U.legendPosition},D&&"none"!==D&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},{className:d,title:G,description:q,summary:X,accessibleTable:V},null!=t.animate&&{animate:t.animate},C))})});function Yd(e,t,o){const n=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of n)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>{var o,n;return e.time-t.time||(null!==(o=s[e.kind])&&void 0!==o?o:99)-(null!==(n=s[t.kind])&&void 0!==n?n:99)})},l=r.length?Math.min(...r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,u=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;u.length>e;e++)h.set(u[e],u[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:y);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:y);if(n>0){const i=g(e.time);f.push({time:i,delta:-n,kind:"transfer-out",side:t}),f.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:y-=n,"top"===e.side?p+=n:y+=n,o-=n}o>0&&null!==d&&(f.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:y+=o)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),a();let m=0,v=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>k&&(k=v),w.push({t:e.time,topMass:m,botMass:v})}const S=[];let O=0;for(;w.length>O;){let e=O;for(;w.length>e+1&&w[e+1].t===w[O].t;)e++;S.push(w[O]);for(let t=O+1;e>=t;t++){const e=S[S.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||S.push(w[t])}O=e+1}const C=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let j=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===j||j>e.systemInTime)&&(j=e.systemInTime);let M=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===M||e.systemOutTime>M)&&(M=e.systemOutTime);if(S.length>0){const e=S[S.length-1],t=Math.max(null!=C?C:-1/0,null!=M?M:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&S.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=S[0],n=Math.min(null!=c?c:1/0,null!=j?j:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&S.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function Gd(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function qd(e,t){return e.map(e=>({t:Gd(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Xd(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function Vd(e,t){let o=0;for(let n=0;t.length>n;n++)for(let i=n+1;t.length>i;i++){const r=t[n],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&o++)}return o}function Ud(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function Kd(e,t){return 1e3*Vd(e,t)+Ud(e,t)}function Qd(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Zd(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=Qd(e,t),s=Kd(t,o);for(let a=0;n>a;a++){const n=Array(i).fill(0),a=Array(i).fill(0);for(const e of o){const o=t[e.source],i=t[e.target];n[o]+=i*(e.value||1),a[o]+=e.value||1,n[i]+=o*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const u=Kd(t,o);if(s>u)s=u,r=Qd(e,t);else if(u===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,r)}(e,t,o,6),function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=Kd(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=Kd(t,o);if(r>a)r=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const i=Object.assign({},t),r=Object.keys(i),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l=Object.assign({},i);let c=s.slice(),d=1/0;const u=()=>{for(const e of r)l[e]=a[i[e]];const e=Kd(l,o);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};u();const g=Array(n).fill(0);let f=0;for(;n>f;)f>g[f]?(h(f%2==0?0:g[f],f),u(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function Jd(e,t,o,n,i){var r,s,a,l,c,d,u,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=o[t.id].topPeak||0,x[t.id]=o[t.id].botPeak||0;const k="half"===v,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}w[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},S=[];if("reuse"===y){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const u=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&u.push(t.id);for(;u.length;){const e=u.shift();for(const t of null!==(a=n.outgoing[e])&&void 0!==a?a:[]){const n=(null!==(l=o.get(e))&&void 0!==l?l:0)+1;n>(null!==(c=o.get(t.target))&&void 0!==c?c:0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&u.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var n,i;const r=null!==(n=o.get(e.id))&&void 0!==n?n:0,s=null!==(i=o.get(t.id))&&void 0!==i?i:0;return r!==s?r-s:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let o=-1;for(let e=0;S.length>e;e++){const n=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=S.length-1),S[o].occupants.push({id:e.id,end:null!==(d=null==t?void 0:t.end)&&void 0!==d?d:-1/0}),S[o].peak.topPeak=Math.max(S[o].peak.topPeak,b[e.id]),S[o].peak.botPeak=Math.max(S[o].peak.botPeak,x[e.id]),A[e.id]=o}}else e.forEach((e,t)=>{var o,n;S.push({occupants:[{id:e.id,end:null!==(n=null===(o=w[e.id])||void 0===o?void 0:o.end)&&void 0!==n?n:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let O=null,C=null,j=null,M=null;const _=()=>{O=Vd(A,t),j=Ud(A,t)},P=()=>{C=Vd(A,t),M=Ud(A,t)};"crossing-min"===m?(_(),Zd(S,A,t),P()):"inside-out"===m?(_(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(S,A),P()):"crossing-min+inside-out"===m&&(_(),Zd(S,A,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=Kd(t,o);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const d=new Map;for(let e=0;n>e;e++)d.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)d.set(e,e-1);d.set(i,l)}else{for(let e=l;i>e;e++)d.set(e,e+1);d.set(i,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const u=Kd(t,o);if(u>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=u}}(S,A,t),P());const L=S.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},N=[];for(let e=0;S.length-1>e;e++){const t=L[e],o=L[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}N.push(i)}const B=[];let $=f+(null!==(h=null===(u=S[0])||void 0===u?void 0:u.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&B.push($);for(let e=1;S.length>e;e++)$+=N[e-1]*p+f,B.push($);if(S.length>0&&($+=S[S.length-1].peak.botPeak*p+f),$>g){const e=g/$;for(let t=0;B.length>t;t++)B[t]*=e}const E=0===S.length?0:S[0].peak.topPeak+N.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,D={};for(const t of e)D[t.id]=B[A[t.id]];return{effectiveSlotsHeight:E,centerlines:D,laneLifetime:w,slots:S,slotByNode:A,slotCenter:B,crossingsBefore:O,crossingsAfter:C,lengthBefore:j,lengthAfter:M}}zd.displayName="SankeyDiagram";const eu=e=>{var t,o;const{bands:n=[],ribbons:i=[],showLabels:r=!0}=e.config,s=[];for(const e of i)s.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of n)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];s.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of n)s.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(o=e.strokeWidth)&&void 0!==o?o:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const a=r?n.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:n.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:s,labels:a}};function tu(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function ou(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function nu(e,t){return"function"==typeof e?e(t):t[e]}const iu=g(function(n,s){const{nodes:a,edges:c,domain:d,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:m="startTime",endTimeAccessor:v="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:k="xExtent",edgeIdAccessor:w="id",colorBy:S,colorScheme:O,showLegend:C,legendPosition:j="right",pairing:M="temporal",packing:_="reuse",laneOrder:P="crossing-min",ribbonLane:L="both",lifetimeMode:T="half",showLaneRails:N=!1,showQualityReadout:B=!1,showLabels:$=!0,width:E=600,height:D=400,margin:H,title:I,description:R,summary:F,accessibleTable:W,responsiveWidth:z,responsiveHeight:Y,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:V=.35,timeFormat:U,valueFormat:K,tooltip:Q,enableHover:Z=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:oe,chartId:ne,frameProps:ie={}}=n,[re,se]=u([]),[ae,le]=u([]),ce=i(re),de=i(ae);ce.current=re,de.current=ae;const ue=l(e=>{ce.current=e,se(e)},[]),he=l(e=>{de.current=e,le(e)},[]),ge=void 0!==c,fe=me(ge?c:re),pe=r(()=>{const e=me(null!=a?a:[]),t=ae;if(0===e.length&&0===t.length)return Dd([],fe,f,p);const o=new Set,n=[];for(const t of e){const e=nu(g,t)+"";o.has(e)||(o.add(e),n.push(t))}for(const e of t){const t=nu(g,e)+"";o.has(t)||(o.add(t),n.push(e))}const i=Dd([],fe,f,p);for(const e of i)o.has(e.id)||(o.add(e.id),n.push(e));return n},[a,ae,fe,g,f,p]),ye=i(null),ve=l((e,t)=>{const o=nu(w,e);return null!=o?o+"":`${nu(f,e)}-${nu(p,e)}-${t}`},[w,f,p]),be=l(e=>{if(null==e)return!1;const t=e;return null!=nu(f,t)&&null!=nu(p,t)},[f,p]);lc(s,{variant:"network",frameRef:ye,overrides:{push(e){if(be(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ue([...ce.current,e])}else he([...de.current,e])},pushMany(e){const t=[],o=[];for(const n of e)be(n)?t.push(n):o.push(n);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ue([...ce.current,...t])),o.length>0&&he([...de.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){const e=ce.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ve(r,i))?o.push(r):n.push(r)}n.length!==e.length&&ue(n)}const n=de.current,i=[];for(const e of n){const n=nu(g,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&he(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){let e=!1;const i=ce.current.map((i,r)=>o.has(ve(i,r))?(n.push(i),e=!0,t(i)):i);e&&ue(i)}let i=!1;const r=de.current.map(e=>{const r=nu(g,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&he(r),n},clear(){var e;ge||ue([]),he([]),null===(e=ye.current)||void 0===e||e.clear()},getData:()=>null!=fe?fe:[],getScales:()=>null},deps:[ge,be,ve,g,fe,ue,he]});const xe=ve,ke=l(e=>nu(g,e)+"",[g]),{nodes:we,edges:Ae,domain:Se,rawNodeById:Oe,rawEdgeById:Ce}=r(()=>{const e=(null!=pe?pe:[]).map(e=>{const t={id:ke(e),__raw:e},o=k?nu(k,e):null;if(Array.isArray(o)&&2===o.length){const e=ou(o[0]),n=ou(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(null!=fe?fe:[]).map((e,t)=>{const o={id:xe(e,t),source:nu(f,e)+"",target:nu(p,e)+"",value:Number(nu(y,e)),startTime:ou(nu(m,e)),endTime:ou(nu(v,e)),__raw:e};if(b){const t=ou(nu(b,e));Number.isFinite(t)&&(o.systemInTime=t)}if(x){const t=ou(nu(x,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[ou(d[0]),ou(d[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[pe,fe,d,ke,xe,k,f,p,y,m,v,b,x]),je=Rd({nodes:pe,edges:fe,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:S,colorScheme:O,showLegend:!1,legendPosition:j,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:ne,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:H,width:E,height:D,loading:G,loadingContent:q,emptyContent:X}),Me=(null!=C?C:!!S)&&!!S,_e=l(e=>null!=H&&("number"==typeof H||null!=H[e]),[H]),Pe=r(()=>{const e=Object.assign({},je.margin);return Me&&("right"===j&&!_e("right")&&140>e.right?e.right=140:"bottom"===j&&!_e("bottom")&&80>e.bottom&&(e.bottom=80)),e},[je.margin,Me,j,_e]),Le=E-Pe.left-Pe.right,Te=D-Pe.top-Pe.bottom,Ne=r(()=>function(e,t,o){const n=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(o)&&2===o.length,s=r&&Number.isFinite(o[0])&&Number.isFinite(o[1]);r&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}(we,Ae,Se),[we,Ae,Se]),Be=r(()=>Ne.length>0?null:function(e,t,o){var n;const{plotH:i,pairing:r="temporal",packing:s="reuse",laneOrder:a="crossing-min",lifetimeMode:l="half"}=o,c=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),d=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,c,r);let u={};for(const t of e)u[t.id]=Yd(t,c,d);const h=Jd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],o=h.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=d.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(g.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],o=c.incoming[t.id],n=new Set(e.map(e=>d.get(e.id).sourceSide)),i=new Set(o.map(e=>d.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)h.slotByNode[t.source]===h.slotByNode[t.target]&&(d.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)h.slotByNode[o.source]===h.slotByNode[o.target]&&(d.get(o.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],o=c.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===d.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===d.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=n(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=o.filter(t=>!g.has(t.id)&&d.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(d.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}u={};for(const t of e)u[t.id]=Yd(t,c,d);const f=Jd(e,t,u,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),p=null!==(n=f.effectiveSlotsHeight)&&void 0!==n?n:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=Jd(e,t,u,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:u,sides:d,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(we,Ae,{plotH:Te,pairing:M,packing:_,laneOrder:P,lifetimeMode:T}),[Ne,we,Ae,Te,M,_,P,T]),$e=r(()=>A().domain(Se).range([0,Le]),[Se,Le]),Ee=l((e,t)=>{if(S&&pe){const t=Oe.get(e);if(t)return mt(t,S,je.colorScale)}return je.effectivePalette[t%je.effectivePalette.length]||"#475569"},[S,pe,Oe,je.colorScale,je.effectivePalette]),De=r(()=>{const e=new Map;return we.forEach((t,o)=>e.set(t.id,o)),e},[we]),He=r(()=>{if(!Be)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Be,n=[],i=[];return we.forEach((i,r)=>{var s;const a=t[i.id];if(!a||0===a.samples.length)return;const l=function(e,t,o,n,i){if(0===e.length)return null;const r=qd(e,i),s=e=>t-r[e].topMass*o,a=e=>t+r[e].botMass*o;let l=`M${n(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${n(r[e].t)},${s(e)}`;l+=` L${n(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${n(r[e].t)},${a(e)}`;return l+" Z"}(a.samples,e[i.id],o,$e,Se);if(!l)return;const c=qd(a.samples,Se),d=c.find(e=>e.topMass+e.botMass>0)||c[0],u=e[i.id]+(d.botMass-d.topMass)*o/2,h=Ee(i.id,r),g=null!==(s=Oe.get(i.id))&&void 0!==s?s:i,f=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=qd(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],u=n(c.t),h=n(d.t),g=e=>n(Gd(e,i)),f=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(u,i);if(n>r){const[o,l]=Xd(e,a,s);f.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=Xd(e,a,s);f.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,Ae,Be,$e,Se);n.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:$e(d.t)-4,labelY:u,labelText:i.id}))}),Ae.forEach(n=>{var r,s,a,l;const c=null===(r=t[n.source])||void 0===r?void 0:r.localAttachments.get(n.id),d=null===(s=t[n.target])||void 0===s?void 0:s.localAttachments.get(n.id);if(!c||!d)return;const u=null!==(a=De.get(n.source))&&void 0!==a?a:0,h=Ee(n.source,u),g=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),u=r(c(o.time)),h=e.value*l,g=o.value*l,f=e.sideMassBefore*l,p=o.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===o.side?(v=n-p,b=v+g):(b=n+p,v=b-g);const x="source"===s?d+.85*(u-d):"target"===s?d+.15*(u-d):(d+u)/2;return{sx:d,sTop:y,sBot:m,tx:u,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[n.source],d,e[n.target],o,$e,L,Se),{pathD:f,bezier:p}=Ts(g),y=null!==(l=Ce.get(n.id))&&void 0!==l?l:n;i.push({id:n.id,pathD:f,fill:h,opacity:V,rawDatum:y,bezier:p})}),{bands:n,ribbons:i}},[Be,we,Ae,$e,Se,Ee,Oe,Ce,L,V,De]),Ie=r(()=>({bands:He.bands,ribbons:He.ribbons,showLabels:$}),[He,$]),Re=r(()=>{if(!Me||!S)return;const e=new Map;(null!=pe?pe:[]).forEach((t,o)=>{const n=nu(S,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:Ee(ke(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Me,S,pe,Ee,ke]),Fe=r(()=>!1!==Q&&Z?void 0===Q||!0===Q?null:vi(Q)||null:null,[Q,Z]),We=l(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),ze=l(e=>K?K(e):e+"",[K]),Ye=l(n=>{if(!n||!n.data)return null;const i=n.data;if(!tu(i))return null;const r=i.data;if(Fe)return Fe(r);if("band"===i.__kind){const o=i.id,n=Be?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,i=`${n.t}:${e}`;t.has(i)||(t.add(i),o.push({t:n.t,total:e}))}return o}(Be.nodeData[o]):[],r=5,s=n.length>r?n.length:null,a=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,i=[Object.assign(Object.assign({},o[0]),{mark:"min"}),Object.assign(Object.assign({},o[Math.floor(.25*n)]),{mark:"q25"}),Object.assign(Object.assign({},o[Math.floor(.5*n)]),{mark:"median"}),Object.assign(Object.assign({},o[Math.floor(.75*n)]),{mark:"q75"}),Object.assign(Object.assign({},o[n]),{mark:"max"})],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(n,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:o}),a.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=s&&e("th",{})]})}),e("tbody",{children:a.map((o,n)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:We(o.t)}),e("td",{style:{textAlign:"right"},children:ze(o.total)}),null!=s&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:o.mark})]},n))})]}),null!=s&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",a.length," of ",s," samples"]})]})}const s=r,a=nu(f,s),l=nu(p,s),c=nu(y,s),d=nu(m,s),u=nu(v,s);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[a+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(o,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:ze(Number(c))})]}),null!=d&&t(o,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:We(ou(d))})]}),null!=u&&t(o,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:We(ou(u))})]})]})]})},[Be,Fe,We,ze,f,p,y,m,v]),Ge=r(()=>{if(!Be)return null;const{centerlines:o,laneLifetime:n,nodeData:i,valueScale:r,compressedPadding:s,crossingsBefore:a,crossingsAfter:l,lengthBefore:c,lengthAfter:d}=Be;let u=null,g=null;for(const e of we){const t=n[e.id];if(!t||null===t.start||null===t.end)continue;const o=$e(t.start),i=$e(t.end);(null===u||u>o)&&(u=o),(null===g||i>g)&&(g=i)}const f=e=>Math.max(0,Math.min(Le,e)),p=f(null!=u?u:0),y=Math.max(p,f(null!=g?g:Le));return t("g",{children:[B&&null!==(null!=l?l:null)&&t("text",{x:Le,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(d)]}),s&&e("text",{x:Le,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,o)=>{const n=$e(ou(t.date));return p-.5>n||n>y+.5?null:e("line",{x1:n,y1:0,x2:n,y2:Te,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+o)}),N&&we.map((s,a)=>{const l=n[s.id];if(!l||null===l.start)return null;const c=i[s.id],d=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},u=o[s.id]+(d.botPeak-d.topPeak)*r/2,h=$e(l.start),g=$e(l.end),f=Ee(s.id,a);return t("g",{children:[e("line",{x1:h,y1:u,x2:g,y2:u,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:u-4,x2:g,y2:u+4,stroke:f,strokeOpacity:.5})]},"lane-"+s.id)}),e("line",{x1:p,y1:Te+4,x2:y,y2:Te+4,stroke:"#94a3b8"}),h.map((o,n)=>{const i=ou(o.date),r=$e(i);if(p-.5>r||r>y+.5)return null;const s=null!=o.label?o.label:U?U(new Date(i)):"";return t("g",{transform:`translate(${r},${Te+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:s})]},n)})]})},[Be,h,$e,Le,Te,N,we,Ee,B,U]),qe=r(()=>(null!=pe?pe:[]).map(e=>({id:ke(e),data:e})),[pe,ke]),Xe=r(()=>{const e=new Map;for(const t of He.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[He]),Ve=r(()=>(null!=fe?fe:[]).map((e,t)=>{const o=xe(e,t),n=Number(nu(y,e));return{id:o,source:nu(f,e)+"",target:nu(p,e)+"",value:Number.isFinite(n)?n:0,bezier:Xe.get(o),data:e}}),[fe,xe,f,p,y,Xe]),Ue=je.loadingEl,Ke=je.emptyEl;return Ne.length>0?t("svg",{width:E,height:D,role:"img","aria-label":null!=I?I:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ne.map((t,o)=>{return e("text",{x:20,y:56+18*o,fontSize:12,fill:"#64748b",children:"• "+(n=t,"invalid-node-time"===n.kind?`node ${n.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===n.kind?`edge ${n.id} has an invalid startTime or endTime`:"invalid-domain"===n.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===n.kind?`edge ${n.id} must have a positive finite value`:"missing-node"===n.kind?`edge ${n.id} references missing ${n.endpoint} node "${n.nodeId}"`:"backward-edge"===n.kind?`edge ${n.id} (${n.source}->${n.target}) ends before it starts`:n.kind)},o);var n})]}):Ue||Ke||e(Ta,Object.assign({ref:ye,chartType:"force",nodes:qe,edges:Ve,customNetworkLayout:eu,layoutConfig:Ie,size:[E,D],responsiveWidth:z,responsiveHeight:Y,margin:Pe,title:I,description:null!=R?R:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:F,accessibleTable:W,enableHover:Z,tooltipContent:!1===Q?()=>null:Ye,backgroundGraphics:Ge,showParticles:te,particleStyle:oe,legend:Re,legendPosition:j,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;tu(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:ne,colorScheme:Array.isArray(O)?O:void 0},ie))});function ru(t){const o=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,loadingContent:C,legendInteraction:j,stroke:M,strokeWidth:_,opacity:P}=t,{width:L,height:T,enableHover:N,showLabels:B=!0,title:$,description:E,summary:D,accessibleTable:H}=o,I=Rd({nodes:r(()=>Ed(null!=n?n:null,c),[n,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:j,selection:A,linkedHover:S,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:o.marginDefaults,userMargin:i,width:L,height:T,loading:O,loadingContent:C}),R=r(()=>new Map,[]),F=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?mt(e.data||e,h,I.colorScale):Bl(void 0,I.themeCategorical,g,void 0,R),t},[h,f,I.colorScale,I.themeCategorical,g,R]),W=r(()=>cc(F,{stroke:M,strokeWidth:_,opacity:P}),[F,M,_,P]),z=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=r(()=>cc(z,{stroke:M,strokeWidth:_,opacity:P}),[z,M,_,P]),G=r(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return Hd(d)},[a,d]),q=ic({componentName:"TreeDiagram",data:n});return q?e(Yl,{componentName:"TreeDiagram",message:q,width:L,height:T}):I.loadingEl?I.loadingEl:e(Vl,{componentName:"TreeDiagram",width:L,height:T,children:e(Ta,Object.assign({chartType:a},null!=n&&{data:n},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:I.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:B?y||u:void 0,showLabels:B,enableHover:N,tooltipContent:!1===v?()=>null:vi(v)||void 0,customHoverBehavior:S||x||k?I.customHoverBehavior:void 0,customClickBehavior:x||k?I.customClickBehavior:void 0},j&&"none"!==j&&{legendHoverBehavior:I.legendState.onLegendHover,legendClickBehavior:I.legendState.onLegendClick,legendHighlightedCategory:I.legendState.highlightedCategory,legendIsolatedCategories:I.legendState.isolatedCategories},{className:s,title:$,description:E,summary:D,accessibleTable:H},null!=t.animate&&{animate:t.animate},b))})}function su(t){const o=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:c="value",nodeIdAccessor:d="name",colorBy:u,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:m,nodeStyle:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:C,loadingContent:j,legendInteraction:M,stroke:_,strokeWidth:P,opacity:L}=t,{nodeStyle:T}=x,N=gc(x,["nodeStyle"]),{width:B,height:$,enableHover:E,showLabels:D=!0,title:H,description:I,summary:R,accessibleTable:F}=o,W=Rd({nodes:r(()=>Ed(null!=n?n:null,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:g?void 0:u,colorScheme:h,showLegend:!1,legendInteraction:M,selection:k,linkedHover:w,onObservation:A,onClick:S,chartType:"Treemap",chartId:O,marginDefaults:o.marginDefaults,userMargin:i,width:B,height:$,loading:C,loadingContent:j}),z=sc(k),Y=W.customHoverBehavior,G=l(e=>{if(!e)return Y(null);const t=e.data||e;Y({data:(null==t?void 0:t.data)||t})},[Y]),q=r(()=>new Map,[]),X=r(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:u?mt(e.data||e,u,W.colorScale):Bl(void 0,W.themeCategorical,h,void 0,q),t},[u,g,W.colorScale,W.themeCategorical,h,q]),V=r(()=>v||T?e=>{var t,o;return Object.assign(Object.assign(Object.assign({},X(e)),T&&null!==(t=T(e))&&void 0!==t?t:{}),v&&null!==(o=v(e))&&void 0!==o?o:{})}:X,[X,v,T]),U=r(()=>cc(V,{stroke:_,strokeWidth:P,opacity:L}),[V,_,P,L]),K=r(()=>W.activeSelectionHook?e=>{var t;const o=Object.assign({},U(e));if(W.activeSelectionHook.isActive)if(W.activeSelectionHook.predicate(e.data||e))(null==z?void 0:z.selectedStyle)&&Object.assign(o,z.selectedStyle);else{const e=null!==(t=null==z?void 0:z.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==z?void 0:z.unselectedStyle)&&Object.assign(o,z.unselectedStyle)}return o}:U,[U,W.activeSelectionHook,z]),Q=r(()=>Hd(c),[c]),Z=void 0!==m?m:!D||"parent"!==f&&"all"!==f?void 0:18,J=ic({componentName:"Treemap",data:n});return J?e(Yl,{componentName:"Treemap",message:J,width:B,height:$}):W.loadingEl?W.loadingEl:e(Vl,{componentName:"Treemap",width:B,height:$,children:e(Ta,Object.assign({chartType:"treemap"},null!=n&&{data:n},{size:[B,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:d,childrenAccessor:a,hierarchySum:Q,padding:y,paddingTop:Z,nodeStyle:K,colorBy:u,colorScheme:W.effectivePalette,colorByDepth:g,nodeLabel:D?p||d:void 0,showLabels:D,labelMode:f,enableHover:E,tooltipContent:!1===b?()=>null:vi(b)||void 0},(w||A||S)&&{customHoverBehavior:G},(A||S)&&{customClickBehavior:W.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},{className:s,title:H,description:I,summary:R,accessibleTable:F},null!=t.animate&&{animate:t.animate},N))})}function au(t){const o=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:d,colorScheme:u,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,loadingContent:S,legendInteraction:O,stroke:C,strokeWidth:j,opacity:M}=t,{width:_,height:P,enableHover:L,showLabels:T=!0,title:N,description:B,summary:$,accessibleTable:E}=o,D=Rd({nodes:r(()=>Ed(null!=n?n:null,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:d,colorScheme:u,showLegend:!1,legendInteraction:O,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:o.marginDefaults,userMargin:i,width:_,height:P,loading:A,loadingContent:S}),H=r(()=>new Map,[]),I=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:d?mt(e.data||e,d,D.colorScale):Bl(void 0,D.themeCategorical,u,void 0,H),t},[d,h,D.colorScale,f,D.themeCategorical,u,H]),R=r(()=>cc(I,{stroke:C,strokeWidth:j,opacity:M}),[I,C,j,M]),F=r(()=>Hd(l),[l]),W=ic({componentName:"CirclePack",data:n});return W?e(Yl,{componentName:"CirclePack",message:W,width:_,height:P}):D.loadingEl?D.loadingEl:e(Vl,{componentName:"CirclePack",width:_,height:P,children:e(Ta,Object.assign({chartType:"circlepack"},null!=n&&{data:n},{size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:F,padding:p,nodeStyle:R,colorBy:d,colorScheme:D.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:vi(y)||void 0,customHoverBehavior:w||v||b?D.customHoverBehavior:void 0,customClickBehavior:v||b?D.customClickBehavior:void 0},O&&"none"!==O&&{legendHoverBehavior:D.legendState.onLegendHover,legendClickBehavior:D.legendState.onLegendClick,legendHighlightedCategory:D.legendState.highlightedCategory,legendIsolatedCategories:D.legendState.isolatedCategories},{className:s,title:N,description:B,summary:$,accessibleTable:E},null!=t.animate&&{animate:t.animate},m))})}iu.displayName="ProcessSankey",ru.displayName="TreeDiagram",su.displayName="Treemap",au.displayName="CirclePack";const lu=pt;function cu(t){const o=Wl(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:n,margin:i,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:d,colorByDepth:u=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:C,onClick:j,chartId:M,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:N,strokeWidth:B,opacity:$}=t,{width:E,height:D,enableHover:H,title:I,description:R,summary:F,accessibleTable:W}=o,z=Rd({nodes:r(()=>Ed(n,a),[n,a]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:d,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:C,onClick:j,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:E,height:D,loading:L,loadingContent:T}),Y=r(()=>new Map,[]),G=r(()=>{if(Array.isArray(d))return d;const e=ht[d];return Array.isArray(e)?e:gt},[d]),q=r(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=u?n?G[0]:lu[(e.depth||0)%lu.length]:c?mt(e.data||e,c,z.colorScale):Bl(void 0,z.themeCategorical,d,void 0,Y),o.opacity=n?1:.85,o},[c,u,z.colorScale,G,z.themeCategorical,d,Y]),X=r(()=>cc(q,{stroke:N,strokeWidth:B,opacity:$}),[q,N,B,$]),V=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),U=r(()=>{if(z.customHoverBehavior)return e=>{z.customHoverBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customHoverBehavior]),K=r(()=>{if(z.customClickBehavior)return e=>{z.customClickBehavior(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[z.customClickBehavior]),Q=ic({componentName:"OrbitDiagram",data:n});return Q?e(Yl,{componentName:"OrbitDiagram",message:Q,width:E,height:D}):z.loadingEl?z.loadingEl:e(Vl,{componentName:"OrbitDiagram",width:E,height:D,children:e(Ta,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[E,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:X,edgeStyle:V,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:u,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&H,tooltipContent:k?void 0:!1===w?()=>null:vi(w)||void 0,customHoverBehavior:P||C||j?U:void 0,customClickBehavior:C||j?K:void 0,foregroundGraphics:A,annotations:S,className:s,title:I,description:R,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=t.animate&&{animate:t.animate},O))})}cu.displayName="OrbitDiagram";const du={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},uu={opacity:.7,marginRight:4};function hu(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function gu(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function fu(e={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=e;return e=>{var s;const a=null!==(s=null==e?void 0:e.data)&&void 0!==s?s:null,l=hu(a,o,"time"),c=hu(a,n,"value");return t("div",{className:"semiotic-tooltip",style:du,children:[t("div",{children:[t("span",{style:uu,children:[i,":"]}),gu(l)]}),t("div",{children:[t("span",{style:uu,children:[r,":"]}),gu(c)]})]})}}function pu(e,t){var o;return null!=e?e:Math.max(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0,200)}const yu=g(function(t,o){var n,r,s,a,c;const d=Wl(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:C,opacity:j,background:M,tooltipContent:_,tooltip:P,onHover:L,annotations:T,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:$,decay:E,pulse:D,staleness:H,transition:I,linkedHover:R,selection:F,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=t,U=d.showAxes,K=d.enableHover,Q=null!=h?h:d.marginDefaults,Z=null!=u?u:[d.width,d.height],J=null!==(c=null!=_?_:P)&&void 0!==c?c:fu({timeAccessor:b,valueAccessor:x}),ee=i(null),{customHoverBehavior:te}=Dl({selection:F,linkedHover:R,unwrapData:!0,onObservation:W,chartType:"RealtimeLineChart",chartId:z}),oe=l(e=>{L&&L(e),te(e)},[L,te]);p(o,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ee.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=Zl(Y,Z[0],Z[1],G),ie=ne?null:Ql(v,Z[0],Z[1],q),re={stroke:S,strokeWidth:O,strokeDasharray:C};null!=j&&(re.opacity=j);const se=pu(m,v);return ne||ie||e(nr,{ref:ee,chartType:"line",runtimeMode:"streaming",size:Z,margin:Q,className:X?`${g||""} semiotic-emphasis-${X}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:re,showAxes:U,background:M,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:oe,annotations:T,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:$,decay:E,pulse:D,staleness:H,transition:I,pointIdAccessor:t.pointIdAccessor,legendPosition:V})});function mu(e,t,o){const n="function"==typeof t?t(e):e[null!=t?t:o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const i=Number(n);return Number.isFinite(i)?i:null}yu.displayName="RealtimeLineChart";const vu=g(function(o,n){var s,a,c,d,u;const h=Wl(o.mode,{width:null!==(a=null===(s=o.size)||void 0===s?void 0:s[0])&&void 0!==a?a:o.width,height:null!==(d=null===(c=o.size)||void 0===c?void 0:c[1])&&void 0!==d?d:o.height,showAxes:o.showAxes,enableHover:null!=o.enableHover?!!o.enableHover:void 0,linkedHover:o.linkedHover}),{binSize:g,size:f,margin:y,className:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x,data:k,timeAccessor:w,valueAccessor:A,direction:S="up",timeExtent:O,valueExtent:C,extentPadding:j,categoryAccessor:M,colors:_,fill:P,stroke:L,strokeWidth:T,opacity:N,gap:B,background:$,tooltipContent:E,tooltip:D,onHover:H,annotations:I,svgAnnotationRules:R,tickFormatTime:F,tickFormatValue:W,linkedHover:z,selection:Y,decay:G,pulse:q,staleness:X,transition:V,onObservation:U,chartId:K,loading:Q,loadingContent:Z,emptyContent:J,emphasis:ee,legendPosition:te,brush:oe,onBrush:ne,linkedBrush:ie}=o,re=h.showAxes,se=h.enableHover,ae=null!=y?y:h.marginDefaults,le=null!=f?f:[h.width,h.height],ce=null!==(u=null!=E?E:D)&&void 0!==u?u:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r;const s=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null;if(null==(null==s?void 0:s.binStart)||null==(null==s?void 0:s.binEnd)){const o=hu(s,n,"time"),r=hu(s,i,"value");return t("div",{className:"semiotic-tooltip",style:du,children:[t("div",{children:[e("span",{style:uu,children:"x:"}),gu(o)]}),t("div",{children:[e("span",{style:uu,children:"y:"}),gu(r)]})]})}return t("div",{className:"semiotic-tooltip",style:du,children:[t("div",{children:[e("span",{style:uu,children:"range:"}),gu(s.binStart),"–",gu(s.binEnd)]}),null!=s.total&&t("div",{children:[e("span",{style:uu,children:"count:"}),gu(s.total)]}),null!=s.category&&t("div",{children:[e("span",{style:uu,children:"category:"}),gu(s.category)]})]})}}({timeAccessor:w,valueAccessor:A}),de=i(null),{customHoverBehavior:ue}=Dl({selection:Y,linkedHover:z,unwrapData:!0,onObservation:U,chartType:"RealtimeHistogram",chartId:K}),he=l(e=>{H&&H(e),ue(e)},[H,ue]),ge=!0===oe?{dimension:"x",snap:"bin"}:"x"===oe?{dimension:"x"}:"object"==typeof oe?oe:void 0,fe=pl(ie),pe=ol(Object.assign({name:(null==fe?void 0:fe.name)||"__unused_hist_brush__",xField:(null==fe?void 0:fe.xField)||("string"==typeof w?w:"time")},(null==fe?void 0:fe.yField)?{yField:fe.yField}:{})),ye=i(pe.brushInteraction);ye.current=pe.brushInteraction;const me=l(e=>{if(ne&&ne(e),U&&U(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}),fe){const t=ye.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ne,U,K,fe]);p(n,()=>({push:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=de.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ve=Zl(Q,le[0],le[1],Z),be=ve?null:Ql(k,le[0],le[1],J),xe={};null!=P&&(xe.fill=P),null!=L&&(xe.stroke=L),null!=T&&(xe.strokeWidth=T),null!=N&&(xe.opacity=N),null!=B&&(xe.gap=B);const ke=ee?`${m||""} semiotic-emphasis-${ee}`.trim():m,we=pu(x,k),Ae=r(()=>"down"!==S?C:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,valueExtent:i,extentPadding:r}){var s;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const a=new Map;for(const i of e){const e=mu(i,o,"time"),r=mu(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/n)*n;a.set(l,(null!==(s=a.get(l))&&void 0!==s?s:0)+r)}let l=0;for(const e of a.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:k,valueAccessor:A,timeAccessor:w,binSize:g,valueExtent:C,extentPadding:j}),[S,k,A,w,g,C,j]);return ve||be||e(nr,{ref:de,chartType:"bar",runtimeMode:"streaming",size:le,margin:ae,className:ke,arrowOfTime:v,windowMode:b,windowSize:we,data:k,timeAccessor:w,valueAccessor:A,xExtent:O,yExtent:Ae,extentPadding:j,binSize:g,categoryAccessor:M,barColors:_,barStyle:xe,showAxes:re,background:$,hoverAnnotation:se,tooltipContent:ce,customHoverBehavior:he,annotations:I,svgAnnotationRules:R,tickFormatTime:F,tickFormatValue:W,decay:G,pulse:q,staleness:X,transition:V,pointIdAccessor:o.pointIdAccessor,legendPosition:te,brush:ge||(ie?{dimension:"x"}:void 0),onBrush:ge||ie?me:void 0})});function bu(t){return e(vu,Object.assign({},t,{windowMode:"growing"}))}vu.displayName="RealtimeHistogram",bu.displayName="TemporalHistogram";const xu=vu,ku=g(function(t,o){var n,r,s,a,c;const d=Wl(t.mode,{width:null!==(r=null===(n=t.size)||void 0===n?void 0:n[0])&&void 0!==r?r:t.width,height:null!==(a=null===(s=t.size)||void 0===s?void 0:s[1])&&void 0!==a?a:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:u,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:C,fill:j,opacity:M,stroke:_,strokeWidth:P,background:L,tooltipContent:T,tooltip:N,onHover:B,annotations:$,svgAnnotationRules:E,tickFormatTime:D,tickFormatValue:H,linkedHover:I,selection:R,onObservation:F,chartId:W,loading:z,loadingContent:Y,emptyContent:G,emphasis:q,legendPosition:X}=t,V=d.showAxes,U=d.enableHover,K=null!=h?h:d.marginDefaults,Q=null!=u?u:[d.width,d.height],Z=null!==(c=null!=T?T:N)&&void 0!==c?c:fu({timeAccessor:b,valueAccessor:x}),J=i(null),{customHoverBehavior:ee}=Dl({selection:R,linkedHover:I,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:W}),te=l(e=>{B&&B(e),ee(e)},[B,ee]);p(o,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Zl(z,Q[0],Q[1],Y),ne=oe?null:Ql(v,Q[0],Q[1],G),ie={};null!=C&&(ie.radius=C),null!=j&&(ie.fill=j),null!=M&&(ie.opacity=M),null!=_&&(ie.stroke=_),null!=P&&(ie.strokeWidth=P);const re=q?`${g||""} semiotic-emphasis-${q}`.trim():g,se=pu(m,v);return oe||ne||e(nr,{ref:J,chartType:"swarm",runtimeMode:"streaming",size:Q,margin:K,className:re,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:ie,showAxes:V,background:L,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:$,svgAnnotationRules:E,tickFormatTime:D,tickFormatValue:H,legendPosition:X,pointIdAccessor:t.pointIdAccessor})});ku.displayName="RealtimeSwarmChart";const wu=g(function(o,n){var r,s,a,c,d;const u=Wl(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:C,connectorStroke:j,connectorWidth:M,gap:_,stroke:P,strokeWidth:L,opacity:T,background:N,tooltipContent:B,tooltip:$,onHover:E,annotations:D,svgAnnotationRules:H,tickFormatTime:I,tickFormatValue:R,linkedHover:F,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=o,K=u.showAxes,Q=u.enableHover,Z=null!=g?g:u.marginDefaults,J=null!=h?h:[u.width,u.height],ee=null!==(d=null!=B?B:$)&&void 0!==d?d:function(o={}){const{timeAccessor:n,valueAccessor:i}=o;return o=>{var r,s;const a=null!==(r=null==o?void 0:o.data)&&void 0!==r?r:null,l=hu(a,n,"time"),c=null!==(s=null==a?void 0:a.delta)&&void 0!==s?s:hu(a,i,"value"),d=null==a?void 0:a.cumEnd,u="number"==typeof c?0>c?gu(c):"+"+gu(c):gu(c);return t("div",{className:"semiotic-tooltip",style:du,children:[t("div",{children:[e("span",{style:uu,children:"x:"}),gu(l)]}),t("div",{children:[e("span",{style:uu,children:"Δ:"}),u]}),null!=d&&t("div",{children:[e("span",{style:uu,children:"total:"}),gu(d)]})]})}}({timeAccessor:x,valueAccessor:k}),te=i(null),{customHoverBehavior:oe}=Dl({selection:W,linkedHover:F,unwrapData:!0,onObservation:z,chartType:"RealtimeWaterfallChart",chartId:Y}),ne=l(e=>{E&&E(e),oe(e)},[E,oe]);p(n,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=te.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Zl(G,J[0],J[1],q),re=ie?null:Ql(b,J[0],J[1],X),se={};null!=O&&(se.positiveColor=O),null!=C&&(se.negativeColor=C),null!=j&&(se.connectorStroke=j),null!=M&&(se.connectorWidth=M),null!=_&&(se.gap=_),null!=P&&(se.stroke=P),null!=L&&(se.strokeWidth=L),null!=T&&(se.opacity=T);const ae=V?`${f||""} semiotic-emphasis-${V}`.trim():f,le=pu(v,b);return ie||re||e(nr,{ref:te,chartType:"waterfall",runtimeMode:"streaming",size:J,margin:Z,className:ae,arrowOfTime:y,windowMode:m,windowSize:le,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:se,showAxes:K,background:N,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:ne,annotations:D,svgAnnotationRules:H,tickFormatTime:I,tickFormatValue:R,legendPosition:U,pointIdAccessor:o.pointIdAccessor})});wu.displayName="RealtimeWaterfallChart";const Au=g(function(o,n){var r,s,a,c,d;const u=Wl(o.mode,{width:null!==(s=null===(r=o.size)||void 0===r?void 0:r[0])&&void 0!==s?s:o.width,height:null!==(c=null===(a=o.size)||void 0===a?void 0:a[1])&&void 0!==c?c:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:C=20,heatmapYBins:j=20,aggregation:M="count",background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:N,svgAnnotationRules:B,tickFormatTime:$,tickFormatValue:E,decay:D,pulse:H,staleness:I,linkedHover:R,selection:F,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=o,U=u.showAxes,K=u.enableHover,Q=null!=g?g:u.marginDefaults,Z=null!=h?h:[u.width,u.height],J=null!==(d=null!=P?P:L)&&void 0!==d?d:function(o={}){const{timeAccessor:n,valueAccessor:i,xLabel:r="x",yLabel:s="y"}=o;return o=>{var a,l,c,d;const u=null!==(a=null==o?void 0:o.data)&&void 0!==a?a:null,h=null!==(l=null==u?void 0:u.xCenter)&&void 0!==l?l:hu(u,n,"time"),g=null!==(c=null==u?void 0:u.yCenter)&&void 0!==c?c:hu(u,i,"value"),f=null==u?void 0:u.count,p=null==u?void 0:u.sum,y=null==u?void 0:u.value,m=null!==(d=null==u?void 0:u.agg)&&void 0!==d?d:"count";return t("div",{className:"semiotic-tooltip",style:du,children:[t("div",{children:[t("span",{style:uu,children:[r,":"]}),gu(h)]}),t("div",{children:[t("span",{style:uu,children:[s,":"]}),gu(g)]}),null!=f&&t("div",{children:[e("span",{style:uu,children:"count:"}),gu(f)]}),"sum"===m&&null!=p&&t("div",{children:[e("span",{style:uu,children:"sum:"}),gu(p)]}),"mean"===m&&null!=y&&t("div",{children:[e("span",{style:uu,children:"mean:"}),gu(y)]})]})}}({timeAccessor:x,valueAccessor:k}),ee=i(null),{customHoverBehavior:te}=Dl({selection:F,linkedHover:R,unwrapData:!0,onObservation:W,chartType:"RealtimeHeatmap",chartId:z}),oe=l(e=>{T&&T(e),te(e)},[T,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ee.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=Zl(Y,Z[0],Z[1],G),ie=ne?null:Ql(b,Z[0],Z[1],q),re=X?`${f||""} semiotic-emphasis-${X}`.trim():f,se=pu(v,b);return ne||ie||e(nr,{ref:ee,chartType:"heatmap",runtimeMode:"streaming",size:Z,margin:Q,className:re,arrowOfTime:y,windowMode:m,windowSize:se,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:C,heatmapYBins:j,heatmapAggregation:M,showAxes:U,background:_,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:oe,annotations:N,svgAnnotationRules:B,tickFormatTime:$,tickFormatValue:E,decay:D,pulse:H,staleness:I,legendPosition:V,pointIdAccessor:o.pointIdAccessor})});function Su(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}Au.displayName="RealtimeHeatmap";const Ou=864e5;function Cu(e){return 10>e?"0"+e:e+""}const ju=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Mu(e){let t,o=e;return(n,i,r)=>{const s=n instanceof Date?n:new Date(n);e||!r||2>r.length||r===t||(t=r,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":2*Ou>o?"hours":60*Ou>o?"days":400*Ou>o?"months":"years"}(r));const a=o||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),i=n||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=ju[e.getUTCMonth()],c=e.getUTCDate(),d=e.getUTCFullYear(),u=Cu(e.getUTCHours()),h=Cu(e.getUTCMinutes()),g=Cu(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${d} ${u}:${h}:${g}`:r?`${l} ${c} ${u}:${h}:${g}`:s?`${u}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return n?`${l} ${c}, ${d} ${u}:${h}`:r?`${l} ${c} ${u}:${h}`:s?`${u}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${d} ${u}:00`:i?`${l} ${c} ${u}:${h}`:r?`${l} ${c} ${u}:00`:u+":00";case"days":return n?`${l} ${c}, ${d}`:i?`${l} ${c}`:""+c;case"months":return n?`${l} ${d}`:""+l;case"years":return""+d}}(s,new Date(r[i-1]),a):function(e,t){const o=ju[e.getUTCMonth()],n=e.getUTCDate(),i=e.getUTCFullYear(),r=Cu(e.getUTCHours()),s=Cu(e.getUTCMinutes()),a=Cu(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${i} ${r}:${s}`;case"days":return`${o} ${n}, ${i}`;case"months":return`${o} ${i}`;case"years":return""+i}}(s,a)}}function _u(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),i=Math.round(parseInt(o[2],16)*(1-t)),r=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Pu(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),i=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),r=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function Lu(e,t){return fc(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Tu(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Nu(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const d=e.querySelector("canvas");d&&c.drawImage(d,0,0,l.width,l.height);const u=(new XMLSerializer).serializeToString(a),h=new Blob([u],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(Nu(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Tu(e,t){var o;const n=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const n=r.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,i.length)>e;e++)Tu(n[e],i[e])}function Nu(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const Bu={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"},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},$u={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Eu={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Du=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Hu=["vertical","horizontal"],Iu={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Du},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Du},gradientFill:{type:["boolean","object"]},semanticGradient:{type:"array"},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:Du},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Du},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({},Bu),$u),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{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"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),$u),{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({},Bu),$u),{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({},Bu),$u),{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({},Bu),$u),{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({},Bu),$u),{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"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},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({},Bu),Eu),{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:Hu},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},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({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},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({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Bu),Eu),{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({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},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({},Bu),Eu),{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({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Hu},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Bu),{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({},Bu),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},Bu),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},gradientFill:{type:"object"},arcWidth:{type:"number"},cornerRadius:{type:"number"},sweep:{type:"number"},fillZones:{type:"boolean"},showNeedle:{type:"boolean"},needleColor:{type:"string"},color:{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({},Bu),Eu),{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({},Bu),Eu),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{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({},Bu),{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({},Bu),{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:Hu},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"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Bu),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Bu),{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({},Bu),{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({},Bu),{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"]},nodeStyle:{type:"function"}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Bu),{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({},Bu),{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"},direction:{type:"string",enum:["up","down"]},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"}}},TemporalHistogram:{required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],props:{data:{type:"array"},binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"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"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","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({},Bu),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Bu),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Bu),{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({},Bu),{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({},Bu),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Bu),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}},Ru=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Fu=new Set(["data","nodes","edges"]),Wu="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function zu(e,t,o){if(!Iu[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Iu).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(Ru.has(e)||!n&&Fu.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=Wu(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})}function Yu(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Iu[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Wu(e.props)}}function Gu(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function qu(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}function Xu(e){return fc(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?Vu(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function Vu(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function Uu(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function Ku(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function Qu(e){return"nominal"===e||"ordinal"===e}function Zu(e){return"quantitative"===e||"temporal"===e}const Ju={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},eh={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},th={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function oh(e){var t,o,n,i,r,s,a,l,c,d,u,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:gc(e,["type"])}}(e.mark),y=e.encoding||{},m=y.x,v=y.y,b=y.color,x=y.size,k=y.theta,w=y.opacity;let A;(null===(t=e.data)||void 0===t?void 0:t.values)?A=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&g.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&g.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&g.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&g.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||y.facet||y.row||y.column)&&g.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&g.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&g.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const S={};e.width&&(S.width=e.width),e.height&&(S.height=e.height);const O=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(O&&(S.title=O),(null==b?void 0:b.field)&&(S.colorBy=b.field,null===(n=b.scale)||void 0===n?void 0:n.scheme)){const e=Ju[b.scale.scheme];e&&(S.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(S.pointOpacity=w.value);const C=null==m?void 0:m.aggregate,j=null==v?void 0:v.aggregate;if(A&&(C||j)){const e=j?v:m,t=j?m:v,o=th[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(A,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const o of A){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}A=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(S.data=A),(null==m?void 0:m.bin)?(S.valueAccessor=m.field,(null==v?void 0:v.field)&&(S.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(S.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(S.valueAccessor=v.field,(null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(S.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(S.bins=o),ih(e,S,g)}let M;switch(f){case"bar":M=function(e,t,o,n,i,r,s){var a,l,c,d,u,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",Qu(null==e?void 0:e.type)&&Zu(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):Zu(null==e?void 0:e.type)&&Qu(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(m,v,b,S,A,C,j);break;case"line":if(M="LineChart",nh(m,v,S,C,j),(null==b?void 0:b.field)&&(S.lineBy=b.field),p.interpolate){const e=eh[p.interpolate];e&&(S.curve=e)}!0===p.point&&(S.showPoints=!0),A&&(S.data=A);break;case"area":if((null==b?void 0:b.field)?(M="StackedAreaChart",S.areaBy=b.field):M="AreaChart",nh(m,v,S,C,j),p.interpolate){const e=eh[p.interpolate];e&&(S.curve=e)}void 0!==p.opacity&&(S.areaOpacity=p.opacity),A&&(S.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(M="BubbleChart",S.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(S.sizeRange=x.scale.range)):M="Scatterplot",nh(m,v,S,C,j),A&&(S.data=A);break;case"rect":M="Heatmap",(null==m?void 0:m.field)&&(S.xAccessor=m.field),(null==v?void 0:v.field)&&(S.yAccessor=v.field),(null==b?void 0:b.field)&&(S.valueAccessor=b.field,delete S.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(S.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(S.yLabel=v.axis.title),A&&(S.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(M="DonutChart",S.innerRadius=p.innerRadius):M="PieChart",(null==k?void 0:k.field)?S.valueAccessor=k.field:(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null==b?void 0:b.field)&&(S.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(S.categoryAccessor=m.field),A&&(S.data=A);break;case"tick":M="DotPlot",Qu(null==m?void 0:m.type)?(S.categoryAccessor=m.field,(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(S.categoryLabel=m.axis.title),(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(S.valueLabel=v.axis.title)):Qu(null==v?void 0:v.type)?(S.categoryAccessor=v.field,(null==m?void 0:m.field)&&(S.valueAccessor=C?"value":m.field),S.orientation="horizontal",(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(S.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(S.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field)),A&&(S.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),M="Scatterplot",nh(m,v,S,C,j),A&&(S.data=A)}return ih(M,S,g)}function nh(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function ih(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}function rh(){const o=function(){const e=n.useContext(In);return e?()=>e.setVisible(e=>!e):null}();return o?e("button",{className:"semiotic-chart-action",onClick:o,title:"Data summary","aria-label":"Toggle data summary",style:dh,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const sh={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function ah({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function lh({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const ch=n.forwardRef(function({title:i,subtitle:r,children:s,width:a="100%",height:l=400,actions:c,chartConfig:d,controls:u,loading:h=!1,error:g,errorBoundary:f=!1,status:p,detailsPanel:y,className:m,style:v},b){const x=n.useRef(null),k=n.useRef(null),[w,A]=n.useState(!1),S=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),O=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),C=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&d,j=!0===(null==c?void 0:c.dataSummary),M="object"==typeof(null==c?void 0:c.export)?c.export:{},_="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",P=n.useCallback(e=>fc(this,void 0,void 0,function*(){k.current&&(yield Lu(k.current,Object.assign(Object.assign({},M),e)))}),[M]),L=n.useCallback(()=>{x.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):x.current.requestFullscreen().catch(()=>{}))},[]),T=n.useCallback(e=>fc(this,void 0,void 0,function*(){d&&(yield Xu(d,e||_||"json"))}),[d,_]);n.useEffect(()=>{const e=()=>{A(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),n.useImperativeHandle(b,()=>({export:P,toggleFullscreen:L,copyConfig:T,element:x.current}),[P,L,T]);const N=i||r||u||S||O||C||j||p,B=h?e(ah,{height:l}):g?e(lh,{error:g}):f?e(Gl,{children:s}):s;return $=t(o,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:x,className:"semiotic-chart-container"+(m?" "+m:""),style:Object.assign(Object.assign({width:a,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),v),children:[N&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[u,S&&e("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Export chart","aria-label":"Export chart",style:dh,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),j&&e(rh,{}),O&&e("button",{className:"semiotic-chart-action",onClick:L,title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",style:dh,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(o,w?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),C&&e("button",{className:"semiotic-chart-action",onClick:()=>T(),title:"Copy config","aria-label":"Copy chart configuration",style:dh,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),p&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:sh[p].bg,color:sh[p].color,lineHeight:"18px"},children:p})]})]}),t("div",{className:"semiotic-chart-body",ref:k,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},w?{flex:1}:{height:l}),children:[B,y]})]})]}),j?e(Rn,{children:$}):$;var $}),dh={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function uh({children:t,columns:o="auto",minCellWidth:i=300,gap:r=16,className:s,style:a}){const l="number"==typeof o?o:void 0;return e("div",{className:"semiotic-chart-grid"+(s?" "+s:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${o}, 1fr)`,gap:r,width:"100%"},a),children:n.Children.map(t,t=>n.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function hh({children:o,context:n,position:i="right",contextSize:r=250,gap:s=12,className:a,style:l}){const c="left"===i||"right"===i,d="left"===i||"top"===i,u=Object.assign({display:"flex",flexDirection:c?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:o}),e("div",{style:h,children:n})]})}uh.displayName="ChartGrid",hh.displayName="ContextLayout";function gh({children:o,position:n="right",size:r=300,trigger:a="click",chartId:c,observation:d,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[m,v]=u(null),[b,x]=u(null),[k,w]=u(!1),[A,S]=u(!1),O=i(null),C=i(void 0),j="click"===a?["click","click-end"]:["hover","hover-end"],{latest:M}=il({types:j,chartId:c,limit:1}),_=void 0!==d?d:M;s(()=>{if(_)if("click"===_.type||"hover"===_.type){const e=_;v(e.datum),x(e),k||(w(!0),S(!0),clearTimeout(C.current),C.current=setTimeout(()=>S(!1),200))}else!h||"click-end"!==_.type&&"hover-end"!==_.type||P()},[_]),s(()=>{null==f||f(k)},[k,f]);const P=l(()=>{S(!0),w(!1),clearTimeout(C.current),C.current=setTimeout(()=>{S(!1),v(null),x(null)},200)},[]);if(s(()=>()=>clearTimeout(C.current),[]),!m&&!A)return null;const L=m&&b?o(m,b):null;if(null===L&&!A)return null;const T=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${n}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:fh,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const fh={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};gh.displayName="DetailsPanel";export{Mc as AreaChart,rd as BarChart,bd as BoxPlot,Nc as BubbleChart,vl as CARBON_ALERT,ml as CARBON_CATEGORICAL_14,Ae as COLOR_BLIND_SAFE_CATEGORICAL,Qc as CandlestickChart,Ya as CategoryColorProvider,ch as ChartContainer,Gl as ChartErrorBoundary,uh as ChartGrid,Wd as ChordDiagram,au as CirclePack,Ac as ConnectedScatterplot,hh as ContextLayout,Oe as DARK_THEME,gh as DetailsPanel,Pc as DifferenceChart,Cd as DonutChart,Sd as DotPlot,Fd as ForceDirectedGraph,Ad as FunnelChart,Nd as GaugeChart,Bd as GroupedBarChart,Ce as HIGH_CONTRAST_THEME,Tc as Heatmap,xd as Histogram,Le as IncrementalExtent,Se as LIGHT_THEME,pd as LikertChart,Oc as LineChart,gl as LinkedCharts,zc as MinimapChart,Uc as MultiAxisLineChart,yi as MultiLineTooltip,td as NetworkCustomChart,cu as OrbitDiagram,od as OrdinalCustomChart,Od as PieChart,iu as ProcessSankey,Yc as QuadrantChart,Au as RealtimeHeatmap,vu as RealtimeHistogram,yu as RealtimeLineChart,ku as RealtimeSwarmChart,xu as RealtimeTemporalHistogram,wu as RealtimeWaterfallChart,wd as RidgelinePlot,Pe as RingBuffer,zd as SankeyDiagram,kc as Scatterplot,Fc as ScatterplotMatrix,Lc as StackedAreaChart,sd as StackedBarChart,Ta as StreamNetworkFrame,Fr as StreamOrdinalFrame,nr as StreamXYFrame,md as SwarmPlot,$d as SwimlaneChart,bl as THEME_PRESETS,bu as TemporalHistogram,Ml as ThemeProvider,pi as Tooltip,ru as TreeDiagram,su as Treemap,kd as ViolinPlot,ed as XYCustomChart,Mu as adaptiveTimeTicks,Vu as configToJSX,Xu as copyConfig,Pr as createHatchPattern,_u as darkenColor,Ku as deserializeSelections,Lu as exportChart,Yu as fromConfig,qu as fromURL,oh as fromVegaLite,Pu as lightenColor,vi as normalizeTooltip,xl as resolveThemePreset,Uu as serializeSelections,Su as smartTickFormat,kl as themeToCSS,wl as themeToTokens,zu as toConfig,Gu as toURL,ol as useBrushSelection,Ga as useCategoryColors,il as useChartObserver,nl as useFilteredData,el as useLinkedHover,Ja as useSelection,_l as useTheme};
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as a,useContext as s,useCallback as l,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleBand as S,scaleSequential as O}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{curveNatural as j,curveBasis as M,curveStepAfter as P,curveStepBefore as _,curveStep as L,curveCatmullRom as T,curveCardinal as $,curveMonotoneY as N,curveMonotoneX as B,line as D,area as E,curveLinear as I,arc as H,pie as R}from"d3-shape";import{bin as F,quantile as W,min as z,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as K,partition as Q,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as ne}from"d3-hierarchy";import oe from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as ae,forceManyBody as se,forceCenter as le,forceX as ce,forceY as ue}from"d3-force";import{ribbon as de,chord as he}from"d3-chord";function ge(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 fe(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 pe({width:t,height:n,totalWidth:o,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),C=i(O);C.current=O;const j=i(!1),M=i(null);return a(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(j.current)return;const r=S.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=i.selection;a=[r.x.invert(e),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;a=[r.x.invert(0),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;a=[r.x.invert(e),r.x.invert(n)],s=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?a=function(e,t){return 0===t.length?e:[ge(e[0],t),fe(e[1],t)]}(a,t):h&&h>0&&(a=[Math.floor(a[0]/h)*h,Math.ceil(a[1]/h)*h]);const n=r.x(a[0]),s=r.x(a[1]);if(j.current=!0,"x"===c)e.call(o.move,[n,s]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[s,t[1][1]]])}j.current=!1}const l={x:a,y:s};M.current=l,A.current(l)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,g,h,p]),a(()=>{if(!(x&&u&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],n=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=C.current;e&&e.length>0?o=fe(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);i=!0}const r=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[r,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[a,o]])}if(j.current=!1,i){const t={x:[o,e.x[1]],y:e.y};M.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const ye=Object.freeze([]);function me(e){if(!e)return ye;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 ve{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=me(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=me(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 be(t){let n=null;const o=()=>(n||(n=u(null)),n),a=xe(t);return[function({children:n,initialState:a}){const s=i(a),l=r(()=>xe(t,s.current),[]),c=o();return e(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=s(n))&&void 0!==t?t:a,u=i(e);u.current=e;const d=l(()=>u.current(r.getState()),[r]),h=l(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function xe(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 ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={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:12}},Oe={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:12}},Ce={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,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 je(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return Ce;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?Oe:Se;return we(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 we(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[Me,Pe]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:je(e.theme,t)}))}}));class _e{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,a=this.buffer[r];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[r]=t(a)}}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 Le{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 Te(e,t,n,o,i){const r=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=s,i){const e=i(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return r}function $e(e,t,n,o,i,r){const a=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&a.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:i,datum:c,group:r}}function Ne(e,t,n,o,i,r,a,s){const l=[];for(const r of e){const e=n(r),a=o(r);if(!Number.isFinite(e)||!Number.isFinite(a))continue;const c=t.x(e),u=s?s(r):i;l.push({px:c,topY:t.y(a),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:a}}function Be(e,t,n,o){var i,r,a;const s=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;s.set(o,-e/2)}else if("wiggle"===o){e.length>0&&s.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],a=e[o];let l=0,c=0,u=0;for(const e of t){const t=n(e,a)||0;l+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=s.get(r))&&void 0!==i?i:0;s.set(a,d-(c>0?l/(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=s.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)s.set(t,(null!==(a=s.get(t))&&void 0!==a?a:0)-i)}}else for(const t of e)s.set(t,0);return s}function De(e,t,n,o,i,r,a){const s=n(e),l=o(e);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:i,style:r,datum:e};return void 0!==a&&(c.pointId=a),c}function Ee(e,t,n,o,i,r,a){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:a}}function Ie(e,t,n,o,i,r,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function He(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Re(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Fe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function We(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function ze(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Ge(e){const t=e.map(ze),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Ye(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Ye(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return Ye(Math.round(a+(c-a)*r),Math.round(s+(u-s)*r),Math.round(l+(d-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Ke=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qe=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),nt=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ot=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),at=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),st=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ut=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),dt=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,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:Xe,reds:Ve,greens:Ue,oranges:Ke,purples:Qe,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 mt(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")||yt.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):gt[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))%gt.length]}function vt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=ht[n]||ht.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:gt;return x().domain(o).range(e).unknown("#999")}}function bt(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,a]=o,[s,l]=n;if(a===r)return(s+l)/2;let c=(i-r)/(a-r);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function xt(e,t,n){var o,i,r;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:a;default:return 1}}function kt(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 wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,n){return e+(t-e)*n}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ct(e,t,n){var o,i,r,a;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!==(a=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!==a?a: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 jt(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Mt(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const a=o.getTop(n),s=o.getBottom(n);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=e.scales.x(t),c=e.scales.y(a),u=e.scales.y(s);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:jt(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Pt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function _t(e,t,n){const o=[];for(const i of n){const n=Mt(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function Lt(e,t,n,o){const i=[];for(const r of o){const o=Mt(e,t,n,r);o&&i.push(o)}return i}function Tt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function $t(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 a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=De(a,e.scales,e.getX,r,s,o,l);c&&n.push(c)}}}const Nt={topOpacity:.8,bottomOpacity:.05};function Bt(e){var t,n;if(e)return!0===e?Nt:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Nt.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Nt.bottomOpacity}}const Dt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it},Et=new Map;function It(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Ht(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=It(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=Re(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:It(e.y1Accessor,"y1"),getBottom:It(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Rt{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new _e(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Re(e.timeAccessor||e.xAccessor,"time"),this.getY=Re(e.valueAccessor||e.yAccessor,"value")):(this.getX=Re(e.xAccessor,"x"),this.getY=Re(e.yAccessor,"y")),this.getGroup=We(e.groupAccessor),this.getCategory=We(e.categoryAccessor),this.getSize=e.sizeAccessor?Re(e.sizeAccessor,"size"):void 0,this.getColor=We(e.colorAccessor),this.getY0=e.y0Accessor?Re(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ht(e),this.getPointId=We(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?Re(e.openAccessor,"open"):void 0,this.getHigh=Re(e.highAccessor,"high"),this.getLow=Re(e.lowAccessor,"low"),this.getClose=n?Re(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new _e(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Re(this.config.timeAccessor||this.config.xAccessor,"time"):Re(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,a,s,l,c,u,d,h,g,f;const{config:p,buffer:y}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(a=p.baseline)&&void 0!==a?a:"zero"}:${null!==(s=p.stackOrder)&&void 0!==s?s:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,a=new Map;for(const e of t){const t=new Map;let s=0;for(const n of e.data){const e=this.getX(n),a=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(a))continue;t.set(e,(t.get(e)||0)+a),o.add(e),s+=a;const l=(r.get(e)||0)+a;r.set(e,l),l>i&&(i=l)}n.set(e.key,t),a.set(e.key,s)}const s=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===s){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=a.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=a.get(t))&&void 0!==u?u:0);f=[...o.reverse(),...n]}else f="asc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(e))&&void 0!==n?n:0)-(null!==(o=a.get(t))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):"desc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=Be(e,f,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,a=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>a&&(a=e+o)}Number.isFinite(i)&&Number.isFinite(a)||(i=0,a=0);const s=a-i,l=C?0:s>0?s*p.extentPadding:1;S=[i-l,a+l]}else S=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,n,o,i){const r=Te(e,t,n,o,i);if(0===r.size)return[0,0];let a=0;for(const e of r.values())e.total>a&&(a=e.total);return[0,a]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;S=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!O&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n)),Number.isFinite(o)&&(S[0]>o&&(S[0]=o),o>S[1]&&(S[1]=o))}const e=S[1]-S[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(g=p.yExtent)||void 0===g?void 0:g[0],o=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=n?S[0]:S[0]-t,null!=o?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||C||(S[0]=null!=n?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const j="streaming"===p.runtimeMode,M=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(P=p.arrowOfTime)||"down"===P?"y":"x")){const t="right"===p.arrowOfTime?[M,e.width-M]:[e.width-M,M];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-M,M])}}else{const t="down"===p.arrowOfTime?[M,e.height-M]:[e.height-M,M];this.scales={x:k().domain(S).range([M,e.width-M]),y:k().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[M,e.width-M]),y:t(p.yScaleType,S,[e.height-M,M])}}var P;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Rt.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=C().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,a,s,l;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(n=c.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:l,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:ft},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(a=h.overlays)&&void 0!==a?a:null,null!==(s=h.nodes)&&void 0!==s?s:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:r}=Pt(e.ribbons);if(r.length>0&&i.push(..._t(e,t,r)),n.length>0)for(const t of o)i.push(...Lt(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=$e(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 $t(e,o,i),i}(d,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Pt(e.ribbons);if(r.length>0&&o.push(..._t(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=Ne(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),s=Bt(e.config.gradientFill);s&&(a.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return $t(e,n,o),o}(d,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=Pt(e.ribbons);if(r.length>0&&o.push(..._t(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],a=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=Ne(t.data,e.scales,e.getX,e.getY,r,n,t.key,a),s=Bt(e.config.gradientFill);s&&(i.fillGradient=s),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=$e(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 $t(e,n,o),o}(d,t);case"stackedarea":return function(e,t){var n,o,i,r;const a=e.groupData(t),s=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",l=()=>a.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===s)l();else if("asc"===s||"desc"===s||"insideOut"===s){const t=new Map;for(const n of a){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"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else if("desc"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else{const e=[...a].sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)}),r=[],s=[];let l=0,c=0;for(const n of e)c>l?(r.push(n),l+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(s.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);a.length=0,a.push(...s.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,a,s="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),r=o(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(l=h.get(o.key))||void 0===l?void 0:l.get(t))||0;g.set(t,n||1)}}const f=Be(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},s),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],s=[],l=new Map;for(const n of d){let i=e.get(n)||0;const a=m.get(n);r&&(i/=g.get(n));const c=a+i,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),m.set(n,c),l.set(n,c)}y.set(n.key,l);const c={type:"area",topPath:o,bottomPath:s,style:i(n.key,n.data[0]),datum:n.data,group:n.key};a&&(c.curve=a),p.push(c)}return{nodes:p,stackedTops:y}}(a,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of a){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};$t(e,a,g,n)}return g}(d,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let a=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);a=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=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(a&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=a(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(n);o&&s.has(o)&&(t=Object.assign(Object.assign({},t),{fill:s.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=De(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(d,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=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=Re(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/a,p=(g-h||1)/s,y=a*s;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)/f),a-1),d=Math.min(Math.floor((r-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+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/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,C=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>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;C.push(Ie(n*w,(s-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=Re(e.config.valueAccessor,"value"),i=Fe(e.config.xAccessor,"x"),r=Fe(e.config.yAccessor,"y"),a=new Map,s=new Map,l=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);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.set(g[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=a.get(l[e]),r=s.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Dt?e:"blues";let n=Et.get(t);if(n)return n;n=Array(256);const o=Dt[t]||Xe;for(let e=0;256>e;e++)n[e]=o(e/255);return Et.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=n.width/u,C=n.height/d,j=e.config.showValues,M=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;P.push(Ie(o*O,(d-1-(n-o)/u)*C,O,C,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:M}:void 0))}return P}(d,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(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),a=Array.from(t).filter(e=>!o.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const a=[],s=e.scales,[l,c]=s.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,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.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=s.x(n),p=s.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=s.y(n),c=s.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";a.push(Ee(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),n+=r}}else{const e=s.y(0),n=s.y(t.total);a.push(Ee(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{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:a,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(l=d.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,a,s;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!==(a=c.opacity)&&void 0!==a?a:.7,g=c.stroke,f=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 a=d;if(e.getCategory){const t=e.getCategory(n);a=(null===(s=e.config.barColors)||void 0===s?void 0:s[t])||a}const c={type:"point",x:i,y:r,r:u,style:{fill:a,opacity:h,stroke:g,strokeWidth:f},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,n){var o,i,r,a,s,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 f=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(a=null==h?void 0:h.negativeColor)&&void 0!==a?a:null===(s=e.config.themeSemantic)||void 0===s?void 0:s.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),a=x+r;let s;s=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!==s?d.x(i+s):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=a;continue}const A=d.y(x),S=d.y(a),O=Math.min(A,S),C=Math.abs(A-S),j={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(j.opacity=b),u.push(Ee(k,O,w,C,j,Object.assign(Object.assign({},o),{baseline:x,cumEnd:a,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=a}return u}(d,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=i?s:a.upColor||"#28a745",c=i?s:a.downColor||"#dc3545",u=i?s:a.wickColor||"#333",d=a.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=a.bodyWidth)&&void 0!==o?o:0;if(null==a.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),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=i?o:e.getOpen(n),h=i?a:e.getClose(n);if(!i&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?xt(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 a=new Map;for(let e=0;n.length>e;e++)a.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 s=a.get(t[n]);null!=s?(o[n]=xt(e,s,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 s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(i[n]=xt(e,o,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=a.get(n);if(null!=t){const n=xt(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=xt(e,t,r);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;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*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const a="undefined"!=typeof performance?performance.now():Date.now(),s=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 s=kt(e,r,a);s>i&&(i=s)}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=kt(e,i,a);r>0&&(n._pulseIntensity=r,n._pulseColor=s,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,a,s;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Ct(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===(a=c.style)||void 0===a?void 0:a.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===(s=c.style)||void 0===s?void 0:s.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=Ct(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,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,P,_,L,T,$,N,B,D,E,I,H,R,F,W,z,Y,G;if(0===o.size&&0===i.size)return n;const q=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 X=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],_=Ct(e,r,t);if(!_)continue;if(r._transitionKey=_,"line"===r.type||"area"===r.type){const e=i.get(_);if(e){if(U.add(_),"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]];X=!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]];X=!0}r._targetOpacity=null!==(a=r.style.opacity)&&void 0!==a?a:1,r._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s: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}),X=!0;continue}const L=o.get(_);if("point"===r.type)if(L){V.add(_);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,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("rect"===r.type)if(L){V.add(_);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!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("heatcell"===r.type)if(L){V.add(_);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,X=!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}),X=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(_);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S: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!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,X=!0)}else r._targetOpacity=null!==(P=null===(M=r.style)||void 0===M?void 0:M.opacity)&&void 0!==P?P:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!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!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),X=!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),X=!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!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==($=t.opacity)&&void 0!==$?$: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!==(N=t.w)&&void 0!==N?N:0,h:null!==(B=t.h)&&void 0!==B?B:0,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D: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!==(E=t.w)&&void 0!==E?E:0,h:null!==(I=t.h)&&void 0!==I?I:0,fill:"#999",datum:null,style:{opacity:null!==(H=t.opacity)&&void 0!==H?H:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(R=t.openY)&&void 0!==R?R:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(F=t.closeY)&&void 0!==F?F:o,highY:null!==(W=t.highY)&&void 0!==W?W:o,lowY:null!==(z=t.lowY)&&void 0!==z?z: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)}X=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),X&&(n.activeTransition={startTime:Ot(),duration:q}),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,a,s,l,c;if(!n.activeTransition)return!1;const u=At(e,n.activeTransition),d=wt(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=St(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=St(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=St(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==n.w&&(e.w=St(n.w,e._targetW,d)),void 0!==n.h&&(e.h=St(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!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==n.w&&(e.w=St(n.w,e._targetW,d)),void 0!==n.h&&(e.h=St(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!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=St(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=St(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=St(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=St(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:St(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]=St(t[o][0],n[o][0],d),e.path[o][1]=St(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:St(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]=St(t[n][0],o[n][0],d),e.topPath[n][1]=St(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]=St(n[t][0],i[t][0],d),e.bottomPath[t][1]=St(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,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 a=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,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)||ft;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Rt.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let a=!1,s=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!He(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=l||!He(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=Re(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Re(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Re(this.config.xAccessor,"x"),this.getY=Re(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ht(this.config)),a=!0,s=!0)}if("groupAccessor"in e&&!He(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?We(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!He(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?We(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!He(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Re(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!He(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!He(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Re(this.config.y0Accessor,"y0"):void 0,a=!0,s=!0),("boundsAccessor"in e&&!He(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=Ht(this.config),a=!0,s=!0),"pointIdAccessor"in e&&!He(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?We(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!He(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!He(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!He(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!He(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Re(this.config.openAccessor,"open"):void 0,this.getHigh=Re(this.config.highAccessor,"high"),this.getLow=Re(this.config.lowAccessor,"low"),this.getClose=t?Re(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0,s=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){a=!0;break}}a&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Ft(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Wt(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 zt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Yt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Gt(e,t){const n=Yt(e);if(!n)return!1;const o=Yt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function qt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Xt(e,t,n,o,i){const r=Math.max(o,i+5,12),a=t-r,s=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>s||a>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,a=e.y-n,s=Math.sqrt(r*r+a*a);zt(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}Rt.GROUP_COLOR_MAP_CAP=1e3,Rt.QUADTREE_THRESHOLD=500;const Vt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ut=new WeakMap;let Kt=0,Qt=!1,Zt=null,Jt=null,en=null;function tn(e,t){var n,o;if(!t)return t;const i=Vt.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(Qt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Qt=!0;const e=()=>{Kt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Zt=new MutationObserver(e),Zt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Jt=window.matchMedia("(prefers-color-scheme: dark)"),en=e,"function"==typeof Jt.addEventListener?Jt.addEventListener("change",en):"function"==typeof Jt.addListener&&Jt.addListener(en)}catch(e){}}();let a=Ut.get(r);a&&a.version===Kt||(a={version:Kt,map:new Map},Ut.set(r,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function nn(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 on(e){switch(e){case"monotoneX":return B;case"monotoneY":return N;case"cardinal":return $;case"catmullRom":return T;case"step":return L;case"stepBefore":return _;case"stepAfter":return P;case"basis":return M;case"natural":return j;default:return null}}function rn(e,t,n){return null==t?n:"string"!=typeof t?t:tn(e,t)||n}function an(e,t,n,o,i,r,a){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 s=e.createLinearGradient(o,i,r,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,i,r,a),[h,g,f]=nn(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function sn(e,t,n,o,i,r){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of a)s.addColorStop(e.offset,e.color);return s}const ln=new WeakMap;function cn(e,t){const n=on(t);if(!n)return e;const o=ln.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,a,s,l){if(!i)return i=[s,l],void o.push([s,l]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*s,h*h*h*u+3*h*h*d*t+3*h*d*d*a+d*d*d*l])}i=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return D().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return ln.set(e,i),i}function un(e,t,n,o=30,i,r=0){let a=null;if(i){const e=Xt(i,t,n,o,r);e&&(a={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=hn(r,t,n,o);break;case"line":e=gn(r,t,n,o);break;case"rect":if(null==r.datum)break;e=pn(r,t,n);break;case"heatcell":e=yn(r,t,n);break;case"area":if(!1===r.interactive)break;e=vn(r,t,n);break;case"candlestick":e=mn(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function dn(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=bn(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[a,s]=e[i],[l,c]=e[r];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function hn(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function gn(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const a=bn(e.path,t);if(0>a)return null;const[s,l]=e.path[a];let c;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 a=i;r>=a;a++){const[i,r]=e.path[a],[s,l]=e.path[a+1],c=fn(t,n,i,r,s,l);o>c&&(o=c)}c=o}else{const e=t-s,o=n-l;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:s,y:l,distance:c}}function fn(e,t,n,o,i,r){const a=i-n,s=r-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function pn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function yn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function mn(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,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+a*a)}}return null}function vn(e,t,n){if(0===e.topPath.length)return null;const o=bn(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],a=t-i,s=n-r,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function bn(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 xn(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 a=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&&a.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:a}}function kn(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}}function wn(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?An(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?An(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}}function An(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 Sn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function On(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function Cn(e,t,n,o,i,r){a(()=>{if(!e)return;const a=setInterval(()=>{var a;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(a=e.threshold)&&void 0!==a?a:5e3,u=l-s.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,i,o])}const jn={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function Mn(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,jn[n])(o(e,t),i),r}function Pn({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function _n(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Ln=(n,o,i,r,a,s,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=a,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((n,d)=>{const h=Mn(n,d,g,f,x),A=_n(n,r,a),S=a&&a.size>0&&a.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?S||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&e(Pn,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=w}),y};function Tn({config:n,orientation:i="vertical",width:r=100}){const{colorFn:a,domain:s,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:a(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:a(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function $n(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const a=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(a,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:a,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:s,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:Ln(t,o,i,r,a,s,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,a,s,l,c,u,d,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!o&&!i),S="isolate"===d||void 0===d&&null!=a,O=y.map(e=>v+b+7*e.label.length),C=[];let j=0,M=0;O.forEach((e,t)=>{const n=0===M?e:M+x+e;g&&g>0&&M>0&&n>g?(C.push({start:j,end:t,width:M}),j=t,M=e):M=n}),y.length>0&&C.push({start:j,end:y.length,width:M}),C.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],w=Mn(n,g,f,p,v),C=_n(n,r,a),j=a&&a.size>0&&a.has(n.label);m.push(t("g",{transform:`translate(${h},${d*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===s&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?j||!1:void 0,"aria-current":A&&!S&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,j&&e(Pn,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=O[g]+x}});const P=Math.max(0,...C.map(e=>e.width)),_=C.length;return{items:m,offset:P,totalRows:_,totalHeight:_*k}})(n,r,a,s,l,c,u,o,d,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!a);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),k]})}function Nn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Bn(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Dn(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:a,legendPosition:s="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===s||"bottom"===s,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-a.left-a.right):100);let v,b;return"left"===s?(v=Math.max(4,a.left-m-10),b=a.top):"top"===s?(v=a.left,b=y?32:8):"bottom"===s?(v=a.left,b=r-a.bottom+38):(v=i-a.right+10,b=a.top),e("g",{transform:`translate(${v}, ${b})`,children:Bn(o)?e(Tn,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Nn(o)?e($n,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o})}function En(e){return"string"==typeof e?{type:e}:e}function In({orient:n,config:o,values:i,scale:a,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=r(()=>{if(0===i.length)return null;const o=a.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],a=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],r+1.5*a)}}(i);if(!o)return null;const{q1:s,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=o,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+f/2),x2:y,y2:v+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-f:v+p,width:Math.abs(i-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-f:v+p,x2:r,y2:"top"===n?v-p:v+p+f,stroke:c.fill,strokeWidth:2})]})}{const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+f/2),y1:u,x2:v+m*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-f:v+p,y:Math.min(o,i),width:f,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-f:v+p,y1:r,x2:"left"===n?v-p:v+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=F().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=a((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),l=a((i.x0+i.x1)/2);o.push(u?`${l},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,a,c,s,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Hn(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let a="";for(const e of i)a&&a.length+1+e.length>o?(r.push(a),a=e):a=a?`${a} ${e}`:e;return a&&r.push(a),r}function Rn(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 Fn(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:a,title:s,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!a&&!s)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=s?d?[s]:Hn(s,u):[],m=a?d?[a]:Hn(a,u):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let w=null;if((s||a)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function Wn(t,n,o,i,r){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("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)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,a=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-a,x2:i,y2:(n.y2||0)-a,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)-a;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:Rn((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function zn(t,n,o,i,r,a){var s;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==a?void 0:a.radius)){if("callout-rect"===r&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const i=e/2,r=o/2,a=t-i,s=n-r;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+a*h,u=r+s*h}}}else if("bracket"===r&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",a="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(a){const i=(null!==(s=null==o?void 0:o.curve)&&void 0!==s?s:.25)*d,a=(c+t)/2+-(n-u)/d*i,g=(u+n)/2+(t-c)/d*i;l.push(e("path",{className:"connector-curve",d:`M${c},${u}Q${a},${g} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-u,a-c)}else l.push(e("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e("g",{className:"annotation-connector",children:l})}function Yn(e){var n,o;const{x:i=0,y:r=0,dx:a,dy:s,nx:l,ny:c,note:u,connector:d,subject:h,type:g,color:f,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=e,k=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,w=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,A=new Set(Array.isArray(y)?y:[]);let S=a||0,O=s||0;null!=l&&(S=l-k),null!=c&&(O=c-w);const C="string"==typeof g?g:"label";if("bracket"===C&&h&&0===S&&0===O)if(void 0!==h.width){S=h.width/2;const e=h.depth||30;O=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;S=e+(0>e?-5:5),O=h.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${k},${w})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&zn(S,O,d,f,C,h),!A.has("subject")&&Wn(C,h,f,k,w),!A.has("note")&&Fn(u,S,O,f)]}))}function Gn(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,a="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=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:s});return e(Yn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:a}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Yn,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:a}),c)}function qn(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 Xn(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 Vn(e){return null==e?null:e+""}function Un(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Kn(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Un(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.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===(a=e.scales)||void 0===a?void 0:a.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 o?Un(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Vn(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const a=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Vn(e.pointId)===r);if(a)return Un(t,n,{x:a.x,y:a.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Vn(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!s)return null;const l=qn(s,n),c=Xn(s,n);return null==l||null==c?null:Un(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let a=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,s=t.y)}if(null!=a&&null!=s||(a=qn(e,n),s=Xn(e,n)),null!=a&&null!=s)return Un(t,n,{x:a,y:s});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Qn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Zn={secondary:0,primary:3},Jn=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function eo(e){return!0===(null==e?void 0:e._annotationDeferred)}function to(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function no(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function oo(e){return Math.max(.72,.95-.06*e)}function io(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:no(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>eo(e.annotation)),r=t.some(e=>null!=to(e.annotation)),a=t.some(e=>"layer"===to(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const s=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of n)e.emphasis&&(e.rank=Zn[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,a=eo(n.annotation);let s=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;s=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:oo(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=to(n.annotation);return l&&(s=e("g",{className:"annotation-cohesion--"+l,children:s},"annotation-cohesion-"+o)),a&&(s=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return i&&l.unshift(e("style",{children:Jn},"annotation-disclosure-style")),a&&l.unshift(e("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}const ro={linear:I,monotoneX:B,monotoneY:N,step:L,stepAfter:P,stepBefore:_,basis:M,cardinal:$,catmullRom:T};function ao(e,t,n,o){const i=[];return e.forEach((e,r)=>{let a;if(n){const i=n(e,r,o);a=null!=i?i:t(e,r,o)}else a=t(e,r,o);a&&i.push({node:a,annotation:e})}),io(i)}function so(n){return function(n,i,r){var a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,P,_,L,T,$,N,B,D,H,R,F,W,z,Y,G,q,X,V,K,Q,Z,J,ee,te,ne,ie,re,ae;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Kn(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!Qn(o,c,r))return null;const u="callout"===n.type?"callout-circle":n.type,d="callout-circle"===u?{radius:null!==(a=n.radius)&&void 0!==a?a:12,radiusPadding:n.radiusPadding}:"callout-rect"===u?{width:n.width,height:n.height}:void 0;return e(Gn,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(s=n.dx)&&void 0!==s?s:30,dy:null!==(l=n.dy)&&void 0!==l?l:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:u},d?{subject:d}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=qn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"top";let l;return l="bottom"===s?(r.height||0)-4:"center"===s?(r.height||0)/2:12,t("g",{children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:o+4,y:l,fill:a,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=Xn(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"right";let l,c;return"left"===s?(l=4,c="start"):"center"===s?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:o-4,textAnchor:c,fill:a,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:qn(Object.assign(Object.assign({},e),{type:"point"}),r),y:Xn(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=U(o),s=n.padding||10;return t("g",{children:[e("circle",{cx:a.x,cy:a.y,r:a.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:a.x,y:a.y-a.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:qn(Object.assign(Object.assign({},e),{type:"point"}),r),y:Xn(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=n.padding||10,s=o.map(e=>e.x),l=o.map(e=>e.y),c=Math.min(...s)-a,u=Math.max(...s)+a,d=Math.min(...l)-a,h=Math.max(...l)+a;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],a={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=qn(t,r),s=Xn(t,r);if(null==i||null==s)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||a;return e("circle",Object.assign({cx:i,cy:s,r:l},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=qn(n,r),o=Xn(n,r);return e(Gn,{noteData:{x:null!=t?t:0,y:null!=o?o:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l="ordinal"===r.frameType,y="horizontal"===r.projection,m=l?a:null,v=l?s:null;let b;const x=[],k=new Map;if(l&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[a],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(u=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=r.scales)||void 0===d?void 0:d.time,A=null!==(g=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=r.scales)||void 0===f?void 0:f.value;if(!w||!A)return null;const S=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},O=w,C=A;let j;if(l)if(y){const e=S(C);j=(t,n)=>[O(n),e(t)]}else{const e=S(O);j=(t,n)=>[e(t),C(n)]}else j=(e,t)=>[O(e),C(t)];const M=n.method||"linear";let P;P="loess"===M?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]),a=Math.max(2,Math.ceil(t*n)),s=[];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(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=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],f+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(p=n.bandwidth)&&void 0!==p?p:.3):("polynomial"===M?oe.polynomial(b,{order:n.order||2}):oe.linear(b)).points;const _=P.map(([e,t])=>{const[n,o]=j(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=P[P.length-1],[$,N]=j(T[0],T[1]);return t("g",{children:[e("polyline",{points:_,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:$+4,y:N-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,a=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,s=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(a,s),width:r.width||0,height:Math.abs(s-a),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(a,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=null!==(w=null===(k=r.scales)||void 0===k?void 0:k.x)&&void 0!==w?w:null===(A=r.scales)||void 0===A?void 0:A.time,l=null!==(O=null===(S=r.scales)||void 0===S?void 0:S.y)&&void 0!==O?O:null===(C=r.scales)||void 0===C?void 0:C.value;if(!s||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[a]-t[a]);if(2>h.length)return null;const g=ro[r.curve||"linear"]||I,f=E().x(e=>s(e[a])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(j=n.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][a])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const a=r.yAccessor||"y",s=null!==(P=null===(M=r.scales)||void 0===M?void 0:M.x)&&void 0!==P?P:null===(_=r.scales)||void 0===_?void 0:_.time,l=null!==(T=null===(L=r.scales)||void 0===L?void 0:L.y)&&void 0!==T?T:null===($=r.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const c=o.map(e=>e[a]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(N=n.threshold)&&void 0!==N?N:2,f=u-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(B=n.fillOpacity)&&void 0!==B?B:.1,v=n.anomalyColor||"#ef4444",b=null!==(D=n.anomalyRadius)&&void 0!==D?D:6,x=l(u+g*h),k=l(f),w=o.filter(e=>{const t=e[a];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:r.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=qn(t,r),i=Xn(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l=null!==(R=null===(H=r.scales)||void 0===H?void 0:H.x)&&void 0!==R?R:null===(F=r.scales)||void 0===F?void 0:F.time,c=null!==(z=null===(W=r.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(Y=r.scales)||void 0===Y?void 0:Y.value;if(!l||!c)return null;const u=o.map(e=>[e[a],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>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=oe.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const a=(e*i-t*n)/r,s=(n-a*t)/e;d=e=>s+a*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(G=n.confidence)&&void 0!==G?G:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(q=n.steps)&&void 0!==q?q:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),C=`${l(x)},${c(d(x))}`,j=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:n.fill||"#6366f1",fillOpacity:null!==(X=n.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e("polyline",{points:`${C} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(K=n.strokeDasharray)&&void 0!==K?K:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=Kn(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!Qn(t,o,r))return null;const a=null!==(Q=n.dx)&&void 0!==Q?Q:0,s=null!==(Z=n.dy)&&void 0!==Z?Z:0,l=null!==(J=n.width)&&void 0!==J?J:32,c=null!==(ee=n.height)&&void 0!==ee?ee:32,u=null!==(te=n.content)&&void 0!==te?te:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const a=Kn(n,i,r);if(!a)return null;const{x:s,y:l}=a,c=s+(n.dx||0),u=l+(n.dy||0),d=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:u,fill:d,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:s,y1:l,x2:c,y2:u,stroke:d,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const a=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(ne=r.scales)||void 0===ne?void 0:ne.o,l=null===(ie=r.scales)||void 0===ie?void 0:ie.x,c=null===(re=r.scales)||void 0===re?void 0:re.y,u=a(s)?s:a(l)?l:a(c)?c:null;if(!u)return null;const d=u(o+"");if(null==d)return null;const h=u.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ae=n.opacity)&&void 0!==ae?ae:.15,p=n.label;return t("g",(r.projection?"vertical"===r.projection:u===l)?{children:[e("rect",{x:d,y:0,width:h,height:r.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:r.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+i)}default:return null}}}const lo=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function co(e){return!!e&&"object"==typeof e&&lo.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function uo(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function ho(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function go(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*function(e){return Math.max(0,Math.min(1,e))}(r)),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const fo=32,po=6,yo=4,mo=8,vo=72;const bo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function xo(e){return co(e)}function ko(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function wo(e,t,n,o,i){const r=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?a-i.height:a,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?a-i.height-4:a+4,width:i.width,height:i.height}}function Ao(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function So(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Oo(e,t,n,o,i,r,a,s){const l=Ao(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,s);for(const e of n)c+=12*So(l,e);for(const e of o)c+=4*So(l,e);return c}function Co(e){var t;const{annotations:n,context:o,defaultOffset:i=fo,notePadding:r=po,markPadding:a=yo,edgePadding:s=mo,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=vo,density:d,progressiveDisclosure:h=!1,redundantCues:g=!1,responsive:f,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,a);let k=!1;const w=n.map((e,t)=>{if(!xo(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const a=e.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(a)&&a.length>=2&&s){const e=a[0],t=a[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Kn(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const a=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...ko("string"==typeof e.title?e.title:void 0,t),...ko("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(l&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Ao(wo(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,a),r)),e}var d;let h=null,g=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Oo(wo(n.x,n.y,e.dx,e.dy,a),e,b,x,m,v,r,s);g>t&&(h=e,g=t)}if(!h)return e;const f=Ao(wo(n.x,n.y,h.dx,h.dy,a),r);b.push(f);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return k=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=k?w:n.slice();let S=A;if(g){let e=!1;const t=A.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});S=e?t:A}{let e=!1;const t=S.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=bo[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),a="string"==typeof e.label?e.label:"";return a.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:a?`${a} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});S=e?t:S}const O=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:ho(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),a=ho(o,i,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,co(n))};var n}),l=s.filter(e=>e.note);if(0===l.length||a>=l.length)return{visible:n.slice(),deferred:[],budget:a};const c=l.filter(e=>uo(e.annotation)),u=l.filter(e=>!uo(e.annotation)).sort((e,t)=>go(t.annotation)-go(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,a-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),g=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:a}}(Object.assign({annotations:S,width:m,height:v},o));for(const e of i)O.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of S)xo(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of S)!0===(null==e?void 0:e.defensive)&&O.delete(e);let C;return C=0===O.size?S:h?S.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):S.filter(e=>!O.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>xo(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(C,p):C}let jo={positions:new Map};const Mo=new Set;function Po(){for(const e of Mo)e()}function _o(e,t){const n=jo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(jo.positions);o.delete(e),jo={positions:o},Po()}function Lo(e,t){const n=jo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(jo.positions);o.delete(e),jo={positions:o},Po()}function To(){return jo}function $o(e){return Mo.add(e),()=>Mo.delete(e)}const No={positions:new Map};function Bo(){return()=>{}}function Do(){return No}function Eo(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,a=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||a===s)return r?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Io(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Ho(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Ro(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Fo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Wo(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 a="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*i}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);a+=`L${o+4*i},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function zo(n){const{width:o,height:i,totalWidth:a,totalHeight:s,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||g||Yo,r=Math.max(2,Math.floor(o/70)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Eo(c.x,"exact"===p?Math.max(2,a):Math.min(a,r),p),l=s.map(e=>e.valueOf()),u=s.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=u.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Go(u,Math.max(55,h+8))},[c,d,g,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||f||Yo,r=Math.max(2,Math.floor(i/30)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return Go((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Eo(c.y,"exact"===p?Math.max(2,a):Math.min(a,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),k=null==d?void 0:d.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),S=(null==x?void 0:x.jaggedBase)||!1,O=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var n,r;const a=Fo(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),s=Fo(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),w&&!S&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:Wo("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:Wo("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function Yo(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Go(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 qo(o){var s,l;const{width:u,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:O,legend:C,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:P,legendIsolatedCategories:_,legendPosition:L="right",legendLayout:T,foregroundGraphics:$,marginalGraphics:N,xValues:B,yValues:D,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:H,xAccessor:R,yAccessor:F,annotationData:W,pointNodes:z,curve:Y,underlayRendered:G,canvasObscuresUnderlay:q=!0,linkedCrosshairName:X,linkedCrosshairSourceId:V,children:U}=o,K=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||Yo,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,a=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Eo(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),s=a.map(e=>e.valueOf()),l=a.map((e,t)=>({value:e,pixel:p.x(e),label:o(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),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=Go(l,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,s);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,u,A]),Q=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||Yo,i=Math.max(2,Math.floor(d/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let a=Go((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Eo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==n?void 0:n.includeMax)&&a.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=a[a.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[y,p,m,w,d,A]),Z=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||Yo,i=Math.max(2,Math.floor(d/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Go((null!==(t=n.tickValues)&&void 0!==t?t:Eo(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,w,d,A]),J=i(new Map),ee=i(null!==(s=null==E?void 0:E.length)&&void 0!==s?s:0),te=null!==(l=null==E?void 0:E.length)&&void 0!==l?l:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=r(()=>{if(!E||0===E.length)return null;const e=so(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:R,yAccessor:F,width:u,height:d,data:W,frameType:"xy",pointNodes:z,curve:Y,stickyPositionCache:J.current};return ao(I?Co(Object.assign({annotations:E,context:t},"object"==typeof I?I:{})):E,e,H,t)},[E,I,H,u,d,R,F,W,p,z,Y]),oe=function(e){var t;const n=c(e?$o:Bo,e?To:Do,e?To:Do);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(X);return a(()=>{if(!(null==oe?void 0:oe.locked)||!X)return;const e=e=>{"Escape"===e.key&&Lo(X)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,X]),y||O||C||$||N||ne&&ne.length>0||S||U||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!G||q)&&(()=>{var n,o;const i=Fo(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=Fo(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[K.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),Q.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,a=(null==n?void 0:n.jaggedBase)||!1,s=(null==o?void 0:o.jaggedBase)||!1,l=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&K.length>1&&(()=>{const e=u/Math.max(K.length-1,1),t=K.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==o?void 0:o.tickAnchor,O=null==n?void 0:n.tickAnchor,C=Ro(K),j=Ro(Q);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||q)&&r&&!s&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!G||q)&&s&&e("path",{d:Wo("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),K.map((n,o)=>{const i=!!l&&("function"==typeof l?l(n.value,o):Gt(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":Io(S,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||q)&&i&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!G||q)&&a&&e("path",{d:Wo("left",u,d),fill:"none",stroke:h,strokeWidth:1}),Q.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):Gt(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:Ho(O,n.pixel===j.min,n.pixel===j.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-f.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===Z.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,a=n.tickAnchor,s=Ro(Z);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),Z.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):Gt(n.value,o>0?Z[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:Ho(a,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+f.right-15,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+f.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),ne,N&&p&&B&&D&&t(n,{children:[N.top&&e("g",{transform:"translate(0, 0)",children:e(In,{orient:"top",config:En(N.top),values:B,scale:p.x,size:f.top,length:u})}),N.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(In,{orient:"bottom",config:En(N.bottom),values:B,scale:p.x,size:f.bottom,length:u})}),N.left&&e("g",{transform:"translate(0, 0)",children:e(In,{orient:"left",config:En(N.left),values:D,scale:p.y,size:f.left,length:d})}),N.right&&e("g",{transform:`translate(${u}, 0)`,children:e(In,{orient:"right",config:En(N.right),values:D,scale:p.y,size:f.right,length:d})})]}),$,oe&&oe.sourceId!==V&&(null==p?void 0:p.x)&&(()=>{const t=p.x(oe.xValue);if(null==t||0>t||t>u)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof O?O:null}),Dn({legend:C,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:O,legendLayout:T,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:P,legendIsolatedCategories:_})]}):null}function Xo(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Vo(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const Uo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Ko(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:a}=e,s=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(s){const e=Uo(i,r),t=Uo(i,a);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${a-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Uo(i,r),t=Uo(i,a),n=Uo(o,a),l=Uo(o,r),c=a-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return Ko(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=s?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=a-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return Ko(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=a-(f?c:0),m=r+(g?u:0),v=a-(f?u:0),b=Uo(i,p),x=Uo(i,y),k=(i-l)*Math.cos(c),w=Uo(k,r),A=Uo(k,a),S=s?null:Uo(o,v),O=s?null:Uo(o,m),C=s?0:(o+l)*Math.cos(u),j=s?null:Uo(C,r),M=s?null:Uo(C,a),P=y-p>Math.PI?1:0,_=s?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${w.x},${w.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=Uo(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${P} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Uo(i,a);L+=` A${i},${i} 0 ${P} 1 ${e.x},${e.y}`}if(s)L+=" L0,0";else{if(f)L+=` L${M.x},${M.y}`,L+=` A${l},${l} 0 0 1 ${S.x},${S.y}`;else{const e=Uo(o,a);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${_} 0 ${O.x},${O.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Uo(o,r);L+=` A${o},${o} 0 ${_} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Qo(e){const t=Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const Zo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Jo(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function ei(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const ti="undefined"==typeof window||"undefined"==typeof document,ni="undefined"!=typeof window?h:a;function oi(){const[e,t]=d(!1);return ni(()=>{t(!0)},[]),e}const ii=()=>()=>{},ri=()=>!1,ai=()=>!0;function si(){const e=c(ii,ri,ai);return i(e).current}function li(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:s,cleanup:l}=e;ni(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,s.current()},[t,n]);const c=i(l);c.current=l,a(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function ci(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return di(e,t);if(!hi(e)||!hi(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(!di(n,i))return!1}else{if(!hi(n)||!hi(i))return!1;if(!ui(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function ui(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 di(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 hi(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 gi=o.createContext(null);function fi({children:t}){const[n,i]=o.useState(!1),r=o.useMemo(()=>({visible:n,setVisible:i}),[n]);return e(gi.Provider,{value:r,children:t})}function pi(){return o.useContext(gi)}const yi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function mi(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=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 a)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}function vi(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const bi=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function xi(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const ki="semiotic-accessible-data-table",wi=ki+" semiotic-accessible-data-table-hidden",Ai=ki+" semiotic-accessible-data-table-visible",Si=Ai+" semiotic-accessible-data-table-network",Oi={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ci={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ji={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Mi={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Pi={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},_i={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Li={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"},Ti={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function $i({scene:n,chartType:i,tableId:r,chartTitle:a}){var s;const[l,c]=o.useState(!1),[u,d]=o.useState(5),h=pi(),g=null!==(s=null==h?void 0:h.visible)&&void 0!==s&&s,f=l||g,p=o.useRef(null),y=a?"Data summary for "+a:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{f||d(5)},[f]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(l||g||c(!0))},[l,g]),v=o.useCallback(e=>{var t;g||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[g]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:yi}):null;if(!f)return e("div",{id:r,className:wi,tabIndex:-1,onFocus:m,style:yi,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,a,s,l,c,u,d,h,g,f,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:xi(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:xi(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",a=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=a?a:""}});break}case"heatcell":{const e=xi(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==a?a:null===(s=x.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:xi(x.datum)});break;case"arc":v.push({label:"Arc",values:xi(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:xi(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(g=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==g?g:null===(f=x.datum)||void 0===f?void 0:f.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(n),x=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}(b),k=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${bi(e.min)} to ${bi(e.max)}, mean ${bi(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(" ")}(b.length,x),w=Math.min(u,b.length),A=b.slice(0,w),S=b.length-w,O=new Set;for(const e of A)for(const t of Object.keys(e.values))O.add(t);const C=Array.from(O);return t("div",{ref:p,id:r,className:Ai,tabIndex:-1,onBlur:v,style:Oi,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{g&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:ji,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ci,children:k}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Mi,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Li,children:S>0?`First ${w} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:Pi,children:"type"}),C.map(t=>e("th",{style:Pi,children:t},t))]})}),e("tbody",{children:A.map((n,o)=>t("tr",{children:[e("td",{style:_i,children:n.label}),C.map(t=>{return e("td",{style:_i,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":bi(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),S>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>d(e=>e+25),style:Ti,children:["Show ",Math.min(25,S)," more"," ",1===S?"row":"rows"," (",S," remaining)"]})]})}function Ni({nodes:n,edges:i,chartType:r,tableId:a,chartTitle:s}){var l,c,u,d,h,g,f,p,y,m,v,b,x,k;const[w,A]=o.useState(!1),[S,O]=o.useState(5),C=pi(),j=null!==(l=null==C?void 0:C.visible)&&void 0!==l&&l,M=w||j,P=s?"Data summary for "+s:a?`Data summary for ${r} ${a}`:"Data summary for "+r,_=o.useRef(null);o.useEffect(()=>{M||O(5)},[M]);const L=o.useCallback(e=>{e.target===e.currentTarget&&(w||j||A(!0))},[w,j]),T=o.useCallback(e=>{var t;j||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[j]);if(!n||0===n.length)return a?e("span",{id:a,tabIndex:-1,style:yi}):null;if(!M)return e("div",{id:a,className:wi,tabIndex:-1,onFocus:L,style:yi,role:"region","aria-label":P,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",i.length," edges)"]})});const $=Array.isArray(n)?n:[],N=Array.isArray(i)?i:[],B=new Map,D=new Map,E=new Map,I=new Map;for(const e of N){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,n="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,o="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";D.set(e,(null!==(h=D.get(e))&&void 0!==h?h:0)+1),I.set(e,(null!==(g=I.get(e))&&void 0!==g?g:0)+i)}if(null!=o&&""!==o){const e=o+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),E.set(e,(null!==(p=E.get(e))&&void 0!==p?p:0)+i)}}const H=[];for(let e=0;$.length>e;e++){const t=$[e];if(!t||"object"!=typeof t)continue;const n=null!==(m=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==m?m:t.id,o=null!=n?n+"":"node-"+e,i=null!==(v=B.get(o))&&void 0!==v?v:0,r=null!==(b=D.get(o))&&void 0!==b?b:0,a=null!==(x=E.get(o))&&void 0!==x?x:0,s=null!==(k=I.get(o))&&void 0!==k?k:0;H.push({id:o,degree:i+r,inDeg:i,outDeg:r,wDegree:a+s,wInDeg:a,wOutDeg:s})}H.sort((e,t)=>t.degree-e.degree);let R=0,F=0;if(H.length>0){let e=0;for(const t of H)e+=t.degree,t.degree>F&&(F=t.degree);R=e/H.length}const W=N.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),z=[`${H.length} nodes, ${N.length} edges.`];H.length>0&&z.push(`Mean degree: ${bi(R)}, max degree: ${F}.`);const Y=Math.min(S,H.length),G=H.slice(0,Y),q=H.length-Y;return t("div",{ref:_,id:a,className:Si,tabIndex:-1,onBlur:T,style:Oi,role:"region","aria-label":P,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{j&&C&&C.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:ji,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ci,children:z.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:Mi,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Li,children:q>0?`Top ${Y} of ${H.length} nodes by degree`:`All ${H.length} nodes by degree`}),e("thead",{children:t("tr",{children:[e("th",{style:Pi,children:"id"}),e("th",{style:Pi,children:"degree"}),e("th",{style:Pi,children:"in"}),e("th",{style:Pi,children:"out"}),W&&e("th",{style:Pi,children:"w. degree"}),W&&e("th",{style:Pi,children:"w. in"}),W&&e("th",{style:Pi,children:"w. out"})]})}),e("tbody",{children:G.map((n,o)=>t("tr",{children:[e("td",{style:_i,children:n.id}),e("td",{style:_i,children:n.degree}),e("td",{style:_i,children:n.inDeg}),e("td",{style:_i,children:n.outDeg}),W&&e("td",{style:_i,children:bi(n.wDegree)}),W&&e("td",{style:_i,children:bi(n.wInDeg)}),W&&e("td",{style:_i,children:bi(n.wOutDeg)})]},o))})]}),q>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>O(e=>e+25),style:Ti,children:["Show ",Math.min(25,q)," more"," ",1===q?"node":"nodes"," (",q," remaining)"]})]})}function Bi({summary:t}){return t?e("div",{role:"note",style:yi,children:t}):null}function Di({tableId:t}){return e("a",{href:"#"+t,style:yi,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,yi)},children:"Skip to data table"})}function Ei({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:yi,children:n})}const Ii="var(--semiotic-focus, #005fcc)";function Hi({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ii,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ii,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ii,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Ri(e){return Array.isArray(e)?e[0]:e}function Fi(e,t,n,o){return Object.assign({data:Ri(e),x:t,y:n,__semioticHoverData:!0},o)}const Wi={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 zi(e,t){return"function"==typeof t?t(e):e[t]}function Yi(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 Gi(n={}){const{fields:o,title:i,format:r,style:a={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=zi(n,i);l=Yi(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=zi(n,o);c.push({label:t,value:Yi(a,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Yi(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Yi(n[e[0]],r))}}const u=Object.assign(Object.assign({},Wi),a);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function qi(n={}){const{fields:o=[],title:i,format:r,style:a={},className:s="",showLabels:l=!0,separator:c=": "}=n;return n=>{if(!n||"object"!=typeof n)return null;const u=[];if(i){const e=zi(n,i);u.push({value:Yi(e,r)})}o&&Array.isArray(o)&&o.length>0?o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Yi(zi(n,o),i);u.push({label:l?t:void 0,value:a})}):Object.keys(n).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{u.push({label:l?e:void 0,value:Yi(n[e],r)})});const d=Object.assign(Object.assign({},Wi),a);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:d,children:u.map((e,n)=>t("div",{style:{marginBottom:u.length-1>n?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},n))}):null}}function Xi(){return n=>{var o,i,r,a,s,l,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:Wi,children:e("div",{children:Yi(t)})})}const d=null!==(l=null!==(a=n.xValue)&&void 0!==a?a:null===(s=n.data)||void 0===s?void 0:s.time)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:Wi,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Yi(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Yi(n.value)})]},o))]})}}function Vi(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=Ri(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:Wi,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Gi(t):Gi())}}function Ui({x:t,y:n,containerWidth:i,containerHeight:r,margin:a,children:s,className:l="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(s),y=p?null:Wi;return u?e("div",{ref:d,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:a.left+t,top:a.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}function Ki(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}function Qi(e,t,n){const o=i(null),[r,s]=d(null);return a(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const Zi="undefined"==typeof window?a:h;function Ji(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function er(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return a(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ki(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[s,c]=Qi(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,g=c[1]-u.top-u.bottom,f=Ji(e.foregroundGraphics,c,u),p=Ji(e.backgroundGraphics,c,u),y=Pe(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);a(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),C=i(0),j=l(()=>{C.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),M=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),P=l(()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),S.current()},[]);a(()=>()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const _=e.themeDirtyRef;return Zi(()=>{_&&(Kt++,_.current=!0,w())},[y,w,_]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:s,size:c,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:M,onPointerLeave:P}}function tr(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===a||(e.width=r,e.height=a),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function nr(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function or(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 ir(e,t,n,o,i,r){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let r=i;l>o&&(r*=o/l),l>s-o&&(r*=(s-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 rr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=s.style.stroke||"#007bff",u=tn(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,g=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const m=null!==(i=s.style.opacity)&&void 0!==i?i:1;ir(e,s.path,u,d,m,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=on(s.curve),p=h&&h.length>0&&g&&g.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!p){e.strokeStyle=u;const v=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),S=!0}function C(){S&&(e.stroke(),S=!1)}for(let j=0;s.path.length>j;j++){const[M,P]=s.path[j],_=g[j],L=or(_,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,P);else{const T=[];for(const $ of h){const N=$.value;(w>N||N>_)&&(N>w||_>N)||w===N||_===N||T.push({t:(N-w)/(_-w)})}T.sort((e,t)=>e.t-t.t);for(const B of T){const E=x+(M-x)*B.t,I=k+(P-k)*B.t,H=or(w+(_-w)*Math.min(B.t+1e-4,1),h,u);e.lineTo(E,I),C(),O(H,E,I)}e.lineTo(M,P)}x=M,k=P,w=_,A=L}else O(L,M,P),x=M,k=P,w=_,A=L}C()}else{e.beginPath();const R=s.strokeGradient&&s.path.length>=2?sn(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=R||u,f)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[F,W]=s.path[0];e.moveTo(F,W);for(let z=1;s.path.length>z;z++)e.lineTo(s.path[z][0],s.path[z][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=rn(e,s.style.fill,s.style.fill),f&&!p)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[G,q]=s.path[0];e.moveTo(G,q);for(let X=1;s.path.length>X;X++)e.lineTo(s.path[X][0],s.path[X][1])}const Y=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ar(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function sr(e,t,n=.3){ar(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 lr(e,t,n=.6){var o,i,r,a,s;if(!ar(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!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s: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 cr(e,t,n,o=.35){ar(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function ur(e,t){const n=on(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=E().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 dr=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"area"===e.type);for(const t of s){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 s=t._introClipFraction;void 0!==s&&1>s&&(e.save(),e.beginPath(),e.rect(0,0,o.width*s,o.height),e.clip());const l=rn(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(ur(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=an(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,n,0,o);e.fillStyle=i||l,e.globalAlpha=u}else{const n=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=n*u,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(ur(e,t),cr(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?sn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=on(t.curve);if(e.beginPath(),o)D().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!==s&&1>s&&e.restore(),n&&e.restore(),e.globalAlpha=1}},hr=(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=rn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=rn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),lr(e,t),e.globalAlpha=1}}finally{e.restore()}}};function gr(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:a,tr:s,br:l,bl:c}=Vo(t);e.beginPath(),e.moveTo(n+a,o),e.lineTo(n+i-s,o),s>0&&e.arcTo(n+i,o,n+i,o+s,s),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+a),a>0&&e.arcTo(n,o,n+a,o,a),e.closePath()}function fr(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 pr=(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)yr(e,t);else if(t.cornerRadii&&Xo(t.cornerRadii)){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=fr(t),i=t.fillGradient&&"string"==typeof n?an(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,gr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=fr(t),i=t.fillGradient&&"string"==typeof n?an(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:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+r,s),e.arcTo(a,s,a,s+r,r),e.lineTo(a,s+c-r),e.arcTo(a,s+c,a+r,s+c,r),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a+r,s+c),e.arcTo(a,s+c,a,s+c-r,r);break;default:e.moveTo(a,s+c),e.lineTo(a,s+r),e.arcTo(a,s,a+r,s,r),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=fr(t),i=t.fillGradient&&"string"==typeof n?an(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=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}sr(e,t),e.globalAlpha=1}};function yr(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,a=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,a,o,i,i)}else{const r=i+o,a=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,a,i,i)}e.restore()}function mr(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 vr(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const br=(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=tn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),sr(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):vr(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=mr(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},xr=(e,t,n,o)=>{var i,r,a;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const s=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(a=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==a?a:1);1!==s&&(e.globalAlpha=s);const l=tn(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=tn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function kr(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}function wr(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 Ar(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}function Sr(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const a=Object.assign({},n);return o&&(a[e.key]=e.fn(n)),r&&(a[t.key]=t.fn(n)),a});return i?r:o}}const Or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Cr(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`${Or[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Or[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const jr={line:[dr,rr,hr],area:[dr,hr],stackedarea:[dr,hr],scatter:[hr],bubble:[hr],heatmap:[br],bar:[pr],swarm:[hr],waterfall:[(e,t,n,o)=>{var i;pr(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const a=r[0].datum,s=null==a?void 0:a._connectorStroke;if(s){e.save(),e.strokeStyle=tn(e,s)||s,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],a=o.datum,s=i.datum;if(null==(null==a?void 0:a.cumEnd)||null==(null==s?void 0:s.baseline))continue;const l=n.y(a.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[xr],mixed:[dr,rr,hr],custom:[dr,pr,br,rr,hr,xr]},Mr={top:20,right:20,bottom:30,left:40},Pr={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 _r(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 Lr={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 Tr({hover:n}){var o,i,r;const a=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=n.data)&&void 0!==o?o:{},l=null!==(i=s.y)&&void 0!==i?i:s.value,c=null!==(r=s.x)&&void 0!==r?r:s.time;return t("div",{className:"semiotic-tooltip",style:Lr,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:a(l)}),e("div",{style:{opacity:.7,fontSize:11},children:a(c)})]})}Tr.ownsChrome=!0;const $r=g(function(n,s){var c,u,h,g,y,m,v,b,x,k,w,A,S;const{chartType:O,runtimeMode:C,data:j,chunkThreshold:M,chunkSize:P,xAccessor:_,yAccessor:L,colorAccessor:T,sizeAccessor:$,groupAccessor:N,lineDataAccessor:B,curve:D,normalize:E,baseline:I,stackOrder:H,binSize:R,valueAccessor:F,arrowOfTime:W="right",windowMode:z="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:K,size:Q=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:ne,lineStyle:oe,pointStyle:ie,areaStyle:re,barStyle:ae,waterfallStyle:se,swarmStyle:le,barColors:ce,colorScheme:ue,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:ye,lineGradient:be,areaGroups:xe,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,showAxes:je=!0,axes:Me,xLabel:Pe,yLabel:_e,yLabelRight:Le,xFormat:Te,yFormat:$e,axisExtent:Ne,tickFormatTime:Be,tickFormatValue:De,hoverAnnotation:Ee,tooltipContent:Ie,customHoverBehavior:He,customClickBehavior:Re,enableHover:Fe,hoverRadius:We=30,tooltipMode:ze,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,showGrid:Xe,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,legendCategoryAccessor:tt,onCategoriesChange:nt,backgroundGraphics:ot,foregroundGraphics:it,canvasPreRenderers:rt,svgPreRenderers:at,title:st,categoryAccessor:lt,brush:ct,onBrush:ut,decay:dt,pulse:ht,transition:gt,animate:ft,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,marginalGraphics:kt,pointIdAccessor:wt,xScaleType:At,yScaleType:St,accessibleTable:Ot=!0,description:Ct,summary:jt,linkedCrosshairName:Mt,linkedCrosshairSourceId:Pt,customLayout:_t,layoutConfig:Lt}=n,$t=f().replace(/:/g,""),Nt=i(!1),Bt=er({sizeProp:Q,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:Mr,animate:ft,transitionProp:gt,themeDirtyRef:Nt}),Dt=oi(),Et=si(),{reducedMotionRef:It,responsiveRef:Ht,size:Wt,currentTheme:zt,transition:Yt,introEnabled:Gt,tableId:qt,rafRef:Xt,renderFnRef:Vt,scheduleRender:Ut}=Bt;let Kt=Bt.margin;if(kt){const e=60,t=Object.assign({},Bt.margin);kt.top&&e>t.top&&(t.top=e),kt.bottom&&e>t.bottom&&(t.bottom=e),kt.left&&e>t.left&&(t.left=e),kt.right&&e>t.right&&(t.right=e),Kt=t}const Qt="function"==typeof it?it({size:Wt,margin:Kt}):it,Zt="function"==typeof ot?ot({size:Wt,margin:Kt}):ot,Jt=Wt[0]-Kt.left-Kt.right,en=Wt[1]-Kt.top-Kt.bottom,nn=r(()=>me(j),[j]),on=null!=Ee?Ee:Fe,rn=i(null),an=i(null),[sn,ln]=d(0),[hn,gn]=d(null),fn=i(null),pn=i(null),[yn,mn]=d(null),vn=i(Pr.primary),An=i([]),Sn=i(tt),jn=i(nt);Sn.current=tt,jn.current=nt;const[Mn,Pn]=d(!1),[_n,Ln]=d([]),[Tn,$n]=d([]),Nn="streaming"===C||["bar","swarm","waterfall"].includes(O),Bn=r(()=>{var e,t,n;return{chartType:O,runtimeMode:Nn?"streaming":"bounded",windowSize:Y,windowMode:z,arrowOfTime:Nn?W:"right",extentPadding:V,scalePadding:U,axisExtent:Ne,xAccessor:_,yAccessor:L,timeAccessor:Nn?G:void 0,valueAccessor:F,colorAccessor:T,sizeAccessor:$,groupAccessor:N||(B?"_lineGroup":void 0),categoryAccessor:lt,lineDataAccessor:B,xScaleType:At,yScaleType:St,xExtent:q,yExtent:X,sizeRange:K,binSize:R,normalize:E,baseline:I,stackOrder:H,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:!0===ye?{topOpacity:.8,bottomOpacity:.05}:!1===ye?void 0:ye,areaGroups:xe?new Set(xe):void 0,lineGradient:be,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,lineStyle:oe,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:se,colorScheme:ue,barColors:ce,barStyle:ae,annotations:Ye,decay:dt,pulse:ht,transition:Yt,introAnimation:Gt,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,pointIdAccessor:wt,curve:D,themeCategorical:null===(e=null==zt?void 0:zt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(zt),themeSequential:null===(t=null==zt?void 0:zt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==zt?void 0:zt.colors)||void 0===n?void 0:n.diverging,customLayout:_t,layoutConfig:Lt,layoutMargin:Kt}},[O,Y,z,W,V,U,Ne,_,L,G,F,At,St,T,$,N,lt,B,q,X,K,R,E,I,H,de,he,ge,fe,ye,be,xe,we,Ae,Se,Oe,Ce,oe,ie,re,le,se,ae,ue,ce,Ye,dt,ht,null==Yt?void 0:Yt.duration,null==Yt?void 0:Yt.easing,Gt,pt,yt,mt,vt,bt,xt,Nn,wt,D,zt,_t,Lt,Kt]),Dn=ci(Bn),En=i(null);En.current||(En.current=new Rt(Dn));const In=l(()=>{var e,t;const n=Sn.current,o=jn.current;if(!o||!n)return;const i=kr(null!==(t=null===(e=En.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);wr(i,An.current)||(An.current=i,o(i))},[]);a(()=>{var e;null===(e=En.current)||void 0===e||e.updateConfig(Dn),Nt.current=!0,Ut()},[Dn,Ut]);const Hn=i(null);Hn.current||(Hn.current=new ve(e=>{const t=En.current;t&&t.ingest(e)&&(Nt.current=!0,Ut())},{chunkThreshold:M,chunkSize:P})),a(()=>{var e;null===(e=Hn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:M,chunkSize:P})},[M,P]);const Rn=l(e=>{var t;null===(t=Hn.current)||void 0===t||t.push(e)},[]),Fn=l(e=>{var t;null===(t=Hn.current)||void 0===t||t.pushMany(e)},[]),Wn=l(()=>{var e,t;null===(e=Hn.current)||void 0===e||e.clear(),null===(t=En.current)||void 0===t||t.clear(),Nt.current=!0,Ut()},[Ut]);p(s,()=>({push:Rn,pushMany:Fn,remove:e=>{var t,n,o;null===(t=Hn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=En.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(fn.current&&i.some(e=>{var t;return e===(null===(t=fn.current)||void 0===t?void 0:t.data)})&&(fn.current=null,mn(null)),Nt.current=!0,Ut()),i},update:(e,t)=>{var n,o,i;null===(n=Hn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=En.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,Ut()),r},clear:Wn,getData:()=>{var e,t,n;return null===(e=Hn.current)||void 0===e||e.flush(),null!==(n=null===(t=En.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=En.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=En.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Rn,Fn,Wn,Ut]),a(()=>{var e,t;if(j){if(B&&nn.length>0&&"object"==typeof nn[0]&&null!==nn[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(nn[0][t])){const n=[];for(const e of nn){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=Hn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Hn.current)||void 0===t||t.setBoundedData(nn)}},[j,nn,B]);const{hoverHandlerRef:zn,hoverLeaveRef:Yn,onPointerMove:Gn,onPointerLeave:qn}=Bt;zn.current=e=>{var t,n,o,i;if(!on)return;const r=rn.current;if(!r)return;const a=r.getBoundingClientRect(),s=e.clientX-a.left-Kt.left,l=e.clientY-a.top-Kt.top;if(0>s||s>Jt||0>l||l>en)return void(fn.current&&(fn.current=null,pn.current=null,mn(null),He&&(He(null),Nt.current=!0),Ut()));const c=En.current;if(!c||0===c.scene.length)return;const u=un(c.scene,s,l,We,c.quadtree,c.maxPointRadius),d="multi"===ze,h=()=>{fn.current&&(fn.current=null,pn.current=null,mn(null),He&&He(null),Ut())};if(!u&&!d)return void h();const g=d||!u?s:u.x,f=d||!u?l:u.y,p=(null==u?void 0:u.datum)?Tt(u.datum,c.resolvedRibbons):{},y=null===(n=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,m="function"==typeof y?y(g):void 0;let v=Fi(p,g,f,null!=m?{xValue:m,xPx:g}:void 0);if(d&&c.scene.length>0&&c.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=dn(cn(e.path,e.curve),t,n);if(null===r)continue;const a=bn(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][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=cn(e.topPath,e.curve),a=cn(e.bottomPath,e.curve),s=dn(r,t,n);if(null===s)continue;const l=dn(a,t,n),c=bn(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:s,y0:null!=l?l: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}(c.scene,g,Math.max(We,Jt));if(e.length>0){const t=c.scales.y.invert,n=vn.current,o=y?y(g):g;if(u)v.xValue=o,v.xPx=g;else{const e={xValue:o};"string"==typeof _&&(e[_]=o),v=Fi(e,g,f,{xValue:o,xPx:g})}v.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===O&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Tt(e.datum,c.resolvedRibbons)}})}}u||(null===(o=v.allSeries)||void 0===o?void 0:o.length)?(fn.current=v,pn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,mn(v),He&&(He(v),Nt.current=!0),Ut()):h()},Yn.current=()=>{fn.current&&(fn.current=null,pn.current=null,mn(null),He&&(He(null),Nt.current=!0),Ut())};const Xn=i(()=>{});Xn.current=e=>{var t,n;if(!Re)return;const o=rn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-Kt.left,a=e.clientY-i.top-Kt.top;if(0>r||r>Jt||0>a||a>en)return void Re(null);const s=En.current;if(!s||0===s.scene.length)return void Re(null);const l=un(s.scene,r,a,We,s.quadtree,s.maxPointRadius);if(!l)return void Re(null);const c=l.datum||{},u=null===(n=null===(t=s.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(l.x):void 0;Re(Fi(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0))};const Vn=l(e=>Xn.current(e),[]),Un=i(-1),Kn=i(null),Qn=i(null),Zn=l(e=>{const t=En.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Qn.current&&Qn.current.version===n)o=Qn.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=xn(e),Qn.current={version:n,graph:o}}const i=Un.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Un.current=0;const n=o.flat[0];Kn.current={shape:n.shape,w:n.w,h:n.h};const i=On(Object.assign(Object.assign({},n),{datum:Tt(n.datum,t.resolvedRibbons)}));return fn.current=i,mn(i),He&&He(i),void Ut()}const r=kn(o,i),a=wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return Un.current=-1,Kn.current=null,fn.current=null,pn.current=null,mn(null),He&&He(null),void Ut();Un.current=a;const s=o.flat[a];Kn.current={shape:s.shape,w:s.w,h:s.h};const l=On(Object.assign(Object.assign({},s),{datum:Tt(s.datum,t.resolvedRibbons)}));fn.current=l,mn(l),He&&He(l),Ut()},[He,Ut]),Jn=l(e=>{Un.current=-1,Kn.current=null,Gn(e)},[Gn]);Vt.current=()=>{var e,t;Xt.current=0;const n=rn.current,o=an.current;if(!n||!o)return;const i=En.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(It.current?r+1e6:r),s=!It.current&&a,l=Nt.current||a;l&&!s&&(i.computeScene({width:Jt,height:en}),In());const c=nr(),u=function(e){if(!e)return Pr;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(),a=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return a||s||n||r?{axisStroke:l||Pr.axisStroke,tickText:a||Pr.tickText,crosshair:a?_r(a,"66"):Pr.crosshair,hoverFill:c?_r(c,"4D"):Pr.hoverFill,hoverStroke:a?_r(a,"99"):Pr.hoverStroke,pointRing:c||Pr.pointRing,primary:r||Pr.primary}:Pr}(n);vn.current=u.primary;const d=null!==(e=null==pt?void 0:pt.threshold)&&void 0!==e?e:5e3,h=pt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=tr(n,Wt,Kt,c);if(e){if(e.clearRect(-Kt.left,-Kt.top,Wt[0],Wt[1]),h&&(e.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==ne&&!ot){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=ne||(t&&"transparent"!==t?t:null),i=o?tn(e,o):null;i&&(e.fillStyle=i,e.fillRect(-Kt.left,-Kt.top,Wt[0],Wt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Jt,en),e.clip()),rt&&i.scales)for(const t of rt)e.save(),t(e,i.scene,i.scales,{width:Jt,height:en}),e.restore();const o=_t?jr.custom:jr[O];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:Jt,height:en});e.restore(),h&&(e.globalAlpha=1)}}{const e=tr(o,Wt,Kt,c);if(e&&(e.clearRect(-Kt.left,-Kt.top,Wt[0],Wt[1]),on&&fn.current&&i.scales&&function(e,t,n,o,i,r,a){var s;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||a.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=a.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||a.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)||a.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,fn.current,Jt,en,"object"==typeof on?on:{},pn.current,u),pn.current&&Array.isArray(Ee))){const t=Ee.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const a="group"in n?n.group:void 0;if(void 0!==a)for(const n of t){if("line"!==n.type)continue;if(n.group!==a)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,pn.current,t,u)}}l&&n&&n.setAttribute("aria-label",mi(i.scene,O+" chart"));const g=Nt.current;if(Nt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!hn||e(hn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(hn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(hn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(hn.y.domain()[1])!==e(i.scales.y.domain()[1])||hn.x.range()[0]!==i.scales.x.range()[0]||hn.x.range()[1]!==i.scales.x.range()[1]||hn.y.range()[0]!==i.scales.y.range()[0]||hn.y.range()[1]!==i.scales.y.range()[1])&&gn(i.scales),kt){const e=i.getData(),t="function"==typeof _?_:e=>e[_||"x"],n="function"==typeof L?L:e=>e[L||"y"];Ln(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),$n(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ye&&Ye.length>0&&ln(e=>e+1),(null==pt?void 0:pt.showBadge)&&Pn(!!h),(s||null!=i.activeTransition||i.hasActivePulses)&&(Xt.current=requestAnimationFrame(()=>Vt.current()))},li({hydrated:Dt,wasHydratingFromSSR:Et,storeRef:En,dirtyRef:Nt,renderFnRef:Vt,cleanup:()=>{var e;return null===(e=Hn.current)||void 0===e?void 0:e.clear()}}),a(()=>{Nt.current=!0,Ut()},[O,Jt,en,je,ne,oe,rt,Ut]),Cn(pt,En,Nt,Ut,Mn,Pn);const eo=r(()=>{if(Te||Be)return;const e=En.current;return(null==e?void 0:e.xIsDate)&&hn?Cr(hn.x.domain()):void 0},[Te,Be,hn]),to=Te||Be||eo,no=on&&yn?Ie?Ie(yn):e(Tr,{hover:yn}):null,oo=no?e(Ui,{x:yn.x,y:yn.y,containerWidth:Jt,containerHeight:en,margin:Kt,className:"stream-frame-tooltip",children:no}):null,io=Kn.current,ro=e(Hi,{active:Un.current>=0,hoverPoint:yn,margin:Kt,size:Wt,shape:null==io?void 0:io.shape,width:null==io?void 0:io.w,height:null==io?void 0:io.h}),ao=Ar(_,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),so=Ar(L,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),lo=ao.key,co=so.key,uo=Sr(ao,so,Ye&&Ye.length>0||!1);if(ti||!Dt&&Et){const n=En.current;n&&j&&(n.ingest({inserts:nn,bounded:!0}),n.computeScene({width:Jt,height:en}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,a=to||(()=>{if((null==n?void 0:n.xIsDate)&&r)return Cr(r.x.domain())})();return t("div",{ref:Ht,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":Ct||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:Z?"100%":Wt[0],height:J?"100%":Wt[1]},children:[e(Bi,{summary:jt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Wt[0],height:Wt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Kt.left},${Kt.top})`,children:Zt}),t("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[ne&&e("rect",{x:0,y:0,width:Jt,height:en,fill:ne}),at&&r&&at.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:Jt,height:en})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,a,s,l,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:Jo(c.style.fill),fillOpacity:null!==(a=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:Jo(c.style.fill),fillOpacity:null!==(l=null!==(s=c.style.fillOpacity)&&void 0!==s?s:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Jo(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:Jo(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,a,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]}(i.fill),l=.299*r+.587*a+.114*s>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),a=Math.max(Math.abs(i.openY-i.closeY),1),s=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:a,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,$t)).filter(Boolean)]})]}),e(qo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Kt,scales:r,showAxes:je,axes:Me,xLabel:Pe,yLabel:_e,yLabelRight:Le,xFormat:a,yFormat:$e||De,axisExtent:Ne,showGrid:Xe,title:st,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:Ft(Qt,null===(h=En.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:kt,xValues:[],yValues:[],annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,annotationFrame:0,xAccessor:lo,yAccessor:co,annotationData:uo(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:Pt})]})}return t("div",{ref:Ht,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":Ct||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":Wt[0],height:J?"100%":Wt[1],overflow:"visible"},onKeyDown:Zn,children:[Ot&&e(Di,{tableId:qt}),Ot&&e($i,{scene:null!==(y=null===(g=En.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:qt,chartTitle:"string"==typeof st?st:void 0}),e(Bi,{summary:jt}),e(Ei,{hoverPoint:yn}),t("div",{role:"img","aria-label":Ct||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:on?Jn:void 0,onMouseLeave:on?qn:void 0,onClick:Re?Vn:void 0,children:[Zt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Wt[0],height:Wt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Kt.left},${Kt.top})`,children:Zt})}),e(zo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Kt,scales:hn,showAxes:je,axes:Me,showGrid:Xe,xFormat:to,yFormat:$e||De,axisExtent:Ne}),e("canvas",{ref:rn,"aria-label":mi(null!==(v=null===(m=En.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:an,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(qo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Kt,scales:hn,showAxes:je,axes:Me,xLabel:Pe,yLabel:_e,yLabelRight:Le,xFormat:to,yFormat:$e||De,axisExtent:Ne,showGrid:Xe,title:st,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:Ft(Qt,null===(b=En.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:kt,xValues:_n,yValues:Tn,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,annotationFrame:sn,xAccessor:lo,yAccessor:co,annotationData:uo(null===(x=En.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=En.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==ne&&!ot,linkedCrosshairName:Mt,linkedCrosshairSourceId:Pt}),(ct||ut)&&e(pe,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Kt,dimension:null!==(w=null==ct?void 0:ct.dimension)&&void 0!==w?w:"xy",scales:hn,onBrush:null!=ut?ut:()=>{},binSize:R,snap:null==ct?void 0:ct.snap,binBoundaries:null!==(A=null==ct?void 0:ct.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=En.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==ct?void 0:ct.snapDuring,streaming:"streaming"===C}),(null==pt?void 0:pt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pt.badgePosition?{top:4,left:4}:"bottom-left"===pt.badgePosition?{bottom:4,left:4}:"bottom-right"===pt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Mn?"#dc3545":"#28a745",color:"white"}),children:Mn?"STALE":"LIVE"}),ro,oo]})]})});function Nr(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,a=[],s=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:s,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),a.push(v)}return a}function Br(e){var t,n,o;const i=e.length,r=e[0],a=e[i-1];return{n:i,min:r,q1:null!==(t=W(e,.25))&&void 0!==t?t:r,median:null!==(n=W(e,.5))&&void 0!==n?n:(r+a)/2,q3:null!==(o=W(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}function Dr(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function Er(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}$r.displayName="StreamXYFrame";const Ir={bar:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=s.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(a))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(a)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const a=t.get(r);if(!a)continue;let s=a.total;y&&n>0&&(s/=n);const l=u(a.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(f){const t=d(0>s?i:o+s),n=0>s?d(i+s)-d(i):d(o)-d(o+s);g.push(Ee(e.x,t,e.width,Math.abs(n),l,h,r)),0>s?i+=s:o+=s}else if(p){const t=d(0>s?i+s:o),n=0>s?d(i)-d(i+s):d(o+s)-d(o);g.push(Ee(t,e.x,Math.abs(n),e.width,l,h,r)),0>s?i+=s:o+=s}}}const v="vertical"===h,b=s.roundedTop&&s.roundedTop>0?Math.max(0,s.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",s.gradientFill&&(e.fillGradient=s.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let a=0;h.length>a;a++){const c=i.get(h[a])||[];for(const i of c){const c=r(i),g=s(i,h[a]);if(d){const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ee(r,Math.min(s,d),o,Math.abs(s-d),g,i,h[a]))}else{const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ee(Math.min(s,d),r,Math.abs(d-s),o,g,i,h[a]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:Nr,donut:Nr,boxplot:function(e,t){var n,o,i,r,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(n=W(l,.25))&&void 0!==n?n:c,v=null!==(o=W(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=W(l,.75))&&void 0!==i?i:u,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(a=[...l].reverse().find(e=>w>=e))&&void 0!==a?a:u,O=h(t.pieceData[0],t.name),C=[];if(m)for(const e of t.pieceData){const n=d(e);if(k>n||n>w){const o=y?t.middle:g(n),i=y?g(n):t.middle;C.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:C}),m)for(const t of C)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],a=t[t.length-1],s=(a-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const n=u(r+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(r+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(r+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(r+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=W(t,.25))&&void 0!==n?n:r,l=null!==(o=W(t,.5))&&void 0!==o?o:(r+a)/2,c=null!==(i=W(t,.75))&&void 0!==i?i:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(r)),width:e.width,height:Math.abs(u(a)-u(r))}:{x:Math.min(u(r),u(a)),y:e.x,width:Math.abs(u(a)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Br(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/p)*e.width*.9,a=l(n+t*i),s=l(n+(t+1)*i);c.push(Ee(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Br(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,s]=n,u=r(t,e.name);if(c){const n=a(Math.min(o,s)),i=a(Math.max(o,s));l.push(Ee(n,e.x,i-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),i=a(Math.min(o,s));l.push(Ee(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,a,s,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return f;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const i=e.groups.get(v[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const S=new Map;for(const e of v){const t=w[0].groups.get(e);S.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,C=x?.95*p:.9*t.width,j=k().domain([0,A]).range([0,C]),M=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let P=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,u=0===t,d=o.width,h=.55*d,m=o.x+(d-h)/2,b=new Map;if(x){let e=0;for(const t of v){const o=n.groups.get(t);o&&(e+=j(o.total))}let t=p,i=p;for(let r=0;v.length>r;r++){const s=v[r],l=n.groups.get(s);if(!l)continue;const c=j(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const k=g(l.pieces[0],s),w=null!==(a=S.get(s))&&void 0!==a?a:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:s});y&&(0===r&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=m,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=m,O.__funnelBarW=c),f.push(Ee(x,m,c,h,k,O,s)),b.set(s,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=j(e),a=p-t/2,s=v[0],l="_default"!==s,c=null!==(r=null===(i=n.groups.get(s))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?s:o.name,x=g(c,d),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?s:o.name});y&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=m,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=m,w.__funnelBarW=t),f.push(Ee(a,m,t,h,x,w,d)),b.set(s,{x:a,y:m,w:t,h:h})}if(t>0&&P.size>0){const t=x?v:[v[0]];for(const i of t){const t=P.get(i),r=b.get(i);if(!t||!r)continue;const a=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:a.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(u)}}P=b}return f},"bar-funnel":function(e,t){var n,o,i,r;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=s(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),C=v(0)-O,j=c(f.pieces[0],p?h:n.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ee(S,O,u,C,j,M,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ee(S,e,u,t,o,i,p?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),a=Math.min(o,r),s=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?Ee(a,n.x,s,n.width,o,null,"__track__"):Ee(n.x,a,n.width,s,o,null,"__track__");u.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=a?a(n):e.name,c=s(n,i);let f;if(d){const r=l(t),a=l(t+o);f=Ee(r,e.x,a-r,e.width,c,n,i)}else{const r=l(t+o),a=l(t);f=Ee(e.x,r,e.width,a-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=o}if(p>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return u}};class Hr{constructor(e){this.rExtent=new Le,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new _e(e.windowSize),this.getO=We(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=Re(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=We(e.stackBy),this.getGroup=We(e.groupBy),this.getColor=We(e.colorAccessor),this.getConnector=We(e.connectorAccessor),this.getDataId=We(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new _e(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,r),s="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=S().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=k().domain(a).range([o,n])}else s?(u=S().domain(r).range([0,e.height]).padding(c),d=k().domain(a).range([0,e.width])):(u=S().domain(r).range([0,e.width]).padding(c),d=k().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const a=this.rExtents[i];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?k().domain([l,c]).range([0,e.width]):k().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),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.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Ir[this.config.chartType];let a=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:a,getO:s}=e;if(!a||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=a(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:s(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const a=i[r],s=i[r+1],c="function"==typeof h?h(a.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:a.x,y1:a.y,x2:s.x,y2:s.y,style:c,datum:a.datum,group:t})}}return l}(i,a);a=[...e,...a]}return a}buildLayoutContext(e,t){var n,o,i;const r=this.config,a=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},s=Dr(r.colorScheme,r.themeCategorical,ft),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:a,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...s]},resolveColor:Er(s),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?xt(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const a=e[r],s=n?t(a):a[o];let l=i.get(s);l||(l=[],i.set(s,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,Hr.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,i),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(a>n){const e=1-n/a;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;a>i&&(n._pulseIntensity=1-i/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,a=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,s="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,s?{x:t.x,y:a,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:a,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),a=wt(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=St(i,e._targetOpacity,a)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=St(o.x,e._targetX,a),e.y=St(o.y,e._targetY,a)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=St(o.r,e._targetR,a))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=St(i,e._targetOpacity,a)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=St(n.x,e._targetX,a),e.y=St(n.y,e._targetY,a),void 0!==n.w&&(e.w=St(n.w,e._targetW,a),e.h=St(n.h,e._targetH,a))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(o,e._targetOpacity,a)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=St(n.startAngle,e._targetStartAngle,a),e.endAngle=St(n.endAngle,e._targetEndAngle,a))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!He(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!He(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!He(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(He(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=We(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!He(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=Re(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!He(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?We(this.config.stackBy):void 0),"groupBy"in e&&!He(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?We(this.config.groupBy):void 0),"colorAccessor"in e&&!He(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!He(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?We(this.config.connectorAccessor):void 0)}}function Rr(e,t,n){const o=Wt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Fr(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Wr(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const a=qt(Math.atan2(i,o)),s=qt(e.startAngle),l=qt(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function zr(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Yr(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:a}=e.bounds;return o>t||t>o+r||i>n||n>i+a?null:{datum:e.datum,x:o+r/2,y:i+a/2,distance:0,category:e.category,stats:e.stats}}function Gr(o){const{width:i,height:a,totalWidth:s,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==u?void 0:u.projection),m="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||y?[]:(f||Eo(u.r,5,p)).map(e=>({value:e,pixel:u.r(e),label:(g||qr)(e)})),[u,g,y,f,p]),b=h&&u&&!y,x=d&&u&&!y;return b||x?e("svg",{width:s,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,n)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&e(n,{children:t(n,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function qr(e){return Math.round(100*e)/100+""}function Xr(o){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C,legendPosition:j="right",legendLayout:M,foregroundGraphics:P,annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:T,xAccessor:$,yAccessor:N,annotationData:B,underlayRendered:D,children:E}=o,I="radial"===(null==g?void 0:g.projection),H="horizontal"===(null==g?void 0:g.projection),R=!1!==p,F=r(()=>f&&R&&g&&!I?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,R,g,v,I]),W=o.rTickValues,z=o.tickLabelEdgeAlign,Y=o.axisExtent,G=r(()=>f&&g&&!I?(W||Eo(g.r,5,Y)).map(e=>({value:e,pixel:g.r(e),label:(b||qr)(e)})):[],[f,g,b,I,W,Y]),q=i(new Map),X=i(null!==(a=null==_?void 0:_.length)&&void 0!==a?a:0),V=null!==(s=null==_?void 0:_.length)&&void 0!==s?s:0;X.current!==V&&(X.current=V,q.current=new Map);const U=r(()=>{if(!_||0===_.length)return null;const e=so(),t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:N,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:q.current};return ao(L?Co(Object.assign({annotations:_,context:o},"object"==typeof L?L:{})):_,e,T,o)},[_,L,T,l,c,g,$,N,B]);return f||k||w||P||U&&U.length>0||x||E?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!I&&!D&&e("g",{className:"ordinal-grid",children:G.map((t,n)=>e("line",{x1:H?t.pixel:0,y1:H?0:t.pixel,x2:H?t.pixel:l,y2:H?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!I&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(n,H?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((n,i)=>{const r=z?0===i?"start":i===G.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,n=0>t||t>c?c:t;return e("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,i)=>t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),U,P,E]}),k&&e("text",{x:u/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof k?k:null}),Dn({legend:w,totalWidth:u,totalHeight:d,margin:h,legendPosition:j,title:k,legendLayout:M,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C})]}):null}function Vr({width:t,height:n,totalWidth:o,totalHeight:r,margin:s,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,a(()=>{if(!u.current)return;const e=y(u.current).select(".brush-g"),o=b?m():v();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[t,n,b]),a(()=>{if(!l||!d.current||!p.current)return;if(!u.current)return;const e=p.current,t=y(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1)},[l,b]),e("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}function Ur(e,t){var n,o,i,r;const a=t._gradientBand.colors;if(0===a.length)return;const{clipPath:s,slices:l}=Qo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:a}),c=new Path2D(s);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=tn(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Kr(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Qr(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=H().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}Hr.QUADTREE_THRESHOLD=500;const Zr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"wedge"===e.type);for(const t of a){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)Ur(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Kr(e,t),cr(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=Ko({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Qr(e,t)):(Kr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Kr(e,t),cr(e,t)),e.globalAlpha=1}}},Jr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=tn(e,"var(--semiotic-primary, #007bff)"),s=tn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?tn(e,l)||l:null!=l?l:a,u=t.style.stroke,d="string"==typeof u?tn(e,u)||u:s,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},ea=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},ta=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=tn(e,n.style.stroke)||("string"==typeof n.style.fill?tn(e,n.style.fill):n.style.fill)||tn(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},na=(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function oa(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ia(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let ra=null;function aa(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(ra||(ra=document.createElement("canvas")),ra.width=e,ra.height=e,ra)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const sa=new Map;function la(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=sa.get(n);if(void 0!==o)return o;const i=aa({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return sa.set(n,i),i}function ca(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function ua(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function da(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ha=e=>[ta,...e],ga={bar:ha([pr]),clusterbar:ha([pr]),point:ha([hr]),swarm:ha([hr]),pie:[Zr],donut:[Zr],boxplot:ha([Jr,hr]),violin:ha([ea]),histogram:ha([pr]),ridgeline:ha([ea]),timeline:ha([pr]),funnel:[pr,na,(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?oa(i):null!=r?`${oa(i)} (${ia(r)})`:oa(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=oa(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[pr,(e,t,n,o)=>{var i,r;const a=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of a){const n=("string"==typeof t.style.fill?t.style.fill:null)||tn(e,"var(--semiotic-border, #999)"),o=la(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=nn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,tn(e,"var(--semiotic-text, #333)")),a=r?"#1f2937":"#ffffff",s=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?da(i):"",d=ua(o);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),ca(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),ca(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:ha([pr]),custom:ha([pr,hr,Zr,Jr,ea,na])},fa={top:50,right:40,bottom:60,left:70},pa={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ya({hover:n}){var o,i,r,a,s,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:pa,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:pa,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return t("div",{className:"semiotic-tooltip",style:pa,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===n.length&&t("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:pa,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(s=null!==(a=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==a?a:c.__rValue)&&void 0!==s?s:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:pa,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}return t("div",{className:"semiotic-tooltip",style:pa,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}ya.ownsChrome=!0;const ma=g(function(n,s){var c,u,h,g,f,y,m,v,b,x,k;const{chartType:w,runtimeMode:A,data:S,oAccessor:O="category",rAccessor:C="value",colorAccessor:j,stackBy:M,groupBy:P,multiAxis:_,timeAccessor:L,valueAccessor:T,categoryAccessor:$,projection:N="vertical",size:B=[600,400],responsiveWidth:D,responsiveHeight:E,margin:I,barPadding:R,roundedTop:F,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:ae,oExtent:se,extentPadding:le=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:ge,colorScheme:fe,barColors:pe,showAxes:ye=!0,showCategoryTicks:be,categoryLabel:xe,valueLabel:we,categoryFormat:Ae,valueFormat:Se,oLabel:Oe,rLabel:Ce,oFormat:je,rFormat:Me,rTickValues:Pe,tickLabelEdgeAlign:_e,axisExtent:Le,enableHover:Te=!0,hoverAnnotation:$e,tooltipContent:Ne,customHoverBehavior:Be,annotations:De,autoPlaceAnnotations:Ee,svgAnnotationRules:Ie,showGrid:He=!1,legend:Re,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:ze,legendIsolatedCategories:Ye,legendPosition:Ge,legendLayout:qe,legendCategoryAccessor:Xe,onCategoriesChange:Ve,backgroundGraphics:Ue,foregroundGraphics:Ke,title:Qe,className:Ze,background:Je,centerContent:et,decay:tt,pulse:nt,transition:ot,animate:it,staleness:rt,brush:at,onBrush:st,accessibleTable:lt=!0,description:ct,summary:ut,customLayout:dt,layoutConfig:ht}=n,gt=i(!0),ft=er({sizeProp:B,responsiveWidth:D,responsiveHeight:E,userMargin:I,marginDefault:fa,foregroundGraphics:Ke,backgroundGraphics:Ue,animate:it,transitionProp:ot,themeDirtyRef:gt}),{reducedMotionRef:pt,responsiveRef:yt,size:mt,margin:vt,adjustedWidth:bt,adjustedHeight:xt,resolvedForeground:kt,resolvedBackground:wt,currentTheme:At,transition:St,introEnabled:Ot,tableId:Ct,rafRef:jt,renderFnRef:Mt,scheduleRender:Pt}=ft,_t=oi(),Lt=si(),Tt=r(()=>me(S),[S]),$t=null!=xe?xe:Oe,Nt=null!=we?we:Ce,Bt=null!=Ae?Ae:je,Dt=null!=Se?Se:Me,Et=i(null),It=i(null),Ht=i([]),Rt=i(Xe),Wt=i(Ve);Rt.current=Xe,Wt.current=Ve;const[zt,Yt]=d(null),[Gt,qt]=d(null),[Vt,Ut]=d(0),[Kt,Qt]=d(!1),[Zt,Jt]=d(null),en=l(()=>{var e,t;Jt(null!==(t=null===(e=sn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),nn=Te||$e,on="streaming"===A,rn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:on?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:le,projection:N,oAccessor:on?void 0:O,rAccessor:on?void 0:C,colorAccessor:j,stackBy:M,groupBy:P,multiAxis:_,timeAccessor:on?L:void 0,valueAccessor:on?T||("string"==typeof C||"function"==typeof C?C:void 0):void 0,categoryAccessor:on?$||O:void 0,rExtent:ae,oExtent:se,axisExtent:Le,barPadding:R,roundedTop:F,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:K,bins:Q,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:fe,themeCategorical:null===(e=null==At?void 0:At.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(At),themeSequential:null===(t=null==At?void 0:At.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==At?void 0:At.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:tt,pulse:nt,transition:St,introAnimation:Ot,staleness:rt,customLayout:dt,layoutConfig:ht,layoutMargin:vt}},[w,de,ue,le,N,O,C,j,M,P,_,L,T,$,ae,se,Le,R,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,te,ne,oe,ie,re,ce,he,ge,fe,pe,tt,nt,null==St?void 0:St.duration,null==St?void 0:St.easing,Ot,rt,on,At,dt,ht,vt]),an=ci(rn),sn=i(null);sn.current||(sn.current=new Hr(an));const ln=l(()=>{var e,t;const n=Rt.current,o=Wt.current;if(!o||!n)return;const i=kr(null!==(t=null===(e=sn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);wr(i,Ht.current)||(Ht.current=i,o(i))},[]);a(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(an),gt.current=!0,Pt()},[an,Pt]);const cn=i(null);cn.current||(cn.current=new ve(e=>{const t=sn.current;t&&t.ingest(e)&&(gt.current=!0,Pt())}));const un=l(e=>{var t;null===(t=cn.current)||void 0===t||t.push(e)},[]),dn=l(e=>{var t;null===(t=cn.current)||void 0===t||t.pushMany(e)},[]),hn=l(()=>{var e,t;null===(e=cn.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),gt.current=!0,Pt()},[Pt]),gn=l(e=>{var t,n;null===(t=cn.current)||void 0===t||t.clearLastData(),null===(n=cn.current)||void 0===n||n.setReplacementData(e)},[]);p(s,()=>({push:un,pushMany:dn,replace:gn,remove:e=>{var t,n,o,i;null===(t=cn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=sn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=It.current)||void 0===i?void 0:i.data;!!It.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(It.current=null,Yt(null)),gt.current=!0,Pt()}return r},update:(e,t)=>{var n,o,i;null===(n=cn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=sn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(gt.current=!0,Pt()),r},clear:hn,getData:()=>{var e,t,n;return null===(e=cn.current)||void 0===e||e.flush(),null!==(n=null===(t=sn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=sn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[un,dn,gn,hn,Pt]),a(()=>{var e;S&&(null===(e=cn.current)||void 0===e||e.setBoundedData(Tt))},[S,Tt]);const{hoverHandlerRef:fn,hoverLeaveRef:pn,onPointerMove:yn,onPointerLeave:mn}=ft;fn.current=e=>{if(!nn)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>o||o>bt||0>i||i>xt)return void(It.current&&(It.current=null,Yt(null),Be&&Be(null),Pt()));const r=sn.current;if(!r||0===r.scene.length)return;const a="radial"===N,s=function(e,t,n,o=30,i,r=0){let a=null;if(i){const e=Xt(i,t,n,o,r);e&&(a={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"rect":if(null==r.datum)break;e=Rr(r,t,n);break;case"point":if(i)break;e=Fr(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=Wr(r,t,n);break;case"boxplot":e=zr(r,t,n);break;case"violin":e=Yr(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}(r.scene,a?o-bt/2:o,a?i-xt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!s)return void(It.current&&(It.current=null,Yt(null),Be&&Be(null),Pt()));const l=Fi(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w}));It.current=l,Yt(l),Be&&(Be(l),gt.current=!0),Pt()},pn.current=()=>{It.current&&(It.current=null,Yt(null),Be&&(Be(null),gt.current=!0),Pt())};const vn=i(-1),bn=i(null),An=i(null),Sn=l(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(An.current&&An.current.version===n)o=An.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";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:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=xn(e),An.current={version:n,graph:o}}const i=vn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),vn.current=0;const t=o.flat[0];bn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},On(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});return It.current=n,Yt(n),Be&&Be(n),void Pt()}const r=kn(o,i),a=wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return vn.current=-1,bn.current=null,It.current=null,Yt(null),Be&&Be(null),void Pt();vn.current=a;const s=o.flat[a];bn.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},On(s)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof C?C:void 0,__chartType:w});It.current=l,Yt(l),Be&&Be(l),Pt()},[Be,Pt]),jn=l(e=>{vn.current=-1,bn.current=null,yn(e)},[yn]);Mt.current=()=>{var e,t;jt.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=sn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(pt.current?r+1e6:r),s=!pt.current&&a,l=gt.current;l&&!a&&(i.computeScene({width:bt,height:xt}),ln(),en(),gt.current=!1),(l||s)&&n.setAttribute("aria-label",mi(i.scene,w+" chart"));const c=nr(),u=mt[0]*c,d=mt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=mt[0]+"px",n.style.height=mt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,mt[0],mt[1]);const h=null!==(e=null==rt?void 0:rt.threshold)&&void 0!==e?e:5e3,g=rt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==rt?void 0:rt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Je&&!Ue){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Je||(e&&"transparent"!==e?e:null),i=t?tn(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,mt[0],mt[1]))}const f="radial"===N;o.save(),o.beginPath(),o.rect(vt.left,vt.top,bt,xt),o.clip(),f?(o.save(),o.translate(vt.left+bt/2,vt.top+xt/2)):o.translate(vt.left,vt.top);const p=dt?ga.custom:ga[w]||[],y={width:bt,height:xt};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(qt(i.scales),Ut(e=>e+1)),(null==rt?void 0:rt.showBadge)&&Qt(!!g),(s||null!=i.activeTransition||i.hasActivePulses)&&(jt.current=requestAnimationFrame(()=>Mt.current()))},li({hydrated:_t,wasHydratingFromSSR:Lt,storeRef:sn,dirtyRef:gt,renderFnRef:Mt,cleanup:()=>{var e;return null===(e=cn.current)||void 0===e?void 0:e.clear()}}),a(()=>{gt.current=!0,Pt()},[w,bt,xt,ye,Je,Pt]),Cn(rt,sn,gt,Pt,Kt,Qt);const Mn=nn&&zt?Ne?Ne(zt):e(ya,{hover:zt}):null,Pn="radial"===N,_n=Mn?e(Ui,{x:zt?Pn?zt.x+bt/2:zt.x:0,y:zt?Pn?zt.y+xt/2:zt.y:0,containerWidth:bt,containerHeight:xt,margin:vt,className:"stream-ordinal-tooltip",children:Mn}):null,Ln=Ar(O,void 0,"__semiotic_resolvedO",""),Tn=Ar(C,void 0,"__semiotic_resolvedR",""),$n=Ln.key,Nn=Tn.key,Bn=Sr(Ln,Tn,De&&De.length>0||!1);if(ti||!_t&&Lt){const n=sn.current;n&&S&&(n.ingest({inserts:Tt,bounded:!0}),n.computeScene({width:bt,height:xt}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,a="radial"===N,s=a?vt.left+bt/2:vt.left,l=a?vt.top+xt/2:vt.top;return t("div",{ref:yt,className:"stream-ordinal-frame"+(Ze?" "+Ze:""),role:"img","aria-label":ct||("string"==typeof Qe?Qe:"Ordinal chart"),style:{position:"relative",width:D?"100%":mt[0],height:E?"100%":mt[1]},children:[e(Bi,{summary:ut}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:mt[0],height:mt[1],style:{position:"absolute",left:0,top:0},children:[wt&&e("g",{transform:`translate(${vt.left},${vt.top})`,children:wt}),t("g",{transform:`translate(${s},${l})`,children:[Je&&e("rect",{x:0,y:0,width:bt,height:xt,fill:Je}),i.map((n,i)=>function(n,i,r){var a,s,l,c,u,d,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=ei(m)+"-grad",a=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,a=t.x,s=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,s=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,a=t.x,s=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,a=t.x+t.w,s=t.y);const l=[];if("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;for(let n=0;t.length>n;n++)l.push(e("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Jo(t.style.fill);l.push(e("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:a,y2:s,children:l})}(i,r),s=a?`url(#${r})`:Jo(i.style.fill);if(i.cornerRadii&&Xo(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:a,br:s,bl:l}=Vo(e);let c=`M${t+r},${n}`;return c+=` L${t+o-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o},${n+a}`),c+=` L${t+o},${n+i-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o-s},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:n,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:d,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Jo(t.style.fill),opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=ei(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:a,slices:d}=Qo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(s=o.roundedEnds)||void 0===s?void 0:s.start)||void 0===l||l,roundEnd:null===(u=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===u||u,colors:o._gradientBand.colors});return t("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:n,children:e("path",{d:a})})}),e("g",{clipPath:`url(#${n})`,children:d.map((t,n)=>e("path",{d:t.d,fill:Jo(t.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&e("path",{d:a,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let a;if(o.roundedEnds)a=Ko({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=H().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),a=e(Zo)||""}return e("path",{d:a,transform:`translate(${o.cx},${o.cy})`,fill:Jo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return t("g","vertical"===o.projection?{children:[e("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Jo(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Jo(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=n,o=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Jo(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:o},m)}case"connector":return e("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=n,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:o,fill:Jo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(n,i,Ct)).filter(Boolean)]})]}),e(Xr,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:r,showAxes:ye,showCategoryTicks:be,oLabel:$t,rLabel:Nt,oFormat:Bt,rFormat:Dt,rTickValues:Pe,tickLabelEdgeAlign:_e,axisExtent:Le,showGrid:He,title:Qe,legend:Re,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:ze,legendIsolatedCategories:Ye,legendPosition:Ge,legendLayout:qe,foregroundGraphics:Ft(kt,null===(h=sn.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:De,autoPlaceAnnotations:Ee,svgAnnotationRules:Ie,annotationFrame:0,xAccessor:$n,yAccessor:Nn,annotationData:Bn(null==n?void 0:n.getData())}),et&&"radial"===N&&e("div",{style:{position:"absolute",left:vt.left+bt/2,top:vt.top+xt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:et})]})}return t("div",{ref:yt,className:"stream-ordinal-frame"+(Ze?" "+Ze:""),role:"group","aria-label":ct||("string"==typeof Qe?Qe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:D?"100%":mt[0],height:E?"100%":mt[1],overflow:"visible"},onKeyDown:Sn,children:[lt&&e(Di,{tableId:Ct}),lt&&e($i,{scene:null!==(f=null===(g=sn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:w+" chart",tableId:Ct,chartTitle:"string"==typeof Qe?Qe:void 0}),e(Bi,{summary:ut}),e(Ei,{hoverPoint:zt}),t("div",{role:"img","aria-label":ct||("string"==typeof Qe?Qe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?jn:void 0,onMouseLeave:nn?mn:void 0,children:[wt&&e("svg",{style:{position:"absolute",top:0,left:0,width:mt[0],height:mt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${vt.left},${vt.top})`,children:wt})}),e(Gr,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:Gt,showAxes:ye,showGrid:He,rFormat:Dt,rTickValues:Pe,axisExtent:Le}),e("canvas",{ref:Et,"aria-label":mi(null!==(m=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:mt[0],height:mt[1]}}),e(Xr,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:Gt,showAxes:ye,showCategoryTicks:be,oLabel:$t,rLabel:Nt,oFormat:Bt,rFormat:Dt,rTickValues:Pe,axisExtent:Le,showGrid:He,title:Qe,legend:Re,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:ze,legendIsolatedCategories:Ye,legendPosition:Ge,legendLayout:qe,foregroundGraphics:Ft(kt,Zt),annotations:De,autoPlaceAnnotations:Ee,svgAnnotationRules:Ie,annotationFrame:Vt,xAccessor:$n,yAccessor:Nn,annotationData:Bn(null===(v=sn.current)||void 0===v?void 0:v.getData()),underlayRendered:!0}),(at||st)&&"radial"!==N&&e(Vr,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:Gt,onBrush:st||(()=>{})}),et&&"radial"===N&&e("div",{style:{position:"absolute",left:vt.left+bt/2,top:vt.top+xt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:et}),(null==rt?void 0:rt.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===rt.badgePosition?{top:4,left:4}:"bottom-left"===rt.badgePosition?{bottom:4,left:4}:"bottom-right"===rt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Kt?"#dc3545":"#28a745",color:"white"}),children:Kt?"STALE":"LIVE"}),e(Hi,{active:vn.current>=0,hoverPoint:zt,margin:vt,size:mt,shape:null===(b=bn.current)||void 0===b?void 0:b.shape,width:null===(x=bn.current)||void 0===x?void 0:x.w,height:null===(k=bn.current)||void 0===k?void 0:k.h}),_n]})]})});ma.displayName="StreamOrdinalFrame";const va={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},ba={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class xa{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const n=this.particles[t];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,n,o){var i;for(let r=0;this.capacity>r;r++){const a=this.particles[r];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(r);continue}const l=o&&null!==(i=o[a.edgeIndex])&&void 0!==i?i:1;a.t+=e*t*l*(s.bezier.circular?.3:1),1>a.t?ka(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}}function ka(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,i){const r=e.length,a=t*r,s=Math.min(Math.floor(a),r-1),l=a-s,[c,u,d,h]=e[s];wa(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*n*o*2,i.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[i,r,a,s]=e.points;wa(i,r,a,s,t,o);const l=s.x-i.x,c=s.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function wa(e,t,n,o,i,r){const a=1-i,s=a*a,l=s*a,c=i*i,u=c*i;r.x=l*e.x+3*s*i*t.x+3*a*c*n.x+u*o.x,r.y=l*e.y+3*s*i*t.y+3*a*c*n.y+u*o.y}function Aa(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Sa(e,t){var n,o=[],i=[],r=[],a={},s=[];function l(e){r[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],r[t]&&l(t)})}function c(e){var t,o,d=!1;for(i.push(e),r[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,i),d=!0):r[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return i.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),i=Array(t),r=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,i[l]=!1,r[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}r[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=o.components.filter(function(e){return e.length>1}),r=1/0,a=0;i.length>a;a++)for(var s=0;i[a].length>s;s++)r>i[a][s]&&(r=i[a][s],n=a);var l=i[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];r[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function Oa(e){return e.y0-e.y1>0?"up":"down"}function Ca(e,t){return t(e.source)==t(e.target)}function ja(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Ma(e){return e.target.x0-e.source.x1}function Pa(e,t){var n=La(e),o=Ma(t)/Math.tan(n);return"up"==Oa(e)?e.y1-o:e.y1+o}function _a(e,t){var n=La(e),o=Ma(t)/Math.tan(n);return"up"==Oa(e)?e.y1+o:e.y1-o}function La(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Ta(e,t){return t(e)}function $a(e){return Ba(e.source)}function Na(e){return Ba(e.target)}function Ba(e){return(e.y0+e.y1)/2}function Da(e){return e.virtual?0:e.value}function Ea(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Ca(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Ca(e,t)?o+1:o}),n+o}function Ia(e){return e.target.depth}function Ha(e,t){return e.sourceLinks.length?e.depth:t-1}function Ra(e,t){return e.y0-t.y0}function Fa(e,t){return t.y0-e.y0}function Wa(e,t){return e.y1-t.y1}function za(e,t){return t.y1-e.y1}function Ya(e,t){return qa(e.source,t.source)||e.index-t.index}function Ga(e,t){return qa(e.target,t.target)||e.index-t.index}function qa(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Xa(e,t){return Va(e)==Va(t)?"bottom"==e.circularLinkType?Fa(e,t):Ra(e,t):Va(t)-Va(e)}function Va(e){return e.target.column-e.source.column}function Ua(e,t){return Ka(e)==Ka(t)}function Ka(e){return e.y0-e.y1>0?"up":"down"}function Qa(e,t,n,o,i){let r=e;var a=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=z(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Za(r.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Za(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Ca(e,t)&&ja(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Fa:Ra);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=r.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?za:Wa),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,i=e.y1,r=(t+o)/2;return"M"+t+","+n+"C"+r+","+n+" "+r+","+i+" "+o+","+i}(e)}),r}function Za(e,t,n){e.sort(Xa);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Ca(e,t)&&ja(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Ja(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function Ja(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function es(e){return function(){return e}}function ts(e){return e.index}function ns(e){return e.nodes}function os(e){return e.links}function is(e,t,n){var o=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(i,r){var a=i.length;if(t)i.sort(t);else if(r>0){var s=new Map;i.forEach(function(e,t){var n,o,i,r=(o=0,i=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ba(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ba(e.target)*t,o+=t}}),o>0?i/o:NaN);s.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var n=s.get(e),o=s.get(t),i=n.bc,r=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?n.idx-o.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Ea(t,n)-Ea(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Ea(t,n)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+i,t.y1=t.y0+t.value*e.ky)})})}function rs(e,t,n,o,i,r){var a=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=r;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(i){var r=i.length,a=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Ea(i,n)>0){var l=X(i.sourceLinks,Na),c=X(i.targetLinks,$a),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Ba(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==a&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(a==o-1&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var h=X(i.sourceLinks,Na),g=X(i.targetLinks,$a),f=((h&&g?(h+g)/2:h||g)-Ba(i))*t;i.y0+=f,i.y1+=f}})})}function u(){a.forEach(function(n){var r,a,s,l=e.y0,c=n.length;for(n.sort(t||qa),s=0;c>s;++s)(a=l-(r=n[s]).y0)>0&&(r.y0+=a,r.y1+=a),l=r.y1+o;if((a=l-o-e.y1)>0)for(l=r.y0-=a,r.y1-=a,s=c-2;s>=0;--s)(a=(r=n[s]).y1+i-l)>0&&(r.y0-=a,r.y1-=a),l=r.y0})}}function as(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Ga),e.targetLinks.sort(Ya)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,i=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function ss(){var e=0,t=0,n=1,o=1,i=24,r=8,a=null,s=ts,l=Ha,c=void 0,u=32,d=2,h=ns,g=os;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return V(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,i=e.target;"object"!=typeof o&&(o=e.source=Aa(n,o)),"object"!=typeof i&&(i=e.target=Aa(n,i)),o.sourceLinks.push(e),i.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],i=0;e.links.length>i;i++){var r=e.links[i],a=r.source.index,s=r.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Sa(o);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:o>n?"top":"bottom","top"==i.circularLinkType?n++:o++,e.nodes.forEach(function(e){Ta(e,t)!=Ta(i.source,t)&&Ta(e,t)!=Ta(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Ca(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,Da),q(e.targetLinks,Da)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,i,r;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,r):e.column})}(h,c,l);var g=r;if(null!==a){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=z(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/r),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,i),is(h,c,s),rs(h,c,s,g,g,u),as(h),Qa(h,s,d,10,8),is(h,c,s),rs(h,c,s,g,g,u),as(h),Qa(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Ta(n.source,t)==Ta(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ua(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Pa(t,e);return e.y1-n}if(t.target.column>e.target.column)return Pa(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Ta(n.target,t)==Ta(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ua(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=_a(t,e);return e.y0-n}if(t.source.column>e.source.column)return _a(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;o.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,i=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==o||0==i){var r=z(t,function(e){return e.y0}),a=G(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-r);function l(t){return(t-r)/(a-r)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Qa(h,s,d,10,8)}(f),f}return f.update=function(e){return as(e),Qa(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:es(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:es(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:es(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:es(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],o=+i[1][1],f):[[e,t],[n,o]]},f.size=function(i){return arguments.length?(e=t=0,n=+i[0],o=+i[1],f):[n-e,o-t]},f}function ls(e){const{sx:t,sTop:n,sBot:o,tx:i,tTop:r,tBot:a,cp1X:s,cp2X:l}=e,c=(n+o)/2,u=(r+a)/2;return{pathD:[`M${t},${n}`,`C${s},${n} ${l},${r} ${i},${r}`,`L${i},${a}`,`C${l},${a} ${s},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(o-n)/2}}}const cs=e=>{let t,n,o,i,r,a,s,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,a=e.target.x0,s=ie(r,a),l=s(.5),c=s(.5),`M${t},${r}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${i},${l} ${i},${r}Z`;const u=e.sankeyWidth/2,d=ie(e.source.x1,e.target.x0),{pathD:h}=ls({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function us(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,o=i.sourceY,r=i.targetX,a=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${r},${a-n}L${r-l},${a-n}L${r-l},${a+n}L${r},${a+n}Z`}const r=i.sourceX,a=i.sourceY,s=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${r},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${r},${a+h*n}Z`}const ds=new Set,hs=new WeakMap;function gs(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=hs.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,hs.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;ds.has(e)||(ds.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const fs={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ia))-1:0},justify:Ha};function ps(e){return"string"==typeof e?e:e.id}const ys={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(i=n.nodeWidth)&&void 0!==i?i:15,f=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=ss().extent(v).links(m).nodes(y).nodeAlign(fs[h]||Ha).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>i&&(i=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const r=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-a&&(e=r.leftFullExtent-a),r.rightFullExtent+a>t&&(t=r.rightFullExtent+a),n>r.verticalFullExtent-a&&(n=r.verticalFullExtent-a),r.verticalFullExtent+a>i&&(i=r.verticalFullExtent+a)}const r=t-e,a=i-n,u=o[0],d=o[1];if(r>0&&a>0&&(0>e||0>n||t>u||i>d)){const t=Math.min(u/r,d/a),o=-e*t+(u-r*t)/2,i=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of m)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+i,n.targetY=n.targetY*t+i,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+i,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+i,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=ps(e.source),n=ps(e.target),o=k.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);if(o){o.y0=e.y0,o.y1=e.y1,o.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,o.circular=!!e.circular,o.circularPathData=e.circularPathData,o._circularWidth=e._circularWidth,o._circularStub=e._circularStub,o.path=e.path,o.circularLinkType=e.circularLinkType,o.direction=d;const i=x.get(t),r=x.get(n);i&&(o.source=i),r&&(o.target=r)}}},buildScene(e,t,n,o){var i,r,a,s,l,c;const u="vertical"===n.orientation?"down":"right",d=n.nodeStyle,h=n.edgeStyle,g=null!==(i=n.edgeOpacity)&&void 0!==i?i:.5,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=[],v=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=d?d(gs(t,"nodeStyle")):{},i={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),m.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(o.id)||y.get(o.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(gs(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,o=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=u.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+o},${t.sourceY-n}L${t.sourceX+o},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+o}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-r},${t.targetY-n}L${t.targetX-r},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:a,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?us(e):cs(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};v.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const r=t?t(n):n.id;if(!r)continue;let a,s,l;"down"===u?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(a=n.x0-6,l="end"):(a=n.x1+6,l="start"),s=n.y0+i/2),b.push({x:a,y:s,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},ms={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r;if(0===e.length)return;const a=null!==(i=n.forceStrength)&&void 0!==i?i:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=vs(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const i=bs(e.id),r=i%360*(Math.PI/180),a=10+i%20;e.x=t/o.length+a*Math.cos(r),e.y=n/o.length+a*Math.sin(r)}else{const t=bs(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),i=n*t;o.x=s+e*Math.cos(i),o.y=l+e*Math.sin(i)}}}const g=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=xs(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),o=ae().force("charge",se().strength(e=>-25*y(e))).force("center",le(s,l).strength(.8)).force("x",ce(s).strength(.15)).force("y",ue(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.links(e),o.force("link",n)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.edgeStyle,g=xs(n.nodeSize,n.nodeSizeRange,e),f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],m=[],v=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(gs(t,"nodeSize")),o=d?d(gs(t,"nodeStyle")):{},s={fill:o.fill||p.get(t.id)||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:2,opacity:o.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:s,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),o="object"==typeof e.target?e.target:b.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const i=h?h(gs(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};m.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=g(gs(n,"nodeSize"));v.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function vs(e,t,n){const o=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let a=null;if(t===e?a=r:r===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function bs(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function xs(e,t,n){var o,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>r[0];const s=null!==(o=z(a))&&void 0!==o?o:0,l=null!==(i=G(a))&&void 0!==i?i:1;if(s===l)return()=>(r[0]+r[1])/2;const c=k().domain([s,l]).range(r).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?r[0]:c(o)}}const ks=qe,ws={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-r,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const i=d(e);p[n][o]=i}const y=he().padAngle(i);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=H().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid({innerRadius:l,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+c,n.y=o[1]+u,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,i=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,o){var i,r,a,s;const{groupWidth:l=20,edgeOpacity:c=.5}=n,u=Math.min(o[0],o[1])/2,d=u-l,h=o[0]/2,g=o[1]/2,f=n.nodeStyle,p=n.edgeStyle,y=n.edgeColorBy||"source",m=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ks,v=new Map;e.forEach((e,t)=>{v.set(e.id,m[t%m.length])});const b=de().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let r;r=f?f(gs(n,"nodeStyle")).fill||v.get(n.id)||m[t%m.length]:v.get(n.id)||m[t%m.length];const a=f?f(gs(n,"nodeStyle")):{},s={fill:r,stroke:a.stroke||"black",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=b(t);if(!o)continue;const i=As(o,h,g);let l=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(p)l=p(gs(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?l=v.get(n.id)||l:t&&(l=v.get(t.id)||l)}const u=p?p(gs(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==n.showLabels){const t=(A=n.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,o=u+12;for(const n of e){const e=n.__arcData;if(!e)continue;const i=t?t(n):n.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,a=r-Math.PI/2;w.push({x:h+Math.cos(a)*o,y:g+Math.sin(a)*o,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function As(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const i=[];let r=0;for(;o.length>r;){const e=o[r];if("M"===e||"L"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("C"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;3>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("Q"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;2>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("A"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&(i.push(Number(o[r])+t+""),r++),o.length>r&&(i.push(Number(o[r])+n+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(o[r]),r++)}return i.join(" ")}const Ss=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Os(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>150?"#222":"#fff"}function Cs(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function js(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function Ms(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Ss}function Ps(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function _s(e,t,n,o,i){if("horizontal"===i){const i=(e+n)/2;return`M ${e},${t} C ${i},${t} ${i},${o} ${n},${o}`}if("radial"===i){const i=(e+n)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+o)/2} T ${n},${o}`}{const i=(t+o)/2;return`M ${e},${t} C ${e},${i} ${n},${i} ${n},${o}`}}const Ls={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var i;const r=n.__hierarchyRoot;if(!r)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,u=K(r,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=ne();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var i,r;const a=null!==(i=t.padding)&&void 0!==i?i:4,s=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([n,o]).tile(ee).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([n,o]).padding(r)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var i;Q().size([n,o]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],r={id:Cs(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=o.value)&&void 0!==i?i:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?Ts(r,o,n):"treemap"===a||"partition"===a?$s(r,o):"circlepack"===a&&Ns(r,o),r.__hierarchyNode=o,e.push(r),f.set(o,r)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const i=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,i,r){var a,s,l,c,u,d,h,g;const f=[],p=[],y=[],m=n.treeOrientation||"vertical",v="radial"===m,b=o[0]/2,x=o[1]/2,k="number"==typeof(w=n.nodeSize)?w:5;var w;for(const t of e){let e=t.x,o=t.y;v&&(e+=b,o+=x);const r=i(gs(t,"nodeStyle"));let l=r.fill||Ps(n);if(n.colorByDepth&&void 0!==t.depth){const e=Ms(n);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(s=r.strokeWidth)&&void 0!==s?s:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:o,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=n.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=t.x,a=t.y,s=o.x,l=o.y;v&&(i+=b,a+=x,s+=b,l+=x);const g=_s(i,a,s,l,m),f=r(gs(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=n.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==n.showLabels){const t=js(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,i,r,a=n.x,s=n.y;if(v&&(a+=b,s+=x),v){const e=a-b,t=s-x,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,i=s+t/n*10,r=0>e?"end":"start"):(o=a,i=s-12,r="middle")}else"horizontal"===m?((null===(g=n.data)||void 0===g?void 0:g.children)&&0!==n.data.children.length?(o=a-k-6,r="end"):(o=a+k+6,r="start"),i=s):(o=a,i=s+k+14,r="middle");y.push({x:o,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,n,o,i,r);case"treemap":case"partition":return function(e,t,n,o){var i,r,a,s,l;const c=[],u=[];for(const n of e){const e=n.x1-n.x0,a=n.y1-n.y0;if(0>=e||0>=a)continue;const s=o(gs(n,"nodeStyle"));let l=s.fill||Ps(t);if(t.colorByDepth&&void 0!==n.depth){const e=Ms(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:e,h:a,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=js(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(a=c.data)||void 0===a?void 0:a.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=n?n(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=o(gs(c,"nodeStyle")).fill||Ps(t);if(t.colorByDepth&&void 0!==c.depth){const e=Ms(t);f=e[c.depth%e.length]}const p="string"==typeof f?Os(f):null!==(l=null===(s=t.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,i);case"circlepack":return function(e,t,n,o){var i,r,a,s,l,c,u,d,h,g;const f=[],p=[];for(const n of e){const e=null!==(i=n.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=o(gs(n,"nodeStyle"));let c=l.fill||Ps(t);if(t.colorByDepth&&void 0!==n.depth){const e=Ms(t);c=e[n.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=l.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=l.opacity)&&void 0!==s?s:.7};f.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=js(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=n?n(i):i.id;if(!r)continue;if(15>e)continue;const a=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let s=o(gs(i,"nodeStyle")).fill||Ps(t);if(t.colorByDepth&&void 0!==i.depth){const e=Ms(t);s=e[i.depth%e.length]}if(a){const n="string"==typeof s?Os(s):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Ts(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function $s(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Ns(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Bs(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Ds={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const i=n.__hierarchyRoot;i&&function(e,t,n,o,i){var r,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Bs(n);f.metaMap.clear(),o.length=0,i.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,r,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,C=R().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=C(k),M=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=r+O*Math.sin(s),g=a+O*Math.cos(s)*M;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:n,eccentricity:M}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(i,o,n,e,t)},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==n.orbitShowRings){const t=Bs(n),o=new Map;for(const t of e)o.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;i.has(n)||i.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of i)for(let i=0;r>i;i++){const s=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(gs(t,"nodeSize")),o=d?d(gs(t,"nodeStyle")):{},c={fill:o.fill||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=o.opacity)&&void 0!==s?s:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),n="object"==typeof e.target?e.target:m.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=g(gs(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(u=null===(c=n.data)||void 0===c?void 0:c[t])&&void 0!==u?u:n.id;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,n,o,i)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const i=Bs(t),r=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},Es={sankey:ys,force:ms,chord:ws,tree:Ls,cluster:Ls,treemap:Ls,circlepack:Ls,partition:Ls,orbit:Ds};function Is(e){return Es[e]}class Hs{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},va),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new xa(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},va),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new xa(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Rs(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",i=c(n)+"",r=u(n),a=null==r?NaN:Number(r),s=Number.isFinite(a)?a:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Rs(o)),{data:n})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Rs(i)),{data:n}));const d=`${o}\0${i}\0${e}`,h={source:o,target:i,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&Fs(n.bezier)&&(h.bezier=n.bezier),this.edges.set(d,h)}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,i=0===this.nodes.size;let r=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Rs(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,Rs(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,r=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,i,r,a,s,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Is(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const s of u)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(i=s._prevY0)&&void 0!==i?i:0);e.set(s.id,{x:(null!==(r=s._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,n,o,i,r,a;const s=Array.from(this.nodes.values()),l=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=Dr(this.config.colorScheme,this.config.themeCategorical,qe),u={nodes:s,edges:l,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...c]},resolveColor:Er(c),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{}};let d;try{d=this.config.customNetworkLayout(u)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(o=d.sceneNodes)&&void 0!==o?o:[],this.sceneEdges=null!==(i=d.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(r=d.labels)&&void 0!==r?r:[],void(this.customLayoutOverlays=null!==(a=d.overlays)&&void 0!==a?a:null)}this.customLayoutOverlays=null;const c=Is(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(s,l,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=Is(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Is(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),i=Array.from(this.edges.values());return n.tick(o,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=At(e,this.transition),n=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,n),e.x1=St(e._prevX1,e._targetX1,n),e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=null==e?void 0:e.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=n.x0,a=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:r}],halfWidth:o}}const i=t.x1,r=n.x0,a=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const i=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],r=n.x-t.x,a=n.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+a/3},{x:t.x+2*r/3,y:t.y+2*a/3},n])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,i,r;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const i=e-o;s>i&&(t._pulseIntensity=1-i/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(i=n.source)||void 0===i?void 0:i.id:n.source,a="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const i=this._decaySortedNodes,r=new Map;for(let e=0;i.length>e;e++)r.set(i[e][0],e);for(const i of this.sceneNodes){const a=i.id;if(!a)continue;const s=r.get(a);if(void 0===s)continue;const l=xt(n,s,o),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const i=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const i=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,i}updateEdge(e,t,n){var o;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,a=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){a.push(i.data?Object.assign({},i.data):{}),i.data=n(null!==(o=i.data)&&void 0!==o?o:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&o(i.data)===e&&n.push(t)}else for(const[o,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Rs(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Fs(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Ws(e))return!1;return!0}return Ws(t.points)}function Ws(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function zs(e,t,n,o,i=30){let r=null,a=i,s=1/0;for(const t of e){const e=Ys(t,n,o,i);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(r=e,s=n)}else a>e.distance&&(r=e,a=e.distance)}if(r)return r;for(const e of t){if(!1===e.interactive)continue;const t=Us(e,n,o);t&&a>t.distance&&(r=t,a=t.distance)}return r}function Ys(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=Wt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const a=qt(Math.atan2(i,o)),s=qt(e.startAngle),l=qt(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let Gs=null,qs=null;function Xs(){return qs||(Gs=document.createElement("canvas"),Gs.width=1,Gs.height=1,qs=Gs.getContext("2d")),qs}function Vs(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function Us(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=Vs(e),i=Xs();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,i=e.y2-e.y1,r=o*o+i*i;if(0===r)return null;let a=((t-e.x1)*o+(n-e.y1)*i)/r;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*i,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=Vs(e),i=Xs();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Ks(i){const{width:r,height:a,totalWidth:s,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:m="right",legendLayout:v,foregroundGraphics:b,sceneNodes:x,annotations:k,autoPlaceAnnotations:w,svgAnnotationRules:A}=i,S=o.useMemo(()=>{const e=(x||[]).flatMap(e=>{const t=function(e){var t,n,o,i;const r=null!==(t=e.cx)&&void 0!==t?t:null!=e.x&&null!=e.w?e.x+e.w/2:e.x,a=null!==(n=e.cy)&&void 0!==n?n:null!=e.y&&null!=e.h?e.y+e.h/2:e.y;return"number"!=typeof r||"number"!=typeof a?null:{x:r,y:a,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):Math.max(1,null!==(o=e.w)&&void 0!==o?o:0,null!==(i=e.h)&&void 0!==i?i:0)/2}}(e),n=function(e){var t,n,o,i,r,a,s,l;const c=null!==(a=null!==(o=null!==(t=e.id)&&void 0!==t?t:null===(n=e.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:null===(r=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===r?void 0:r.id)&&void 0!==a?a:null===(l=null===(s=e.datum)||void 0===s?void 0:s.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:n},t)]:[]});return{scales:null,width:r,height:a,frameType:"network",pointNodes:e,sceneNodes:x}},[a,x,r]),O=o.useMemo(()=>k&&w?Co(Object.assign({annotations:k,context:S},"object"==typeof w?w:{})):k,[k,w,S]),C=O?io(O.reduce((t,n,i)=>{if("widget"===n.type||!A)return t;const r=A(n,i,S);return r&&t.push({node:e(o.Fragment,{children:r},"annotation-"+i),annotation:n}),t},[])):null,j=!0===(null==O?void 0:O.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return t(n,{children:[j&&e("style",{children:Jn},"annotation-widget-disclosure-style"),t("svg",{role:"img",width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,n)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+n)),C,b]}),d&&"string"==typeof d?e("text",{x:s/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:d}):d?e("foreignObject",{x:0,y:0,width:s,height:c.top,children:d}):null,Dn({legend:h,totalWidth:s,totalHeight:l,margin:c,legendPosition:m,title:d,legendLayout:v,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==O?void 0:O.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,n)=>{var o,i,r,a,s,l,u,d,h;const g=!0===t._annotationDeferred,f=x.find(e=>{var n,o,i,r,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(i=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(a=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===a?void 0:a.name)===t.nodeId});if(!f)return null;const p=c.left+(null!==(o=f.cx)&&void 0!==o?o:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(i=f.x)&&void 0!==i?i:0),y=c.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(a=f.y)&&void 0!==a?a:0),m=null!==(s=t.dx)&&void 0!==s?s:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,b=null!==(u=t.width)&&void 0!==u?u:32,k=null!==(d=t.height)&&void 0!==d?d:32,w=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{className:g?"annotation-deferred":void 0,"data-annotation-disclosure":g?"deferred":void 0,style:{position:"absolute",left:p+m-b/2,top:y+v-k/2,width:b,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:w},"widget-"+n)})]})}function Qs(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Zs(e,t){var n,o,i,r,a,s;if(!t.pathD)return;e.save();const l=Qs(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const i=e.createLinearGradient(a.x0,0,a.x1,0),r=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999",l=tn(e,s)||s;i.addColorStop(0,1===a.from?l:"transparent"),i.addColorStop(1,1===a.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Js(e,t){var n,o;e.save();const i=t.style.stroke||"#999";e.strokeStyle=tn(e,i)||i,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function el(e,t){var n,o,i,r;if(!t.pathD)return;e.save();const a=Qs(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function tl(e,t){var n,o;if(!t.pathD)return;e.save();const i=Qs(t),r=t.style.stroke||"#999";e.strokeStyle=tn(e,r)||r,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(i)),e.restore()}Ks.displayName="NetworkSVGOverlay";const nl={top:20,right:80,bottom:20,left:80},ol={top:40,right:40,bottom:40,left:40},il=new Set(["chord","force","circlepack","orbit"]),rl=[800,600],al={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 sl({data:n}){var o,i,r,a,s,l;if("edge"===n.nodeOrEdge){const e=n.data;return e?t("div",{className:"semiotic-tooltip",style:al,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=n.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const n=[];let s=u;for(;s;){const e=null!==(a=null!==(i=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==i?i:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==a?a:c.id;null!=e&&n.unshift(e+""),s=s.parent}n.length>1&&n.shift();const l=n.length-1;return t("div",{className:"semiotic-tooltip",style:al,children:[e("div",{children:n.map((n,o)=>t("span",{children:[o>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===l?e("strong",{children:n}):e("span",{style:{opacity:.7},children:n})]},o))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(s=c.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:al,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}sl.ownsChrome=!0;const ll=g(function(n,o){var s,c,u,h,g,f,y,m,v,b,x,k,w,A,S,O,C,j;const{chartType:M,nodes:P,edges:_,data:L,initialEdges:T,nodeIDAccessor:$="id",sourceAccessor:N="source",targetAccessor:B="target",valueAccessor:D="value",edgeIdAccessor:E,childrenAccessor:I,hierarchySum:R,orientation:F="horizontal",nodeAlign:W="justify",nodePaddingRatio:z=.05,nodeWidth:Y=15,iterations:G=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:V=20,sortGroups:U,edgeSort:K,treeOrientation:Q="vertical",edgeType:Z="curve",padding:J,paddingTop:ee,tensionConfig:te,showParticles:ne=!1,particleStyle:oe,nodeStyle:ie,edgeStyle:re,colorBy:ae,colorScheme:se="category10",edgeColorBy:le="source",edgeOpacity:ce=.5,colorByDepth:ue=!1,nodeSize:de=8,nodeSizeRange:he=[5,20],nodeLabel:ge,showLabels:fe=!0,labelMode:pe,size:ye=rl,responsiveWidth:ve,responsiveHeight:be,margin:xe,className:we,background:Ae,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:Ce,customClickBehavior:je,onObservation:Me,chartId:Pe,onTopologyChange:_e,annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,legend:Ne,legendPosition:Be,legendLayout:De,legendHoverBehavior:Ee,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:Re,title:Fe,foregroundGraphics:We,backgroundGraphics:ze,decay:Ye,pulse:Ge,transition:qe,animate:Xe,staleness:Ve,thresholds:Ue,accessibleTable:Ke=!0,description:Qe,summary:Ze,orbitMode:Je,orbitSize:et,orbitSpeed:tt,orbitRevolution:nt,orbitRevolutionStyle:ot,orbitEccentricity:it,orbitShowRings:rt,orbitAnimated:at,customNetworkLayout:st,layoutConfig:lt}=n,ct=il.has(M)?ol:nl,ut=i(!0),dt=er({sizeProp:ye,responsiveWidth:ve,responsiveHeight:be,userMargin:xe,marginDefault:ct,foregroundGraphics:We,backgroundGraphics:ze,animate:Xe,transitionProp:qe,themeDirtyRef:ut}),{reducedMotionRef:ht,responsiveRef:ft,size:pt,margin:yt,adjustedWidth:mt,adjustedHeight:vt,resolvedForeground:bt,resolvedBackground:xt,transition:kt,introEnabled:wt,tableId:At,rafRef:St,renderFnRef:Ot,scheduleRender:Ct,currentTheme:jt}=dt,Mt=oi(),Pt=si(),_t=r(()=>me(P),[P]),Lt=r(()=>Array.isArray(_)?me(_):_,[_]),Tt=r(()=>Object.assign(Object.assign({},va),te),[te]),$t=r(()=>Object.assign(Object.assign({},ba),oe),[oe]),Nt=r(()=>{var e;return{chartType:M,nodeIDAccessor:$,sourceAccessor:N,targetAccessor:B,valueAccessor:D,edgeIdAccessor:E,childrenAccessor:I,hierarchySum:R,orientation:F,nodeAlign:W,nodePaddingRatio:z,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Tt,showParticles:ne,particleStyle:$t,nodeStyle:ie,edgeStyle:re,nodeLabel:ge,showLabels:fe,labelMode:pe,colorBy:ae,colorScheme:se,themeCategorical:null===(e=null==jt?void 0:jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(jt),edgeColorBy:le,edgeOpacity:ce,colorByDepth:ue,nodeSize:de,nodeSizeRange:he,decay:Ye,pulse:Ge,transition:kt,introAnimation:wt,staleness:Ve,thresholds:Ue,orbitMode:Je,orbitSize:et,orbitSpeed:tt,orbitRevolution:nt,orbitRevolutionStyle:ot,orbitEccentricity:it,orbitShowRings:rt,orbitAnimated:at,customNetworkLayout:st,layoutConfig:lt}},[M,$,N,B,D,I,R,F,W,z,Y,G,q,X,V,U,K,Q,Z,J,ee,Tt,ne,$t,ie,re,ge,fe,pe,ae,se,le,ce,ue,de,he,Ye,Ge,null==kt?void 0:kt.duration,null==kt?void 0:kt.easing,wt,Ve,Ue,Je,et,tt,nt,ot,it,rt,at,jt,st,lt]),Bt=ci(Nt),Dt=ci({chartType:M,nodeIDAccessor:$,sourceAccessor:N,targetAccessor:B,valueAccessor:D,childrenAccessor:I,hierarchySum:R,orientation:F,nodeAlign:W,nodePaddingRatio:z,nodeWidth:Y,iterations:G,forceStrength:q,padAngle:X,groupWidth:V,sortGroups:U,edgeSort:K,treeOrientation:Q,edgeType:Z,padding:J,paddingTop:ee,tensionConfig:Tt,orbitMode:Je,orbitSize:et,orbitEccentricity:it,customNetworkLayout:st,layoutConfig:lt}),Et=i(null),It=i(0),Ht=i(0),Rt=i(!1),Wt=i(null);Wt.current||(Wt.current=new Hs(Bt));const[zt,Yt]=d(null),[Gt,qt]=d(0),[Xt,Vt]=d(0),[Ut,Kt]=d(!1),[Qt,Zt]=d(null),Jt=i(null),en=i(new Map),nn=i(0),on=l(e=>{if("function"==typeof ae)return ae(e)+"";if("string"==typeof ae&&e.data){const t=e.data[ae];if(void 0!==t){if(!en.current.has(t+"")){const e=Array.isArray(se)?se:gt;en.current.set(t+"",e[nn.current++%e.length])}return en.current.get(t+"")}}if(en.current.has(e.id))return en.current.get(e.id);const t=Array.isArray(se)?se:gt,n=ae?t[nn.current++%t.length]:t[0];return en.current.set(e.id,n),n},[ae,se]),rn=(null===(s=null==jt?void 0:jt.colors)||void 0===s?void 0:s.border)||(null===(c=null==jt?void 0:jt.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==jt?void 0:jt.colors)||void 0===u?void 0:u.primary)||"#999",an=l(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Wt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),sn=l(e=>{if("function"==typeof le)return le(e);const t=an(e.source),n=an(e.target);return"target"===le&&n?on(n):t?on(t):rn},[le,on,rn,an]),ln=l(e=>{if("function"==typeof $t.color){const t=an(e.source);return t?$t.color(e,t):rn}if(!(null==oe?void 0:oe.colorBy))return sn(e);const t=$t.colorBy,n=an(e.source),o=an(e.target);return"target"===t&&o?on(o):n?on(n):rn},[null==oe?void 0:oe.colorBy,$t.color,$t.colorBy,on,sn,rn,an]),cn=("sankey"===M||!!st)&&ne||!!Ge||null!==(g=null===(h=Wt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;a(()=>{var e;null===(e=Wt.current)||void 0===e||e.updateConfig(Bt),ut.current=!0,Ct()},[Bt,Ct]);const un=l(()=>{var e,t;Zt(null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);a(()=>{var e;const t=Wt.current;if(t){t.buildScene([mt,vt]),un();for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);ut.current=!0,Ct()}},[jt,mt,vt,Ct,un]);const dn=l(()=>{var e;const t=Wt.current;if(!t)return;t.runLayout([mt,vt]),t.buildScene([mt,vt]),un(),ut.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);const n=Array.isArray(se)?se:gt,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];en.current.has(t.id)||en.current.set(t.id,n[e%n.length])}if(nn.current=o.length,qt(t.layoutVersion),_e){const{nodes:e,edges:n}=t.getLayoutData();_e(e,n)}},[mt,vt,_e,se,un]),hn=l(e=>{if(null==e||"object"!=typeof e)return;const t=Wt.current;t&&(t.ingestEdge(e)&&dn(),Ct())},[dn,Ct]),gn=l(e=>{const t=Wt.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&dn(),Ct()},[dn,Ct]),fn=l(()=>{var e;null===(e=Wt.current)||void 0===e||e.clear(),en.current.clear(),nn.current=0,qt(0),Yt(null),Jt.current=null,ut.current=!0,Ct()},[Ct]),pn=l(()=>{const e=Wt.current;e&&(e.tension+=999,dn(),Ct())},[dn,Ct]);p(o,()=>({push:hn,pushMany:gn,removeNode:e=>{var t,n,o;const i=null!==(n=null===(t=Wt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(i){const t=(null===(o=Jt.current)||void 0===o?void 0:o.data)?"function"==typeof $?$(Jt.current.data):Jt.current.data[$]:void 0;Jt.current&&"node"===Jt.current.nodeOrEdge&&t===e&&(Jt.current=null,Yt(null)),en.current.delete(e),dn(),ut.current=!0,Ct()}return i},removeEdge:(e,t)=>{var n,o;const i=null!==(o=null===(n=Wt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(i){if(Jt.current&&"edge"===Jt.current.nodeOrEdge){const n=Jt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!E||!n||("function"==typeof E?E:e=>null==e?void 0:e[E])(n)===e,o&&(Jt.current=null,Yt(null))}dn(),ut.current=!0,Ct()}return i},updateNode:(e,t)=>{var n,o;const i=null!==(o=null===(n=Wt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return i&&(ut.current=!0,Ct()),i},updateEdge:(e,t,n)=>{var o,i;const r=null!==(i=null===(o=Wt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==i?i:[];return r.length>0&&(dn(),ut.current=!0,Ct()),r},clear:fn,getTopology:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Wt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:pn,getTension:()=>{var e,t;return null!==(t=null===(e=Wt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[hn,gn,fn,pn,dn,Ct]);const yn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(M),mn=yn?L||(Array.isArray(_)?void 0:_):void 0;a(()=>{var e;const t=Wt.current;if(t)if(yn&&mn)t.ingestHierarchy(mn,[mt,vt]),t.buildScene([mt,vt]),un(),ut.current=!0,Ct();else{const n=_t,o=Array.isArray(Lt)?Lt:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[mt,vt]),t.buildScene([mt,vt]),un();for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill+"");const i=Array.isArray(se)?se:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];en.current.has(t.id)||en.current.set(t.id,i[e%i.length])}nn.current=r.length,ut.current=!0,Ct()}},[_t,Lt,L,mn,yn,mt,vt,Dt,Ct,se,un]),a(()=>{T&&T.length>0&&gn(T)},[]);const vn=l(e=>{if(Ce&&Ce(e),Me){const t=Date.now();Me(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[Ce,Me,Pe]),bn=l(e=>{if(je&&je(e),Me){const t=Date.now();Me(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[je,Me,Pe]),{hoverHandlerRef:An,hoverLeaveRef:On,onPointerMove:jn,onPointerLeave:Mn}=dt;An.current=e=>{if(!Se)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-yt.left,i=e.clientY-n.top-yt.top;if(0>o||o>mt||0>i||i>vt)return void(Jt.current&&(Jt.current=null,Yt(null),vn&&(vn(null),ut.current=!0),Ct()));const r=Wt.current;if(!r)return;const a=zs(r.sceneNodes,r.sceneEdges,o,i);if(!a)return void(Jt.current&&(Jt.current=null,Yt(null),vn&&(vn(null),ut.current=!0),Ct()));const s=Fi(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Jt.current=s,Yt(s),vn&&(vn(s),ut.current=!0),Ct()},On.current=()=>{Jt.current&&(Jt.current=null,Yt(null),vn&&(vn(null),ut.current=!0),Ct())};const Pn=i(()=>{});Pn.current=e=>{if(!je&&!Me)return;const t=Et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-yt.left,i=e.clientY-n.top-yt.top;if(0>o||o>mt||0>i||i>vt)return;const r=Wt.current;if(!r)return;const a=zs(r.sceneNodes,r.sceneEdges,o,i);bn(a?Fi(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const _n=l(e=>Pn.current(e),[]),Ln=i(-1),Tn=i(null),$n=i(-1),Nn=l(e=>{var t;const n=Wt.current;if(!n)return;const o=function(e){var t,n,o,i,r,a;const s=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;s.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const i=xn(o),r=Ln.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Ln.current=0,$n.current=-1;const t=i.flat[0];Tn.current={shape:t.shape,w:t.w,h:t.h};const n=Fi(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Jt.current=n,Yt(n),vn&&(vn(n),ut.current=!0),void Ct()}const a=kn(i,r),s=function(e,t,n,o,i){var r,a,s;const l=n.flat[t.flatIndex];if(!l)return wn(e,t,n);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,i=1/0;for(let r=0;e.flat.length>r;r++){const a=e.flat[r];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;i>u&&(i=u,o=r)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(i.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n;const o=e+"",i=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,r=Sn(t.source),a=Sn(t.target),s=null!=r,l=null!=a;s&&r+""===o&&l?i.push(a+""):l&&a+""===o&&s&&i.push(r+"")}return i}(c,o);if(0===e.length)return t.flatIndex;const r=null!==(s=n.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==s?s:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const o=wn(e,t,n);return null!==o&&o!==t.flatIndex&&(i.current=-1),o}}}(e.key,a,i,null!==(t=n.sceneEdges)&&void 0!==t?t:[],$n);if(null===s)return;if(e.preventDefault(),0>s)return Ln.current=-1,Tn.current=null,$n.current=-1,Jt.current=null,Yt(null),vn&&(vn(null),ut.current=!0),void Ct();Ln.current=s;const l=i.flat[s];Tn.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Jt.current=c,Yt(c),vn&&(vn(c),ut.current=!0),Ct()},[vn,Ct]),Bn=l(e=>{Ln.current=-1,Tn.current=null,jn(e)},[jn]);Ot.current=()=>{var e,t,n,o,i,r,a;St.current=0;const s=Et.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=Wt.current;if(!c)return;const u=performance.now(),d=It.current?Math.min((u-It.current)/1e3,.1):.016;It.current=u;const h=c.advanceTransition(ht.current?u+1e6:u),g=!ht.current&&h,f=!ht.current&&c.tickAnimation([mt,vt],d);(h||ut.current||f)&&c.buildScene([mt,vt]);const p=nr();if(!tr(s,pt,yt,p))return;if(l.clearRect(-yt.left,-yt.top,pt[0],pt[1]),Ae){const e=tn(l,Ae);e&&(l.fillStyle=e,l.fillRect(0,0,mt,vt))}Ye&&c.applyDecay(),Ge&&c.applyPulse(u),Ue&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Ve?void 0:Ve.threshold)&&void 0!==e?e:5e3,m=Ve&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ve?void 0:Ve.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Zs(e,n);break;case"line":Js(e,n);break;case"ribbon":el(e,n);break;case"curved":tl(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),sr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),lr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,i;for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),ne&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var i,r;const a=null!==(i=o.spawnRate)&&void 0!==i?i:ba.spawnRate,s=null!==(r=o.maxPerEdge)&&void 0!==r?r:ba.maxPerEdge;for(let o=0;t.length>o;o++){const i=t[o];if(!i.bezier)continue;if(e.countForEdge(o)>=s)continue;const r=i.value*a*n*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,$t);const t=.5*(null!==(n=$t.speedMultiplier)&&void 0!==n?n:1);let o;if($t.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,i){var r,a;const s=null!==(r=o.radius)&&void 0!==r?r:ba.radius,l=null!==(a=o.opacity)&&void 0!==a?a:ba.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const a=t.particles[r];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:i(l),e.fillStyle=tn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,$t,ln)}}m&&(l.globalAlpha=1);const v=ut.current;if(ut.current=!1,v||g||f){const e=Et.current;e&&e.setAttribute("aria-label",vi(null!==(i=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==i?i:0,null!==(a=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==a?a:0,"Network chart"))}const b=v||g||f||Rt.current;b&&u-Ht.current>=33?(Vt(e=>e+1),Ht.current=u,Rt.current=!1):Rt.current=!!b,(cn||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Rt.current)&&(St.current=requestAnimationFrame(()=>Ot.current()))},li({hydrated:Mt,wasHydratingFromSSR:Pt,storeRef:Wt,dirtyRef:ut,renderFnRef:Ot}),a(()=>{ut.current=!0,Ct()},[M,mt,vt,Ae,Ct]),Cn(Ve,Wt,ut,Ct,Ut,Kt);const Dn=Se&&zt?e(Ui,{x:zt.x,y:zt.y,containerWidth:mt,containerHeight:vt,margin:yt,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(zt):e(sl,{data:zt})}):null;if(ti||!Mt&&Pt){const n=Wt.current;if(n){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(M),t=e?L||(Array.isArray(_)?void 0:_):void 0;if(e&&t)n.ingestHierarchy(t,[mt,vt]),n.buildScene([mt,vt]);else{const e=_t,t=Array.isArray(Lt)?Lt:[];(e.length>0||t.length>0)&&(n.ingestBounded(e,t,[mt,vt]),n.buildScene([mt,vt]))}}const o=null!==(f=null==n?void 0:n.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==n?void 0:n.sceneEdges)&&void 0!==y?y:[],r=null!==(m=null==n?void 0:n.labels)&&void 0!==m?m:[];return t("div",{ref:ft,className:"stream-network-frame"+(we?" "+we:""),role:"img","aria-label":Qe||("string"==typeof Fe?Fe:"Network chart"),style:{position:"relative",width:ve?"100%":pt[0],height:be?"100%":pt[1]},children:[e(Bi,{summary:Ze}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:pt[0],height:pt[1],style:{position:"absolute",left:0,top:0},children:[xt&&e("g",{transform:`translate(${yt.left},${yt.top})`,children:xt}),t("g",{transform:`translate(${yt.left},${yt.top})`,children:[Ae&&e("rect",{x:0,y:0,width:mt,height:vt,fill:Ae}),i.map((t,n)=>function(t,n){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+n);case"bezier":{const o=t;return e("path",{d:o.pathD,fill:Jo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"ribbon":{const o=t;return e("path",{d:o.pathD,fill:Jo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"curved":{const o=t;return e("path",{d:o.pathD,fill:Jo(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+n)}default:return null}}(t,n)).filter(Boolean),o.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:Jo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+n)}case"rect":{const o=t;return e("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Jo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,i=H().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Zo)||"";return e("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Jo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+n)}(t,n)).filter(Boolean)]})]}),e(Ks,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,labels:r,sceneNodes:o,title:Fe,legend:Ne,legendPosition:Be,legendLayout:De,legendHoverBehavior:Ee,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Ft(bt,null===(v=Wt.current)||void 0===v?void 0:v.customLayoutOverlays),annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,annotationFrame:0})]})}const En=Wt.current;return t("div",{ref:ft,className:"stream-network-frame"+(we?" "+we:""),role:"group","aria-label":Qe||("string"==typeof Fe?Fe:"Network chart"),tabIndex:0,style:{position:"relative",width:ve?"100%":pt[0],height:be?"100%":pt[1],overflow:"visible"},onKeyDown:Nn,children:[Ke&&e(Di,{tableId:At}),Ke&&e(Ni,{nodes:null!==(b=null==En?void 0:En.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==En?void 0:En.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:At,chartTitle:"string"==typeof Fe?Fe:void 0}),e(Bi,{summary:Ze}),e(Ei,{hoverPoint:zt}),t("div",{role:"img","aria-label":Qe||("string"==typeof Fe?Fe:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?Bn:void 0,onMouseLeave:Se?Mn:void 0,onClick:je||Me?_n:void 0,children:[xt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:pt[0],height:pt[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${yt.left},${yt.top})`,children:xt})}),e("canvas",{ref:Et,"aria-label":vi(null!==(w=null===(k=null==En?void 0:En.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==En?void 0:En.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Ks,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,labels:(null==En?void 0:En.labels)||[],sceneNodes:null==En?void 0:En.sceneNodes,title:Fe,legend:Ne,legendPosition:Be,legendLayout:De,legendHoverBehavior:Ee,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:Re,foregroundGraphics:Ft(bt,Qt),annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,annotationFrame:Xt}),e(Hi,{active:Ln.current>=0,hoverPoint:zt,margin:yt,size:pt,shape:null===(O=Tn.current)||void 0===O?void 0:O.shape,width:null===(C=Tn.current)||void 0===C?void 0:C.w,height:null===(j=Tn.current)||void 0===j?void 0:j.h}),Dn,(null==Ve?void 0:Ve.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ve.badgePosition?{top:4,left:4}:"bottom-left"===Ve.badgePosition?{bottom:4,left:4}:"bottom-right"===Ve.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Ut?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Ut?"STALE":"LIVE"})]})]})});function cl(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function ul(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:a,linkedHoverInClickPredicate:s=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(s?n||o||t:n||o)&&(l.customClickBehavior=a),l}function dl(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Vi(t)||n}}function hl(e){return"string"==typeof e?e:"value"}function gl(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function fl(e,t){if(!t)return gl(e);try{const n=t(e);return null==n?gl(e):n}catch(t){return gl(e)}}function pl(e,t){return"function"==typeof t?t(e):e[t]}function yl(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function ml(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const a=o?fl(pl(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:Wi,children:[null!=a&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:a}),i.map((n,o)=>{const i=fl(pl(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function vl({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:a=!1,valueFormat:s}){return l=>{var c;const u=a?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=pl(u,n),h=pl(u,o),g=i?pl(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:Wi,children:[e("div",{style:{fontWeight:"bold"},children:gl(d)}),e("div",{style:{marginTop:4},children:fl(h,s)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||hl(i),": ",gl(g)]})]})}}ll.displayName="StreamNetworkFrame";const bl=u(null);function xl({colors:t,categories:n,colorScheme:o="category10",children:i}){const a=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:ht[o]||gt,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(bl.Provider,{value:a,children:i})}function kl(){return s(bl)}function wl(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 Al(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(wl(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Sl(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}xl.displayName="CategoryColorProvider";const[Ol,Cl]=be(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Sl(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=Sl(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}})}})),[jl,Ml]=be(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 Pl(e){const t=f(),n=e.clientId||t,{name:o}=e,i=Cl(e=>e.selections.get(o)),a=Cl(e=>e.setClause),s=Cl(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?Al(i,n):()=>!0,[i,n]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:l(()=>{s(o,n)},[s,o,n]),clientId:n}}function _l(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:a}=Pl({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,a,t]),predicate:o,isActive:i}}function Ll(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Tl(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=Pl({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Ll(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Ll(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&s(t)},[u,n,o,s,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function $l(e,t,n){const o=Cl(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=Al(o,n);return e.filter(t)},[e,o,n])}function Nl(e={}){const{limit:t=50,types:n,chartId:o}=e,i=Ml(e=>e.version),a=Ml(e=>e.observations),s=Ml(e=>e.clearObservations),l=r(()=>{let e=a;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[a,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const Bl=u(!1),Dl=u(null),El="undefined"==typeof window?a:h;function Il(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Hl(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 Rl(e){const t=s(Dl),n=f(),o=Il(e),r=i([]);Hl(r.current,o)||(r.current=o);const a=r.current;El(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),El(()=>{t&&t.registerCategories(n,a)},[t,n,a])}function Fl({selections:e}){const t=Cl(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Wl({categoryColors:t,interaction:n,selectionName:o,field:s}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=_l({name:o,fields:[s]}),f=Pl({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,a(()=>{"isolate"===n&&(p.size>0?b.current({[s]:Array.from(p)}):x.current())},[n,p,s]);const k=l(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[s]:e.label})):(v(null),g.onHover(null)))},[n,s,g]),w=l(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[S]]=Qi([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e($n,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function zl({children:n,selections:o,showLegend:a,legendPosition:s="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:u="category"}){const h=kl(),[g,f]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=Il(t);f(t=>{var o;return Hl(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(g))for(const n of t)e.push(n);return Il(e)},[g]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=gt[o%gt.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===a||a,x=b&&Object.keys(v).length>0;return e(Ol,{children:t(jl,{children:[o&&e(Fl,{selections:o}),e(Dl.Provider,{value:y,children:e(xl,{colors:v,children:t(Bl.Provider,{value:x,children:[b&&"top"===s&&e(Wl,{categoryColors:v,interaction:l,selectionName:c,field:u}),n,b&&"bottom"===s&&e(Wl,{categoryColors:v,interaction:l,selectionName:c,field:u})]})})})]})})}function Yl({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const a=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=a?o(a,t,n):n?n(i):ft[r%ft.length];return{label:i+"",color: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,label:""}]}}function Gl(e){return e?"string"==typeof e?{name:e}:e:null}function ql(e,t,n){return t?(o,...i)=>{var r;const a=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(a,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(a,n.unselectedStyle)}return a}:e}const Xl=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Vl={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Ul={light:Se,dark:Oe,"high-contrast":Ce,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#c05050",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#8b5cf6",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Kl(e){return Ul[e]}function Ql(e,t=":root"){var n,o,i,r,a;const s=[];return s.push(` --semiotic-bg: ${e.colors.background};`),s.push(` --semiotic-text: ${e.colors.text};`),s.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),s.push(` --semiotic-grid: ${e.colors.grid};`),s.push(` --semiotic-border: ${e.colors.border};`),s.push(` --semiotic-primary: ${e.colors.primary};`),s.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&s.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&s.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&s.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&s.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&s.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&s.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&s.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&s.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(a=e.tooltip)||void 0===a?void 0:a.shadow)&&s.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&s.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&s.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&s.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&s.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&s.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&s.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&s.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),s.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),s.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&s.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&s.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&s.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&s.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&s.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${s.join("\n")}\n}`}function Zl(e){var t,n,o,i,r,a;return{semiotic: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({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.text)||e.colors.text,$type:"color"},radius:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(a=e.colors.selectionOpacity)&&void 0!==a?a:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}}const Jl=o.createContext(void 0),ec="undefined"==typeof window?o.useEffect:o.useLayoutEffect;function tc(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Kl(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function nc({theme:e}){const t=Pe(e=>e.setTheme),n=Pe(e=>e.theme),i=o.useRef(n);i.current=n;const r=o.useRef(null);o.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(r.current=i.current===Ce?Se:i.current,t("high-contrast")),Ki(n,e=>{var n,o;e.matches?(r.current=i.current===Ce?null!==(n=r.current)&&void 0!==n?n:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===Ce?"high-contrast":t)}(t,null!==(o=r.current)&&void 0!==o?o:Se),r.current=null)})},[e,t]);const a=o.useRef(!1);return ec(()=>{a.current?void 0!==e&&t(tc(e)):a.current=!0},[e,t]),null}function oc({children:t}){var n,i,r,a,s;const l=Pe(e=>e.theme),c=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({position:"relative","--semiotic-bg":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-cell-border":l.colors.cellBorder||l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(n=l.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),null!=l.typography.tickSize?{"--semiotic-tick-font-size":l.typography.tickSize+"px"}:{}),null!=l.typography.labelSize?{"--semiotic-axis-label-font-size":l.typography.labelSize+"px"}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=o.useContext(Jl),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function ic({theme:n,children:i}){const r="string"==typeof n&&Kl(n)?n:void 0,a=o.useMemo(()=>function(e){return void 0!==e?je(Se,tc(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ce:Se}(n),[n]);return e(Me,{initialState:{theme:a},children:t(Jl.Provider,{value:r,children:[e(nc,{theme:n}),e(oc,{children:i})]})})}function rc(){return Pe(e=>e.theme)}const ac="#007bff";function sc(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 lc(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 cc(){var e;const t=rc(),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 uc(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=ht[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:ac}function dc(e,t,n){const o=kl(),i=cc();return r(()=>{var r;if(!t)return;const a=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=vt(n.map(e=>({_cat:e})),"_cat",a);return t=>o[t]||e(t)}return vt(n.map(e=>({_cat:e})),"_cat",a)}if(o&&Object.keys(o).length>0){const n=vt(e,t,a);return e=>o[e]||n(e)}return vt(e,t,a)}if(o&&Object.keys(o).length>0){const e=vt([{_:"a"}],"_",a);return t=>o[t]||e(t)}},[e,t,n,o,i])}function hc(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}function gc({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:s,chartId:c,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||g||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=Pl({name:(null==e?void 0:e.name)||"__unused__"}),b=_l({name:(null==y?void 0:y.name)||"hover",fields:m}),x=Ml(e=>e.pushObservation),k=e?{isActive:v.isActive,predicate:v.predicate}:null,[w,A]=d(null),S=g||n[0],O=r(()=>{if(!h||null==w||!S)return null;const e=w,t=S;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,S]),C=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=sc(e,t,y.xField);null!=n&&function(e,t,n){const o=jo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(jo={positions:new Map(jo.positions).set(e,{xValue:t,sourceId:n})},Po())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&_o(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&S)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[S];A(null!=n?n+"":null)}else A(null);if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const r=lc(e),a=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),x&&x(e)}}},[t,b,y,p,i,s,c,x,h,S]),j=l(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=sc(e,t,y.xField);null!=n&&function(e,t,n){const o=jo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(jo.positions);return t.delete(e),jo={positions:t},Po(),!1}jo={positions:new Map(jo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Po()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const n=lc(e),a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),x&&x(e)}}},[u,i,x,s,c,y,p]);return a(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Lo(e,p),_o(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:k,hoverSelectionHook:O,customHoverBehavior:C,customClickBehavior:j,crosshairSourceId:p}}function fc(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 pc({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(Bl),d=null!==s(Dl),h=void 0!==o?o:!u&&!!t,g=!!t&&(h||d),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[c,t,e,g]);Rl(d&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=Yl({data:e,colorBy:t,colorScale:n,getColor:mt,categories:f}),i=o.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,a,p,i]);return{legend:p,margin:y,legendPosition:i}}function yc(e,t,n){const[o,i]=d(null),[a,s]=d(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=l(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,o,a]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const mc={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 vc(e,t,n){var o,i,r,a,s,l,c;const u=mc[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!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!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:bc(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function bc(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 xc({componentName:n,message:o,diagnosticHint:i,width:r,height:a}){return e("div",{role:"alert",style:{width:r,height:Math.max(a,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class kc extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(xc,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var wc;const Ac="undefined"!=typeof process&&"production"!==(null===(wc=process.env)||void 0===wc?void 0:wc.NODE_ENV);function Sc({componentName:t,width:n,height:o,children:i}){return e(kc,{fallback:i=>e(xc,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Oc={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"},Cc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function jc(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Oc),{width:n,height:o}),children:i||"No data available"}):null}function Mc(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),a=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(a+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Cc),{position:"absolute",top:l+o*(a+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:a,opacity:.5+o%2*.2})},o))})}function Pc(e,t,n,o){if(!Ac)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 _c(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 a=1;o>=a;a++){const o=i[a];i[a]=e[r-1]===t[a-1]?n:1+Math.min(n,i[a],i[a-1]),n=o}}return i[o]}function Lc(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Tc(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=_c(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 $c({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=Lc(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=Tc(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Nc({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}function Bc({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=Lc(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=Tc(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Dc(e){const t=Pe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Ec(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:a,legendPosition:s,selection:c,linkedHover:u,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:S,width:O,height:C}=e,j=void 0===n,M=r(()=>me(t),[t]),[P,_]=d([]),L=l(e=>{_(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:$,hoverSelectionHook:N,customHoverBehavior:B,customClickBehavior:D,crosshairSourceId:E}=gc({selection:c,linkedHover:u,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:T}),I=fc(u,E),H=dc(M,o,i),R=r(()=>{if(!o)return[];const e=new Set;for(const t of M){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[M,o]),F=r(()=>j&&P.length>0?P:R,[j,P,R]),W=yc(a,o,F),z=r(()=>N||(W.legendSelectionHook?W.legendSelectionHook:$),[N,W.legendSelectionHook,$]),Y=Dc(c),G=cc(),q=kl(),X=r(()=>{if(H)return H;if(!o||0===F.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:ft,t="__streamCat",n=vt(F.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[H,o,F,i,G,q]),{legend:V,margin:U,legendPosition:K}=pc({data:M,colorBy:o,colorScale:X,showLegend:m,legendPosition:s,userMargin:v,defaults:b,categories:F}),Q=r(()=>{const e={};return V&&(e.legend=V,e.legendPosition=K),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[V,K,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,j,o,L]),Z=Array.isArray(n)?me(n):n,J=Mc(w,O,C,A),ee=J?null:jc(Z,O,C,S);return{data:M,colorScale:H,allCategories:F,legendState:W,effectiveSelectionHook:z,activeSelectionHook:$,customHoverBehavior:B,customClickBehavior:D,legend:V,margin:U,legendPosition:K,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:I,resolvedSelection:Y}}function Ic(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,a;const s=Array.isArray(t)?t:[t],l=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 s){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(a=e.current)||void 0===a||a.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const a=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of a)null===(r=e.current)||void 0===r||r.push(n(t));return a},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const a=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of a)null===(r=n.current)||void 0===r||r.pushLine(t(e));return a},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Hc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Rc(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=mt(o,t,n)}}else u.fill=l?l(e):o||ac;return void 0===u.r&&(u.r=a?a(e):i),u},[t,n,o,i,a,s,l,c,p]),m=r(()=>Hc(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>ql(m,null!=g?g:null,f),[m,g,f])}function Fc(e){const{accessor:t,data:n,isPushMode:o}=e,a=i(null),[s,c]=d(0),u=l(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(a.current?(a.current[0]>i&&(a.current[0]=i,n=!0),i>a.current[1]&&(a.current[1]=i,n=!0)):(a.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=l(()=>{o&&(a.current=null,c(e=>e+1))},[o]),g=r(()=>{var e;if(o)return null!==(e=a.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,s=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>s&&(s=n))}return Number.isFinite(r)&&Number.isFinite(s)?[r,s]:void 0},[n,t,o,s]);return{domain:g,trackPushed:u,reset:h}}function Wc(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}function zc(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);o.length>i;i++)0>t.indexOf(o[i])&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function Yc(e,t,n,o){return new(n||(n=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Gc="__forecastSegment";let qc=null;function Xc(){return Yc(this,void 0,void 0,function*(){return qc||(qc=yield import("./semiotic-statisticalOverlays-C3DsOgr_.js")),qc})}const Vc="__semiotic_resolvedX",Uc="__semiotic_resolvedY";function Kc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:s,anomaly:l,groupBy:c}=e,u="string"==typeof n?n:Vc,h="string"==typeof o?o:Uc,g=r(()=>{if(!s&&!l)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[Vc]=n(t)),i&&(r[Uc]=o(t)),r}):t},[t,s,l,n,o]),[f,p]=d(null),[y,m]=d([]),v=i(s),b=i(l);return a(()=>{if(!s&&!l)return void((v.current||b.current)&&(p(null),m([]),v.current=s,b.current=l));let e=!1;const t=s!==v.current||l!==b.current;if(v.current=s,b.current=l,t&&(p(null),m([])),s){const t=c&&"string"==typeof c&&"object"==typeof s?Object.assign(Object.assign({},s),{_groupBy:c}):s;(function(...e){return Yc(this,void 0,void 0,function*(){return(yield Xc()).buildForecast(...e)})})(g,u,h,t,l).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else l&&function(...e){return Yc(this,void 0,void 0,function*(){return(yield Xc()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[g,s,l,u,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:u,yAccessorKey:h}}const Qc=g(function(t,n){const a=i(null),s=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:S,marginalGraphics:O,pointIdAccessor:C,annotations:j,regression:M,forecast:P,anomaly:_,xExtent:L,yExtent:T,frameProps:$={},selection:N,linkedHover:B,linkedBrush:D,onObservation:E,onClick:I,hoverHighlight:H,chartId:R,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,color:q,stroke:X,strokeWidth:V,opacity:U}=t,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:ie,xLabel:re,yLabel:ae}=s,se=r(()=>me(c),[c]),le=void 0===c,{domain:ce,trackPushed:ue,reset:de}=Fc({accessor:x,data:se,isPushMode:le}),he=l(e=>{var t;ue([e]),null===(t=a.current)||void 0===t||t.push(e)},[ue]),ge=l(e=>{var t;ue(e),null===(t=a.current)||void 0===t||t.pushMany(e)},[ue]);Ic(n,{variant:"xy",frameRef:a,overrides:{push:he,pushMany:ge,clear:()=>{var e;de(),null===(e=a.current)||void 0===e||e.clear()}},deps:[he,ge,de]});const fe=Ec({data:se,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:N,linkedHover:B,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:E,onClick:I,hoverHighlight:H,chartType:"Scatterplot",chartId:R,showLegend:ee,userMargin:u,marginDefaults:s.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:K,height:Q}),pe=Gl(D),ye=Tl({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof f?f:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof p?p:void 0)}),ve=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,be=o.useRef(ye.brushInteraction);be.current=ye.brushInteraction;const xe=l(e=>{const t=be.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Pc("Scatterplot",se,"xAccessor",f),Pc("Scatterplot",se,"yAccessor",p);const ke=r(()=>x?null!=ce?ce:[0,1]:void 0,[x,ce]),we=r(()=>x?e=>bt(e,x,k,ke):void 0,[x,k,ke]),Ae=Rc({colorBy:v,colorScale:fe.colorScale,color:q,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:X,strokeWidth:V,opacity:U,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Se=r(()=>ml([{label:re||hl(f),accessor:f,role:"x",format:h},{label:ae||hl(p),accessor:p,role:"y",format:g},...v?[{label:hl(v),accessor:v,role:"color"}]:[],...x?[{label:hl(x),accessor:x,role:"size"}]:[]]),[f,p,re,ae,v,x,h,g]),{effectiveData:Oe,statisticalAnnotations:Ce}=Kc({data:se,xAccessor:f,yAccessor:p,forecast:P,anomaly:_}),je=r(()=>{const e=Wc(M);return e||0!==Ce.length?[...e?[e]:[],...j||[],...Ce]:j},[M,j,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const Me=$c({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(Me)return e(xc,{componentName:"Scatterplot",message:Me,width:K,height:Q});const 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({chartType:"scatter"},null!=c&&{data:Oe}),{xAccessor:f,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[K,Q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,xLabel:re,yLabel:ae,xFormat:h,yFormat:g,enableHover:Z,showGrid:J}),fe.legendBehaviorProps),cl({title:te,description:ne,summary:oe,accessibleTable:ie,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:S,defaultTooltipContent:Se})),ul({linkedHover:B,onObservation:E,onClick:I,hoverHighlight:H,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior})),O&&{marginalGraphics:O}),C&&{pointIdAccessor:C}),je&&je.length>0&&{annotations:je}),L&&{xExtent:L}),T&&{yExtent:T}),pe&&{brush:{dimension:ve},onBrush:xe}),fe.crosshairProps),$);return e(Sc,{componentName:"Scatterplot",width:K,height:Q,children:e($r,Object.assign({ref:a},Pe))})});function Zc(e,t){return Je(1===t?.5:e/(t-1))}Qc.displayName="Scatterplot";const Jc=g(function(t,o){var a,s;const l=i(null);Ic(o,{variant:"xy",frameRef:l});const c=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:S,anomaly:O,xExtent:C,yExtent:j,frameProps:M={},selection:P,linkedHover:_,onObservation:L,onClick:T,hoverHighlight:$,chartId:N,loading:B,loadingContent:D,emptyContent:E,legendInteraction:I,stroke:H,strokeWidth:R,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,title:q,description:X,summary:V,accessibleTable:U,xLabel:K,yLabel:Q}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);Pc("ConnectedScatterplot",J,"xAccessor",p),Pc("ConnectedScatterplot",J,"yAccessor",y);const te=Ec({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:P,linkedHover:_,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:$,chartType:"ConnectedScatterplot",chartId:N,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:B,loadingContent:D,emptyContent:E,width:W,height:z}),ne=null!==(s=null===(a=te.resolvedSelection)||void 0===a?void 0:a.unselectedOpacity)&&void 0!==s?s:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const a=t.filter(e=>"point"===e.type);if(2>a.length)return;const s=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,l=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>a.length,u=a.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=a[t],o=a[t+1],d=Zc(t,u),h=!s||!l||l(null!==(i=n.datum)&&void 0!==i?i:n)||l(null!==(r=o.datum)&&void 0!==r?r:o),g=s?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,a;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const l=s.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const n=s[t],o=s[t+1],i=Zc(t,l),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(a=o.style)||void 0===a?void 0:a.opacity)?o.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:u})},[b]),ae=r(()=>[re],[re]),se=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?Zc(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),le=Rc({colorScale:void 0,baseStyleExtras:se,stroke:H,strokeWidth:R,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>ml([{label:K||hl(p),accessor:p,role:"x",format:g},{label:Q||hl(y),accessor:y,role:"y",format:f},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,K,Q,m,ce,g,f]),de=$c({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:ge}=Kc({data:J,xAccessor:p,yAccessor:y,forecast:S,anomaly:O});if(te.earlyReturn)return te.earlyReturn;const fe=Wc(A),pe=fe||ge.length>0?[...fe?[fe]:[],...w||[],...ge]:w,ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:le,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:Y,showGrid:G}),cl({title:q,description:X,summary:V,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:x,defaultTooltipContent:ue})),ul({linkedHover:_,onObservation:L,onClick:T,hoverHighlight:$,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:ae}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),j&&{yExtent:j}),te.crosshairProps),M);return de?e(xc,{componentName:"ConnectedScatterplot",message:de,width:W,height:z}):e(Sc,{componentName:"ConnectedScatterplot",width:W,height:z,children:e($r,Object.assign({ref:l},ye))})});function eu(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=r&&s.includes(r);let d;return a?d=a(e,r):n?o&&(d=mt(e,n,o)):d=i||ac,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[t,n,o,i,a,s,l]),p=r(()=>Hc(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return r(()=>ql(p,null!=h?h:null,g),[p,h,g])}Jc.displayName="ConnectedScatterplot";const tu=g(function(t,n){var o,s;const c=i(null);Ic(n,{variant:"xy",frameRef:c});const u=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:C=3,fillArea:j=!1,areaOpacity:M=.3,lineWidth:P=2,lineGradient:_,tooltip:L,pointIdAccessor:T,annotations:$,directLabel:N,gapStrategy:B="break",anomaly:D,forecast:E,band:I,xExtent:H,yExtent:R,frameProps:F={},selection:W,linkedHover:z,onObservation:Y,onClick:G,hoverHighlight:q,hoverRadius:X,chartId:V,loading:U,loadingContent:K,emptyContent:Q,legendInteraction:Z,legendPosition:J,xScaleType:ee,yScaleType:te,color:ne,stroke:oe,strokeWidth:ie,opacity:re}=t,{width:ae,height:se,enableHover:le,showGrid:ce,showLegend:ue,title:de,description:he,summary:ge,accessibleTable:fe,xLabel:pe,yLabel:ye}=u,ve=r(()=>me(h),[h]);Pc("LineChart",ve,"xAccessor",v),Pc("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=Kc({data:ve,xAccessor:v,yAccessor:b,forecast:E,anomaly:D,groupBy:x}),ke="__compoundGroup",we=!(!E||!x),Ae=we?ke:E?Gc:x,Se=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[Gc]||"observed"}`,n})},[be,we,x]),Oe=we?Se:be,Ce=w||x,je=r(()=>{if(!E)return;const e=E.upperBounds,t=E.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 a=be;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[E,be,b]),Me=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Pe=void 0!==(null===(o=Oe[0])||void 0===o?void 0:o[k]),_e=r(()=>{if(Pe)return Oe;if(Ae){const e=Oe.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[k]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[Gc]=t[Gc],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Oe}]},[Oe,Ae,k,Pe]),{gapProcessedLineData:Le,hasGaps:Te}=r(()=>{if("interpolate"===B){let e=!1;const t=[];for(const n of _e){const o=(n[k]||[]).filter(t=>!Me(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===B){let e=!1;const t=[];for(const n of _e){const o=n[k]||[];let i=[],r=0;const a=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const s of o)if(Me(s))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:i})),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===B){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of _e){const i=o[k]||[],r=[];for(const n of i)Me(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[k]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:_e,hasGaps:!1}},[_e,B,k,Me,Ae,b]),$e="object"==typeof N?N:{},Ne=$e.position||"end",Be=$e.fontSize||11,De=r(()=>{var e;if(!N||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Ne?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const a=r+"";""!==a&&n.add(a)}return Array.from(n)},[N,Ce,Le,k,Ne]),Ee=r(()=>{if(!N)return u.marginDefaults;const e=De.reduce((e,t)=>Math.max(e,t.length*(.6*Be)),0),t=e+10,n="end"===Ne?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[n]:Math.max(u.marginDefaults[n]||0,t)})},[N,De,Be,Ne,u.marginDefaults]),Ie=Ec({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:Z,legendPosition:J,selection:W,linkedHover:z,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:G,hoverHighlight:q,chartType:"LineChart",chartId:V,showLegend:(!N||void 0!==ue)&&ue,userMargin:g,marginDefaults:Ee,loading:U,loadingContent:K,emptyContent:Q,width:ae,height:se}),He=Ie.colorScale,Re=Ie.customHoverBehavior,Fe=Ie.customClickBehavior,We=Ie.crosshairProps,ze=eu({lineWidth:P,colorBy:Ce,colorScale:He,color:ne,fillArea:j,areaOpacity:M,stroke:oe,strokeWidth:ie,opacity:re,effectiveSelectionHook:Ie.effectiveSelectionHook,resolvedSelection:Ie.resolvedSelection}),[Ye,Ge]=d(null);a(()=>{if(!E)return void Ge(null);let e=!1;return function(...e){return Yc(this,void 0,void 0,function*(){return(yield Xc()).createSegmentLineStyle(...e)})}(ze,E).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[ze,E]);const qe=Ye||ze,Xe=r(()=>{if(O)return e=>{const t={r:C,fillOpacity:1};return Ce?He&&(t.fill=mt(e.parentLine||e,Ce,He)):t.fill=ne||ac,t}},[O,C,Ce,He,ne]),Ve=Array.isArray(j)?"mixed":j?"area":"line",Ue=r(()=>{var e;if(!N||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[k]||[];if(0===n.length)continue;const r="end"===Ne?n[n.length-1]:n[0],a=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==a)continue;const s=a+"";""===s||i.has(s)||i.set(s,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Ne?6:-6,dy:0,color:He?He(e):ac,fontSize:Be}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Be+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Be+2)}return r},[N,Ce,He,Le,k,v,b,Ne,Be]),Ke=Ie.margin,Qe=x||w,Ze=r(()=>ml([{label:pe||hl(v),accessor:v,role:"x",format:p},{label:ye||hl(b),accessor:b,role:"y",format:y},...Qe?[{label:hl(Qe),accessor:Qe,role:"group"}]:[],...yl(I,y)]),[v,b,pe,ye,Qe,p,y,I]),Je=$c({componentName:"LineChart",data:Pe?(null===(s=be[0])||void 0===s?void 0:s[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),et=r(()=>Pe||Ae||Te?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Oe,[Le,k,Pe,Ae,Oe,Te]),tt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ve},Array.isArray(j)&&{areaGroups:j}),_&&{lineGradient:_}),null!=X&&{hoverRadius:X}),null!=h&&{data:et}),{xAccessor:v,yAccessor:b,xScaleType:ee,yScaleType:te}),H&&{xExtent:H}),!R||null==R[0]&&null==R[1]?je?{yExtent:je}:{}:{yExtent:R}),{groupAccessor:"break"===B&&Te?"_gapSegment":Ae||void 0}),I&&{band:I}),{curve:S,lineStyle:qe}),O&&{pointStyle:Xe}),{size:[ae,se],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Ke,showAxes:u.showAxes,xLabel:pe,yLabel:ye,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{enableHover:le,showGrid:ce}),Ie.legendBehaviorProps),de&&{title:de}),he&&{description:he}),ge&&{summary:ge}),void 0!==fe&&{accessibleTable:fe}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?Xi():Vi(L)||Ze}),"multi"===L&&{tooltipMode:"multi"}),(z||Y||G||q)&&{customHoverBehavior:Re}),(Y||G||z)&&{customClickBehavior:Fe}),T&&{pointIdAccessor:T}),((null==$?void 0:$.length)||xe.length||Ue.length)&&{annotations:[...$||[],...xe,...Ue]}),We),F);return Ie.earlyReturn?Ie.earlyReturn:Je?e(xc,{componentName:"LineChart",message:Je,width:ae,height:se}):e(Sc,{componentName:"LineChart",width:ae,height:se,children:e($r,Object.assign({ref:c},tt))})});function nu(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:a,colorBy:s,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:S,yFormat:O,groupField:C}=e,j=void 0!==(null===(t=n[0])||void 0===t?void 0:t[a]),M=r(()=>{if(null==o)return[];if(!j&&!i)return n;let e;if(j)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[a]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][a].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[a]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,a,j]),P=r(()=>e=>{const t={};if(s){if(l){const n=mt(e,s,l);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||ac;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[s,l,c,p,y,m]),_=r(()=>Hc(P,{stroke:u,strokeWidth:d,opacity:h}),[P,u,d,h]);return{flattenedData:M,lineStyle:r(()=>ql(_,null!=g?g:null,f),[_,g,f]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return s?l&&(t.fill=mt(e.parentLine||e,s,l)):t.fill=c||ac,t}},[v,b,s,l,c]),defaultTooltipContent:r(()=>ml([{label:w||hl(x),accessor:x,role:"x",format:S},{label:A||hl(k),accessor:k,role:"y",format:O},...C?[{label:hl(C),accessor:C,role:"group"}]:[],...yl(e.band,O)]),[x,k,w,A,C,S,O,e.band])}}function ou(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}tu.displayName="LineChart";const iu=g(function(t,n){const o=i(null);Ic(n,{variant:"xy",frameRef:o});const a=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:C=!1,pointRadius:j=3,tooltip:M,annotations:P,forecast:_,anomaly:L,band:T,xExtent:$,yExtent:N,frameProps:B={},selection:D,linkedHover:E,onObservation:I,onClick:H,hoverHighlight:R,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:K}=t,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:ae,yLabel:se}=a,le=r(()=>me(s),[s]),ce=b||f,ue=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ou(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Pc("AreaChart",le,"xAccessor",h),Pc("AreaChart",le,"yAccessor",g);const de=Ec({data:le,rawData:s,colorBy:ce,colorScheme:x,legendInteraction:G,legendPosition:q,selection:D,linkedHover:E,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:I,onClick:H,hoverHighlight:R,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:l,marginDefaults:a.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=Kc({data:le,xAccessor:h,yAccessor:g,forecast:_,anomaly:L,groupBy:f}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:ve}=nu({safeData:he,data:s,areaBy:f,lineDataAccessor:v,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:K,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:S,lineWidth:O,showPoints:C,pointRadius:j,xAccessor:h,yAccessor:g,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,groupField:f||b,band:T}),be=$c({componentName:"AreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),T&&{band:T}),ue&&{gradientFill:ue}),A&&{lineGradient:A}),{curve:k,lineStyle:pe}),C&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de.margin,showAxes:a.showAxes,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,enableHover:J}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),cl({title:ne,description:oe,summary:ie,accessibleTable:re,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===M?{tooltipContent:Xi(),tooltipMode:"multi"}:dl({tooltip:M,defaultTooltipContent:ve})),ul({linkedHover:E,onObservation:I,onClick:H,hoverHighlight:R,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(P&&P.length>0||ge.length>0)&&{annotations:[...P||[],...ge]}),$&&{xExtent:$}),N&&{yExtent:N}),de.crosshairProps),B);return de.earlyReturn?de.earlyReturn:be?e(xc,{componentName:"AreaChart",message:be,width:Q,height:Z}):e(Sc,{componentName:"AreaChart",width:Q,height:Z,children:e($r,Object.assign({ref:o},xe))})});function ru(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}iu.displayName="AreaChart";const au=g(function(n,o){const a=i(null),s=vc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:O=!1,pointRadius:C=3,curve:j="linear",areaOpacity:M=.6,gradientFill:P,tooltip:_,annotations:L,xExtent:T,yExtent:$,frameProps:N={},selection:B,linkedHover:D,onObservation:E,onClick:I,hoverHighlight:H,chartId:R,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,pointIdAccessor:q,windowSize:X}=n,{width:V,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>"function"==typeof y?e=>ru(y(e)):e=>ru(e[y]),[y]),ae=r(()=>"function"==typeof m?e=>ru(m(e)):e=>ru(e[m]),[m]),se=r(()=>"function"==typeof v?e=>ru(v(e)):e=>ru(e[v]),[v]),[le,ce]=d([]),ue=i([]),de=null==c,he=r(()=>me(de?le:c),[de,le,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let a=0,s=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=n(r),y=o(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=s){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-l.a-(y-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(f-l.x),t=l.a+o*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],s)}else for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{s=m;for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=s?s:"A");return r}(he,re,ae,se),[he,re,ae,se]),fe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),a=n(e),s=o(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(he,re,ae,se):[],[A,he,re,ae,se]),pe=r(()=>[...ge,...fe],[ge,fe]),ye=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=X&&e.length>X?e.slice(e.length-X):e;ue.current=t,ce(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...ue.current,t]),pushMany:t=>e([...ue.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of ue.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],a=ue.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>de?ue.current:he,getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[de,he,q,X]);const ve=Ec({data:he,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:G,selection:B,linkedHover:D,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:E,onClick:I,hoverHighlight:H,chartType:"DifferenceChart",chartId:R,showLegend:Z,userMargin:u,marginDefaults:s.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:V,height:U}),be=r(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[Z,b,x,k,w]),xe=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:M}},[k,w,M]),ke=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:S,fill:"none"}),[k,w,S]),we=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=l(n=>{var o;const i=n.data,r=n.allSeries,a=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let s=null==i?void 0:i.__valA,l=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(l=t.value)}if(null!=a&&(null==s||null==l)){const e=he.find(e=>re(e)===a);e&&(null==s&&(s=ae(e)),null==l&&(l=se(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=g&&null!=a?g(a):null!=a?a+"":"";return t("div",{className:"semiotic-tooltip",style:Wi,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(s)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(l)]})]}),null!=s&&null!=l&&Number.isFinite(s)&&Number.isFinite(l)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(s-l)]})]})},[he,re,ae,se,g,k,w,b,x]),Se="multi"===_,Oe=r(()=>!1===_?()=>null:Se?Ae:Vi(_)||Ae,[_,Se,Ae]);if(ve.earlyReturn)return ve.earlyReturn;const Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:pe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ye,curve:j,areaStyle:xe,lineStyle:ke},O&&{pointStyle:we}),{size:[V,U],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:g,yFormat:f,enableHover:K,showGrid:Q}),P&&{gradientFill:!0===P?{topOpacity:.85,bottomOpacity:.15}:P}),be&&{legend:be,legendPosition:ve.legendPosition}),cl({title:J,description:ee,summary:te,accessibleTable:ne,className:h,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:Oe}),Se&&{tooltipMode:"multi"}),ul({linkedHover:D,onObservation:E,onClick:I,hoverHighlight:H,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),$&&{yExtent:$}),ve.crosshairProps),N);return e(Sc,{componentName:"DifferenceChart",width:V,height:U,children:e($r,Object.assign({ref:a},Ce))})});"function"==typeof au&&(au.displayName="DifferenceChart");const su=g(function(t,n){const o=i(null),a=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:S=!1,baseline:O="zero",stackOrder:C,tooltip:j,annotations:M,xExtent:P,yExtent:_,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,chartId:E,loading:I,loadingContent:H,emptyContent:R,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=a,ie=r(()=>me(s),[s]),re=y||f;Ic(n,{variant:"xy",frameRef:o});const ae=Ec({data:ie,rawData:s,colorBy:re,colorScheme:m,legendInteraction:F,legendPosition:W,selection:T,linkedHover:$,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:D,chartType:"StackedAreaChart",chartId:E,showLegend:Q,userMargin:l,marginDefaults:a.marginDefaults,loading:I,loadingContent:H,emptyContent:R,width:X,height:V}),{flattenedData:se,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=nu({safeData:ie,data:s,areaBy:f,lineDataAccessor:p,colorBy:re,colorScale:ae.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,groupField:f||y}),de=$c({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=s&&{data:se}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:v,normalize:S,baseline:S?"zero":O,stackOrder:C,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:a.showAxes,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:K}),ae.legendBehaviorProps),cl({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===j?{tooltipContent:Xi(),tooltipMode:"multi"}:dl({tooltip:j,defaultTooltipContent:ue})),ul({linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),M&&M.length>0&&{annotations:M}),P&&{xExtent:P}),_&&{yExtent:_}),ae.crosshairProps),L);return ae.earlyReturn?ae.earlyReturn:de?e(xc,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e(Sc,{componentName:"StackedAreaChart",width:X,height:V,children:e($r,Object.assign({ref:o},he))})});su.displayName="StackedAreaChart";const lu=g(function(t,n){var o;const a=i(null);Ic(n,{variant:"xy",frameRef:a});const s=vc(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:k,xExtent:w,yExtent:A,frameProps:S={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,loadingContent:$,emptyContent:N,showLegend:B,legendPosition:D,legendInteraction:E}=t,{width:I,height:H,enableHover:R,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=s,X=Mc(T,I,H,$),V=X?null:jc(l,I,H,N),U=r(()=>me(l),[l]),K=function(){var e;const t=rc();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Q=null!==(o=null!=y?y:K)&&void 0!==o?o:"blues",Z=null!=B&&B,J=null!=D?D:"right",{margin:ee}=pc({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:s.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=gc({selection:C,linkedHover:j,fallbackFields:[],onObservation:M,onClick:P,chartType:"Heatmap",chartId:L,hoverHighlight:_,colorByField:void 0});Dc(C);const ie=fc(j,oe);yc(E,void 0,[]);const re=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ae=r(()=>{const e=U.map(re);return[Math.min(...e),Math.max(...e)]},[U,re]),se=r(()=>"custom"===Q&&m?m:O({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Ke,purples:Qe,greys:Ze,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it}[Q]||Xe).domain(ae),[Q,m,ae]),le=r(()=>ml([{label:G||hl(d),accessor:d,role:"x",format:f},{label:q||hl(h),accessor:h,role:"y",format:p},{label:hl(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ce=$c({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ue=r(()=>{if(Z)return{gradient:{colorFn:e=>se(e),domain:ae,label:"string"==typeof g?g:"value",format:b}}},[Z,se,ae,g,b]),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({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==Q?Q:void 0,showValues:v,heatmapValueFormat:b,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,showAxes:s.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:R}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ue&&{legend:ue,legendPosition:J}),cl({title:F,description:W,summary:z,accessibleTable:Y,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:x,defaultTooltipContent:le})),ul({linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,customHoverBehavior:te,customClickBehavior:ne})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ie),S);return X||V||(ce?e(xc,{componentName:"Heatmap",message:ce,width:I,height:H}):e(Sc,{componentName:"Heatmap",width:I,height:H,children:e($r,Object.assign({ref:a},de))}))});lu.displayName="Heatmap";const cu=g(function(t,n){const o=i(null),a=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:C,xExtent:j,yExtent:M,frameProps:P={},selection:_,linkedHover:L,linkedBrush:T,onObservation:$,onClick:N,hoverHighlight:B,chartId:D,loading:E,loadingContent:I,emptyContent:H,legendInteraction:R,legendPosition:F,color:W,stroke:z,strokeWidth:Y,opacity:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=a,oe=r(()=>me(s),[s]),ie=void 0===s,re=Ec({data:oe,rawData:s,colorBy:m,colorScheme:v,legendInteraction:R,legendPosition:F,selection:_,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:B,chartType:"BubbleChart",chartId:D,showLegend:K,userMargin:c,marginDefaults:a.marginDefaults,loading:E,loadingContent:I,emptyContent:H,width:q,height:X}),{domain:ae,trackPushed:se,reset:le}=Fc({accessor:p,data:oe,isPushMode:ie}),ce=l(e=>{var t;se([e]),null===(t=o.current)||void 0===t||t.push(e)},[se]),ue=l(e=>{var t;se(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[se]);Ic(n,{variant:"xy",frameRef:o,overrides:{push:ce,pushMany:ue,clear:()=>{var e;le(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ce,ue,le]});const de=Gl(T);Tl({name:(null==de?void 0:de.name)||"__unused_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof g?g:void 0),yField:(null==de?void 0:de.yField)||("string"==typeof f?f:void 0)});const he=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=ae?ae:[0,1],[ae]),fe=l(e=>bt(e,p,y,ge),[p,y,ge]),pe=Rc({colorBy:m,colorScale:re.colorScale,color:W,fillOpacity:b,radiusFn:fe,baseStyleExtras:he,stroke:z,strokeWidth:Y,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ye=r(()=>ml([{label:te||hl(g),accessor:g,role:"x",format:d},{label:ne||hl(f),accessor:f,role:"y",format:h},{label:hl(p),accessor:p,role:"size"},...m?[{label:hl(m),accessor:m,role:"color"}]:[]]),[g,f,te,ne,p,m,d,h]);if(re.earlyReturn)return re.earlyReturn;const ve=$c({componentName:"BubbleChart",data:s,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(ve)return e(xc,{componentName:"BubbleChart",message:ve,width:q,height:X});const be=Wc(C),xe=be?[be,...O||[]]:O,ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:oe}),{xAccessor:g,yAccessor:f,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:pe,colorScheme:v,size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:d,yFormat:h,enableHover:V,showGrid:U}),re.legendBehaviorProps),cl({title:Q,description:Z,summary:J,accessibleTable:ee,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:w,defaultTooltipContent:ye})),ul({linkedHover:L,onObservation:$,onClick:N,hoverHighlight:B,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),xe&&xe.length>0&&{annotations:xe}),j&&{xExtent:j}),M&&{yExtent:M}),re.crosshairProps),P);return e(Sc,{componentName:"BubbleChart",width:q,height:X,children:e($r,Object.assign({ref:o},ke))})});cu.displayName="BubbleChart";const uu="__splomIdx",du={top:4,bottom:4,left:4,right:4};function hu({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),s=n-du.left-du.right,l=n-du.top-du.bottom;return a(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,a],[s,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(a)],[i.x.invert(s),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[s,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${du.left},${du.top})`})})}function gu({data:n,xField:o,yField:r,cellSize:a,pointRadius:s,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const m=i(null),v=Pl({name:h,clientId:`splom-${o}-${r}`}),b=Tl({name:h,xField:o,yField:r}),x=Pl({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[uu];void 0!==n&&(k({[uu]:[n]}),null==y||y(t,e.x+du.left,e.y+du.top))},[k,y]),S=l(e=>{const t={opacity:c,r:s};return t.fill=u?mt(e,u,d):ac,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=f),t},[u,d,c,s,p,v.isActive,v.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:a,height:a},children:[e($r,{ref:m,chartType:"scatter",data:n,size:[a,a],xAccessor:o,yAccessor:r,pointStyle:S,margin:du,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(hu,{frameRef:m,cellSize:a,xField:o,yField:r,onBrush:w})]})}function fu({data:n,field:o,label:i,cellSize:a,bins:s,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Pl({name:u,clientId:"splom-diag-"+o}),f=Pl({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?f:g,y=p.isActive,m=p.predicate,v=r(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/s||1,r="string"==typeof l?l:null,c=r?[...new Set(n.map(e=>e[r]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),f=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 a=Math.min(Math.floor((n-t)/i),s-1);if(d[a]++,y&&!m(e)||h[a]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[a][t]++,y&&!m(e)||f[a][t]++)}}const p=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/p*(a-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/p*(a-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[n,o,s,a,y,m,l]);return t("svg",{width:a,height:a,style:{overflow:"hidden"},children:[e("text",{x:a/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ac,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:ac,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):ac,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:ac,opacity:.7},"sel-"+n)))]})}function pu({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function yu(n){const{data:i,fields:a,fieldLabels:s={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:C,chartId:j}=n,M="splom",P="splom-hover",_=b?"hover":v?"brush":"hover",L=Cl(e=>e.clearSelection),[T,$]=d(null),N=l(()=>{L(P),$(null)},[L,P]),B=r(()=>(i||[]).map((e,t)=>void 0!==e[uu]?e:Object.assign(Object.assign({},e),{[uu]:t})),[i]),D=dc(B,c,u),E=void 0!==A?A:!!c,I=r(()=>{if(!E||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:D?D(e+""):ac})):null},[E,c,B,D]),H=r(()=>({display:"grid",gridTemplateColumns:"40px "+a.map(()=>h+"px").join(" "),gridTemplateRows:a.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[a,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[I&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:I.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:H,onMouseLeave:"hover"===_?N:void 0,children:[a.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:s[n]||n}),a.map((t,o)=>i===o?"label"===y?e(pu,{label:s[n]||n,cellSize:h},"diag-"+n):e(fu,{data:B,field:n,label:s[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:D,brushSelectionName:M,hoverSelectionName:P,unselectedOpacity:x,mode:_},"diag-"+n):e(gu,{data:B,xField:t,yField:n,fieldLabels:s,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:D,brushSelectionName:M,hoverSelectionName:P,unselectedOpacity:x,showGrid:k,tooltip:w,mode:_,onPointHover:"hover"===_?(e,r,a)=>{e?($({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=a?a:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):($(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",a.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t},"col-label-"+t))]}),T&&"hover"===_&&(()=>{const n=T.datum,o=s[T.xField]||T.xField,i=s[T.yField]||T.yField,r=c?"function"==typeof c?c(n):n[c]:null,a=S?"function"==typeof S?S(n):n[S]:"Row "+n[uu];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),t("div",{children:[o,": ",null!=n[T.xField]?Number(n[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[T.yField]?Number(n[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function mu(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(zl,{selections:i,children:e(yu,Object.assign({},t))})}function vu({width:t,height:n,margin:o,scales:r,brushDirection:s,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+o.left+o.right,f=n+o.top+o.bottom;return a(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===s?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,s,c]),a(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===s?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,r,s]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function bu(n){var o,s;const{data:c,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:C,colorScheme:j,curve:M="linear",lineWidth:P=2,fillArea:_=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:$=3,enableHover:N=!0,showGrid:B=!1,showLegend:D,legendPosition:E,tooltip:I,minimap:H={},renderBefore:R=!1,onBrush:F,brushExtent:W,yExtent:z,frameProps:Y={},loading:G,loadingContent:q,emptyContent:X}=n,V=Mc(G,u,h,q),U=V?null:jc(c,u,h,X),K=r(()=>me(c),[c]),[Q,Z]=d(null),J=null!=W?W:Q,ee=l(e=>{W||Z(e),null==F||F(e)},[W,F]),te=i(null),[ne,oe]=d(null);a(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=te.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?oe(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ie=void 0!==(null===(o=K[0])||void 0===o?void 0:o[O]),re=r(()=>{if(ie)return K;if(S){const e=K.reduce((e,t)=>{const n="function"==typeof S?S(t):t[S];if(!e[n]){const t={[O]:[]};"string"==typeof S&&(t[S]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:K}]},[K,S,O,ie]),ae=r(()=>ie||S?re.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):K,[re,O,ie,S,K]),se=dc(K,C,j),le=eu({lineWidth:P,colorBy:C,colorScale:se,fillArea:_,areaOpacity:L}),ce=r(()=>{if(H.lineStyle)return H.lineStyle},[H.lineStyle]),ue=eu({lineWidth:1,colorBy:C,colorScale:se}),de=null!=ce?ce:ue,he=r(()=>{if(T)return e=>{const t={r:$,fillOpacity:1};return t.fill=C?mt(e.parentLine||e,C,se):ac,t}},[T,$,C,se]),{legend:ge,margin:fe,legendPosition:pe}=pc({data:re,colorBy:C,colorScale:se,showLegend:D,legendPosition:E,userMargin:g}),ye=H.height||60,ve=r(()=>{var e,t,n,o,i,r,a,s;return{top:null!==(t=null===(e=H.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=H.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=H.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:fe.left,right:null!==(s=null===(a=H.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:fe.right}},[H.margin,fe]),be=H.brushDirection||"x",xe=r(()=>ml([{label:v||hl(w),accessor:w,role:"x",format:x},{label:b||hl(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),ke=$c({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(ke)return e(xc,{componentName:"MinimapChart",message:ke,width:u,height:h});const we=_?"area":"line",Ae=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:we,data:ae,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:le},T&&{pointStyle:he}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:fe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:N,showGrid:B}),ge&&{legend:ge,legendPosition:pe}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===I?()=>null:Vi(I)||xe}),J&&{xExtent:J}),z&&{yExtent:z}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),Y),Se=Object.assign({chartType:we,data:ae,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:de,size:[u,ye+ve.top+ve.bottom],margin:ve,showAxes:null!==(s=H.showAxes)&&void 0!==s&&s,background:H.background,enableHover:!1},z&&{yExtent:z}),Oe=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e($r,Object.assign({ref:te},Se)),e(vu,{width:u-ve.left-ve.right,height:ye,margin:ve,scales:ne,brushDirection:be,extent:J,onBrush:ee})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e($r,Object.assign({},Ae))},"main");return V||U||e(Sc,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[R?Oe:Ce,R?Ce:Oe]})})}mu.displayName="ScatterplotMatrix",bu.displayName="MinimapChart";const xu={label:"Low / High",color:"#E9C46A",opacity:.08},ku={label:"High / High",color:"#2A9D8F",opacity:.08},wu={label:"Low / Low",color:"#E76F51",opacity:.08},Au={label:"High / Low",color:"#86BBD8",opacity:.08};function Su(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const Ou=g(function(o,a){const s=i(null);Ic(a,{variant:"xy",frameRef:s});const l=vc(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:M,pointIdAccessor:P,annotations:_,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,chartId:E,loading:I,loadingContent:H,emptyContent:R,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=o,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=l,ie=r(()=>({topLeft:Su(xu,null==v?void 0:v.topLeft),topRight:Su(ku,null==v?void 0:v.topRight),bottomLeft:Su(wu,null==v?void 0:v.bottomLeft),bottomRight:Su(Au,null==v?void 0:v.bottomRight)}),[v]),re=r(()=>me(c),[c]),ae=Ec({data:re,rawData:c,colorBy:w,colorScheme:A,legendInteraction:F,legendPosition:W,selection:T,linkedHover:$,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:D,chartType:"QuadrantChart",chartId:E,showLegend:Q,userMargin:u,marginDefaults:l.marginDefaults,loading:I,loadingContent:H,emptyContent:R,width:X,height:V});Pc("QuadrantChart",re,"xAccessor",f),Pc("QuadrantChart",re,"yAccessor",p);const se=r(()=>{if(!re.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const a of re){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(r-i)||1;return{xExtent:[n-a,o+a],yExtent:[i-s,r+s]}},[re,f,p,y,m]),le=r(()=>{if(!S||0===re.length)return;const e=re.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[re,S]),ce=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ue=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=ce(e),n=ue(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?z||ac:i&&o?ie.topRight.color:i&&!o?ie.topLeft.color:!i&&o?ie.bottomRight.color:ie.bottomLeft.color},[ce,ue,y,m,ie,z]),he=r(()=>S?e=>bt(e,S,O,le):void 0,[S,O,le]),ge=Rc({colorBy:w,colorScale:ae.colorScale,color:z,pointRadius:C,fillOpacity:j,radiusFn:he,fallbackFill:de,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),fe=r(()=>{if(!re.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=re[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[re,f,p,w,S]),pe=r(()=>ml([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ne||hl(f),accessor:f,role:"x",format:h},{label:oe||hl(p),accessor:p,role:"y",format:g},...w?[{label:hl(w),accessor:w,role:"color"}]:[],...S?[{label:hl(S),accessor:S,role:"size"}]:[]]),[fe,f,p,ne,oe,w,S,h,g]),ye=$c({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ve=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=i.width,s=i.height,l=null!=y?o.x(y):a/2,c=null!=m?o.y(m):s/2;if(null!=y&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:ie.topLeft,x:0,y:0,w:u,h:d},{config:ie.topRight,x:u,y:0,w:a-u,h:d},{config:ie.bottomLeft,x:0,y:d,w:u,h:s-d},{config:ie.bottomRight,x:u,y:d,w:a-u,h:s-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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[y,m,ie,b]),be=r(()=>x?[...ve,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,a=null!=y?n.x(y):i/2,s=null!=m?n.y(m):r/2;(null==y||isFinite(a))&&(null==m||isFinite(s))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ie.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ie.topLeft.label,8,8),e.fillStyle=ie.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ie.topRight.label,i-8,8),e.fillStyle=ie.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ie.bottomLeft.label,8,r-8),e.fillStyle=ie.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ie.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ve,[ve,x,k,ie,y,m]),xe=r(()=>{const e=L.canvasPreRenderers||[];return[...be,...e]},[be,L.canvasPreRenderers]),ke=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,a)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const s=a.width,l=a.height,c=null!=y?r.x(y):s/2,u=null!=m?r.y(m):l/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(s,c)),h=Math.max(0,Math.min(l,u));return t(n,{children:[[{config:ie.topLeft,x:0,y:0,w:d,h:h},{config:ie.topRight,x:d,y:0,w:s-d,h:h},{config:ie.bottomLeft,x:0,y:h,w:d,h:l-h},{config:ie.bottomRight,x:d,y:h,w:s-d,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:s,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+k,fill:ie.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:ie.topLeft.label}),e("text",{x:s-8,y:8+k,fill:ie.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:ie.topRight.label}),e("text",{x:8,y:l-8,fill:ie.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:ie.bottomLeft.label}),e("text",{x:s-8,y:l-8,fill:ie.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:ie.bottomRight.label})]})]})}]},[y,m,ie,b,x,k]);if(ae.earlyReturn)return ae.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=c&&{data:re}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:ge,colorScheme:A,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae.margin,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:g,enableHover:U,showGrid:K}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),ae.legendBehaviorProps),Z&&{title:Z}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?pe:Vi(M)||pe}),($||N||B||D)&&{customHoverBehavior:ae.customHoverBehavior}),(N||B||$)&&{customClickBehavior:ae.customClickBehavior}),P&&{pointIdAccessor:P}),_&&_.length>0&&{annotations:_}),{canvasPreRenderers:xe}),ae.crosshairProps),L),xe.length>0&&{canvasPreRenderers:xe}),{svgPreRenderers:ke});return ye?e(xc,{componentName:"QuadrantChart",message:ye,width:X,height:V}):e(Sc,{componentName:"QuadrantChart",width:X,height:V,children:e($r,Object.assign({ref:s},we))})});Ou.displayName="QuadrantChart";const Cu="__ma_unitized",ju="__ma_series";function Mu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Pu(e,t){return t[0]+e*(t[1]-t[0])}const _u=g(function(t,n){var a;const s=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!s.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&s.current.push(Object.assign(Object.assign({},o),{[Cu]:Mu(r,i),[ju]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!s.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&o.push(Object.assign(Object.assign({},e),{[Cu]:Mu(a,r),[ju]:i.label||"Series "+(t+1)}))}s.current.pushMany(o)},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 d=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,stroke:D,strokeWidth:E,opacity:I}=t,{width:H,height:R,enableHover:F,showGrid:W,showLegend:z=!0,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V}=d,U=r(()=>me(h),[h]),K=r(()=>me(v),[v]),Q=K,Z=2===K.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||Z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${K.length}. Rendering as a standard multi-line chart.`);const J=Mc(L,H,R,T),ee=J?null:jc(h,H,R,$),te=cc(),ne=r(()=>{let e;if(Array.isArray(b))e=b;else if(te&&te.length>0)e=te;else{const t=ht[b];e=Array.isArray(t)?t:gt}return Q.map((t,n)=>t.color||e[n%e.length])},[Q,b,te]),oe=r(()=>K.map((e,t)=>e.label||"Series "+(t+1)),[K]),{unitizedData:ie,extents:re}=r(()=>{if(0===U.length){const e=K.map(e=>e.extent||null).filter(Boolean);return e.length===K.length&&(c.current=e),{unitizedData:[],extents:e.length===K.length?e:[]}}const e=K.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]}(U,e.yAccessor));if(c.current=e,!Z){const t=[];for(const e of U)for(let n=0;K.length>n;n++){const o=K[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Cu]:i,[ju]:oe[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of U)for(let o=0;2>o;o++){const i=K[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Cu]:Mu(r,e[o]),[ju]:oe[o]}))}return{unitizedData:t,extents:e}},[U,K,Z,oe]),ae=r(()=>{if(Z&&re.length>=2)return[{orient:"left",label:oe[0],tickFormat:K[0].format||(e=>{const t=Pu(e,re[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:oe[1],tickFormat:K[1].format||(e=>{const t=Pu(e,re[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Z,re,K,oe]),se=Ec({data:r(()=>ie.length>0?ie:oe.map(e=>({[ju]:e})),[ie,oe]),rawData:h,colorBy:ju,colorScheme:ne,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:[ju],unwrapData:!1,onObservation:j,onClick:M,hoverHighlight:P,chartType:"MultiAxisLineChart",chartId:_,showLegend:z,userMargin:g,marginDefaults:Z?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:H,height:R}),le=r(()=>{const e=new Map;return oe.forEach((t,n)=>e.set(t,ne[n])),e},[oe,ne]),ce=eu({lineWidth:k,resolveStroke:l(e=>le.get(e[ju])||ne[0],[le,ne]),stroke:D,strokeWidth:E,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ue=r(()=>{if(!1===w)return()=>null;return Vi(w)||(e=>{var t;const n=e.data||e,i=n[ju],r=oe.indexOf(i),a=n[Cu],s=Z&&r>=0&&re[r]?Pu(a,re[r]):a,l=r>=0&&(null===(t=K[r])||void 0===t?void 0:t.format)?K[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ne[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(s)}`))})},[w,oe,ne,re,Z,K,m]);if(se.earlyReturn)return se.earlyReturn;const de=$c({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),he=Z?[0,1]:void 0,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ie}),{xAccessor:m,yAccessor:Cu,groupAccessor:ju,lineStyle:ce,colorScheme:ne,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:d.showAxes}),ae&&{axes:ae}),{xLabel:V}),Z?{}:{yLabel:oe[0]}),{xFormat:y}),Z&&he&&{yExtent:he}),{enableHover:F}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:W,curve:x}),se.legendBehaviorProps),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:ue}),A&&{annotations:A}),(C||j||M||P)&&{customHoverBehavior:se.customHoverBehavior}),(j||M||C)&&{customClickBehavior:se.customClickBehavior}),se.crosshairProps),S);return J||ee||(de?e(xc,{componentName:"MultiAxisLineChart",message:de,width:H,height:R}):e(Sc,{componentName:"MultiAxisLineChart",width:H,height:R,children:e($r,Object.assign({ref:s},ge))}))});function Lu(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}_u.displayName="MultiAxisLineChart";const Tu=g(function(t,n){const o=i(null);Ic(n,{variant:"xy",frameRef:o});const a=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,chartId:j,loading:M,loadingContent:P,emptyContent:_}=t,{width:L,height:T,enableHover:$,showGrid:N,title:B,description:D,summary:E,accessibleTable:I,xLabel:H,yLabel:R}=a,F=Mc(M,L,T,P),W=F?null:jc(s,L,T,_),z=r(()=>me(s),[s]),Y=null==p||null==y;Pc("CandlestickChart",z,"xAccessor",h),Pc("CandlestickChart",z,"highAccessor",g),Pc("CandlestickChart",z,"lowAccessor",f),Y||(Pc("CandlestickChart",z,"openAccessor",p),Pc("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=gc({selection:A,linkedHover:S,onObservation:O,onClick:C,chartType:"CandlestickChart",chartId:j}),V=fc(S,X),U=r(()=>{const e=a.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:Object.assign(Object.assign({},n),Lu(l))},[l,a.marginDefaults,t.mode]),K=r(()=>{const e=[{label:H||hl(h),accessor:h,role:"x",format:u}];return Y?(e.push({label:"High",accessor:g,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:g,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:y,format:d})),ml(e)},[h,H,u,d,g,f,p,y,Y]),Q=$c({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!Y&&{openAccessor:p,closeAccessor:y})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=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:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:a.showAxes,xLabel:H,yLabel:R,xFormat:u,yFormat:d,enableHover:$,showGrid:N}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),cl({title:B,description:D,summary:E,accessibleTable:I,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:v,defaultTooltipContent:K})),ul({linkedHover:S,onObservation:O,onClick:C,customHoverBehavior:G,customClickBehavior:q})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),V),w);return F||W||(Q?e(xc,{componentName:"CandlestickChart",message:Q,width:L,height:T}):e(Sc,{componentName:"CandlestickChart",width:L,height:T,children:e($r,Object.assign({ref:o},ee))}))});function $u(e){const t=i(null);return Ic(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:vc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>Lu(e.margin),[e.margin])}}function Nu(e){var t;const n=$u(e),{resolved:o,normalizedMargin:i}=n,r=Ec({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:i,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Tu.displayName="CandlestickChart";const Bu=g(function(t,n){const{data:o,layout:i,layoutConfig:r,xExtent:a,yExtent:s,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:g,selection:f,linkedHover:p,chartId:y,loading:m,loadingContent:v,emptyContent:b,colorScheme:x,frameProps:k={}}=t,{frameRef:w,resolved:A,safeData:S,setup:O,earlyReturn:C}=Nu({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorScheme:x,selection:f,linkedHover:p,onObservation:h,onClick:g,chartId:y,loading:m,loadingContent:v,emptyContent:b,margin:c,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(C)return C;const{width:j,height:M,enableHover:P,showGrid:_,title:L,description:T,summary:$,accessibleTable:N,xLabel:B,yLabel:D}=A,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:S}),{customLayout:i,layoutConfig:r,xExtent:a,yExtent:s,colorScheme:x,size:[j,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:O.margin,showAxes:l,xLabel:B,yLabel:D,enableHover:P,showGrid:_}),O.legendBehaviorProps),cl({title:L,description:T,summary:$,accessibleTable:N,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),null!=t.tooltip&&{tooltipContent:t.tooltip}),ul({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),d&&d.length>0&&{annotations:d}),O.crosshairProps),k);return e(Sc,{componentName:"XYCustomChart",width:j,height:M,children:e($r,Object.assign({ref:w},E))})});Bu.displayName="XYCustomChart";const Du=g(function(t,n){const{nodes:o,edges:i,layout:a,layoutConfig:s,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",margin:d,className:h,colorScheme:g,frameProps:f={}}=t,{frameRef:p,resolved:y,normalizedMargin:m}=$u({imperativeRef:n,imperativeVariant:"network",margin:d,width:t.width,height:t.height,enableHover:t.enableHover,title:t.title,mode:t.mode}),v=r(()=>me(null!=o?o:[]),[o]),b=r(()=>me(null!=i?i:[]),[i]),{width:x,height:k,enableHover:w,title:A,description:S,summary:O,accessibleTable:C}=y,j=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=o&&{nodes:v}),null!=i&&{edges:b}),{customNetworkLayout:a,layoutConfig:s,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[x,k],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:m,className:h,title:A,description:S,summary:O,accessibleTable:C,enableHover:w}),f);return e(Sc,{componentName:"NetworkCustomChart",width:x,height:k,children:e(ll,Object.assign({ref:p},j))})});Du.displayName="NetworkCustomChart";const Eu=g(function(t,n){const{data:o,layout:i,layoutConfig:r,categoryAccessor:a="category",valueAccessor:s="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorScheme:g,showAxes:f=!1,annotations:p,onObservation:y,onClick:m,selection:v,linkedHover:b,chartId:x,loading:k,loadingContent:w,emptyContent:A,frameProps:S={}}=t,{frameRef:O,resolved:C,safeData:j,setup:M,earlyReturn:P}=Nu({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorScheme:g,selection:v,linkedHover:b,onObservation:y,onClick:m,chartId:x,loading:k,loadingContent:w,emptyContent:A,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(P)return P;const{width:_,height:L,enableHover:T,showGrid:$,title:N,description:B,summary:D,accessibleTable:E}=C,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:j}),{customLayout:i,layoutConfig:r,oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorScheme:g,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:M.margin,enableHover:T,showAxes:f,showGrid:$,annotations:p}),cl({title:N,description:B,summary:D,accessibleTable:E,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),ul({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior})),S);return e(Sc,{componentName:"OrdinalCustomChart",width:_,height:L,children:e(ma,Object.assign({ref:O},I))})});function Iu({ref:e,frameRef:t,setup:n}){return p(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Hu(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:a,categoryIndexMap:s,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=mt(e,t,n)}else c.fill=uc(o,i,a,f?r:void 0,s);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,a,s,f,p,y]),v=r(()=>Hc(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:u,opacity:d}),[m,l,c,u,d]);return r(()=>ql(v,null!=h?h:null,g),[v,h,g])}Eu.displayName="OrdinalCustomChart";const Ru=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,regression:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=o,te=r(()=>me(s),[s]),ne=Ec({data:te,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"BarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:Y,height:G}),{effectiveLegendProps:oe,effectiveMargin:ie}=Iu({ref:n,frameRef:a,setup:ne});Pc("BarChart",te,"categoryAccessor",u),Pc("BarChart",te,"valueAccessor",d);const re=hc(te,y,d),ae=cc(),se=r(()=>new Map,[te]),le=Hu({colorBy:f,colorScale:ne.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=r(()=>vl({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[u,d,f,g]);if(ne.earlyReturn)return ne.earlyReturn;const ue=$c({componentName:"BarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(xc,{componentName:"BarChart",message:ue,width:Y,height:G});const de=Wc(A),he=de?[de,...w||[]]:w,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:q,showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:g}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:y}),oe),cl({title:U,description:K,summary:Q,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:k,defaultTooltipContent:ce})),ul({linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"BarChart",width:Y,height:G,children:e(ma,Object.assign({ref:a},ge))})});Ru.displayName="BarChart";const Fu=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:H,opacity:R,categoryFormat:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=r(()=>me(s),[s]),ee=p||d,te=Ec({data:J,rawData:s,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:W,height:z}),ne=cc(),oe=r(()=>new Map,[J]),ie=Hu({colorBy:ee,colorScale:te.colorScale,color:E,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>vl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=$c({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:le}=Iu({ref:n,frameRef:a,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:G}),se),cl({title:X,description:V,summary:U,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:w,defaultTooltipContent:re})),ul({linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?e(xc,{componentName:"StackedBarChart",message:ae,width:W,height:z}):e(Sc,{componentName:"StackedBarChart",width:W,height:z,children:e(ma,Object.assign({ref:a},ce))})});Fu.displayName="StackedBarChart";const Wu={RdBu:rt,PiYG:at,PRGn:st,BrBG:lt,RdYlBu:ct,RdYlGn:ut,Spectral:dt},zu="__likert_neutral_neg",Yu="__likert_neutral_pos";function Gu(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function qu(e,t,n,o,i,r){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],a=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:i})}}return l}function Xu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:zu,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Yu,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Vu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const a=[];for(const[,e]of r){const t=new Map;let r,s;for(const n of e)n.__likertLevel===zu?r=n:n.__likertLevel===Yu?s=n:t.set(n.__likertLevelIndex,n);o&&r&&a.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const Uu=["Very Low","Low","Neutral","High","Very High"],Ku=new Map,Qu=g(function(t,n){const a=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:c,margin:u,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:m="count",levels:v=Uu,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,valueFormat:T,loading:$,loadingContent:N,emptyContent:B,legendInteraction:D,legendPosition:E,categoryFormat:I,stroke:H,strokeWidth:R,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=a,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=rc();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=Wu[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);r&&s.push(i);for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);return s}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:ae,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=r(()=>Gu(n,"question"),[n]),g=r(()=>d?Gu(o,"score"):null,[d,o]),f=r(()=>d?null:Gu(a,"level"),[d,a]),p=r(()=>d?null:Gu(s,"count"),[d,s]),y=e||[],m=i([]),v=r(()=>{if(0===y.length)return[];let e=qu(y,t,h,g,f,p);return c&&(e=Xu(e,t),e=Vu(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var n;let o=qu(e,t,h,g,f,p);c&&(o=Xu(o,t),o=Vu(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:s}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:a="right"}){const s=i(new Set),c=i([]),[u,h]=d(0),g=kl(),f=cc(),p=l(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=l(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||s.current.has(t)||(s.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=l(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{s.current=new Set,c.current=[],h(e=>e+1)},[]);Rl(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:ft,a=t,s=i.map(e=>({[a]:e})),l=vt(s,a,r);return Yl({data:s,colorBy:a,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:mt})},[e,t,o,n,g,f,u]),w=r(()=>{if(k)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[k,a]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:q,legendPosition:E}),ue=l(ce.wrapPush(e=>{se.current.push(e),ae(se.current)}),[ce.wrapPush,ae,se]),de=l(ce.wrapPushMany(e=>{se.current.push(...e),ae(se.current)}),[ce.wrapPushMany,ae,se]);p(n,()=>({push:ue,pushMany:de,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;se.current=[],ce.resetCategories(),null===(e=s.current)||void 0===e||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}}),[ue,de,ce.resetCategories,se]);const he=Ec({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:D,legendPosition:E,selection:C,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:u,marginDefaults:a.marginDefaults,loading:$,loadingContent:N,emptyContent:B,width:W,height:z}),ge=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),fe=Hu({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Ku,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:H,strokeWidth:R,opacity:F,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===zu||i===Yu)return{fill:ge};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===zu||n===Yu?pe:n,r=t.__likertCategory||"",a=Math.abs(t.__likertPct||0),s=n===zu||n===Yu?2*a:a,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Wi},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${s.toFixed(1)}% (n=${l})`))},[pe]),me=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),$c({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,f,y,m,v,te]),ve=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),be=r(()=>!1!==q?Object.assign(Object.assign({},he.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:E||he.legendPosition||"bottom"}):he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,E,q,ve]),xe=r(()=>{const e=Object.assign({},he.margin);if(ee&&!1!==q){const t=E||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[he.margin,ce.streamingMarginAdjust,J,ee,q,E]),ke=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]);if(he.earlyReturn)return he.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:fe,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Q,rLabel:Z||(J?void 0:"Percentage"),rFormat:ke}),I&&{oFormat:I}),{showGrid:G}),be),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:!1===w?()=>null:!0===w?ye:Vi(w)||ye}),(j||M||P||_)&&{customHoverBehavior:he.customHoverBehavior}),(M||P||j)&&{customClickBehavior:he.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return me?e(xc,{componentName:"LikertChart",message:me,width:W,height:z}):e(Sc,{componentName:"LikertChart",width:W,height:z,children:e(ma,Object.assign({ref:s},we))})});function Zu({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=Gl("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),a=Tl({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof o?o:"value")}),s=i(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(r){s.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Qu.displayName="LikertChart";const Ju=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Ic(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:C,frameProps:j={},selection:M,linkedHover:P,onObservation:_,onClick:L,hoverHighlight:T,chartId:$,loading:N,loadingContent:B,emptyContent:D,legendInteraction:E,legendPosition:I,color:H,stroke:R,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>me(s),[s]),oe=Ec({data:ne,rawData:s,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:I,selection:M,linkedHover:P,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:$,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:N,loadingContent:B,emptyContent:D,width:G,height:q}),ie=Zu({brushProp:S,onBrushProp:O,linkedBrush:C,valueAccessor:d}),re=r(()=>{if(!y)return;const e=ne.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ne,y]),ae=cc(),se=r(()=>new Map,[ne]),le=Hu({colorBy:f,colorScale:oe.colorScale,color:H,themeCategorical:ae,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:R,strokeWidth:F,opacity:W,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?bt(e,y,m,re):v})}),ce=r(()=>vl({categoryAccessor:u,valueAccessor:d,groupAccessor:f||void 0,valueFormat:g}),[u,d,f,g]);if(oe.earlyReturn)return oe.earlyReturn;const ue=$c({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(xc,{componentName:"SwarmPlot",message:ue,width:G,height:q});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({chartType:"swarm"},null!=s&&{data:ne}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:X}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),oe.legendBehaviorProps),cl({title:K,description:Q,summary:Z,accessibleTable:J,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:k,defaultTooltipContent:ce})),ul({linkedHover:P,onObservation:_,onClick:L,hoverHighlight:T,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"SwarmPlot",width:G,height:q,children:e(ma,Object.assign({ref:a},de))})});function ed(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",a=o.stats||(o.data||o).stats;if(a&&null!=a.median)return t("div",{className:"semiotic-tooltip",style:Wi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=a.n&&t("div",{children:["n = ",a.n]}),null!=a.min&&t("div",{children:["Min: ",a.min.toLocaleString()]}),null!=a.q1&&t("div",{children:["Q1: ",a.q1.toLocaleString()]}),t("div",{children:["Median: ",a.median.toLocaleString()]}),null!=a.q3&&t("div",{children:["Q3: ",a.q3.toLocaleString()]}),null!=a.max&&t("div",{children:["Max: ",a.max.toLocaleString()]}),null!=a.mean&&t("div",{style:{opacity:.8},children:["Mean: ",a.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,a=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=a.length,l=s>0?s%2!=0?a[Math.floor(s/2)]:(a[s/2-1]+a[s/2])/2:null;return t("div",{className:"semiotic-tooltip",style:Wi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),s>0&&t("div",{children:["n = ",s]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:Wi,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}Ju.displayName="SwarmPlot";const td=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Ic(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:B,opacity:D,showCategoryTicks:E,categoryFormat:I}=t,{width:H,height:R,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=o,K=r(()=>me(s),[s]),Q=Ec({data:K,rawData:s,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"BoxPlot",chartId:j,showLegend:z,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:_,width:H,height:R}),Z=cc(),J=r(()=>new Map,[K]),ee=Hu({colorBy:f,colorScale:Q.colorScale,color:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:void 0,stroke:N,strokeWidth:B,opacity:D,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=r(()=>ed(),[]);if(Q.earlyReturn)return Q.earlyReturn;const ne=$c({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(xc,{componentName:"BoxPlot",message:ne,width:H,height:R});const oe=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:"boxplot"},null!=s&&{data:K}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:U,rFormat:g}),I&&{oFormat:I}),{showGrid:W,showCategoryTicks:E}),Q.legendBehaviorProps),cl({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:v,defaultTooltipContent:te})),ul({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"BoxPlot",width:H,height:R,children:e(ma,Object.assign({ref:a},oe))})});td.displayName="BoxPlot";const nd=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},od=g(function(n,o){const a=vc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=i(null);Ic(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d=nd,valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:F,categoryFormat:W}=n,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=a,ee=r(()=>me(l),[l]),te=Ec({data:ee,rawData:l,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:a.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:z,height:Y}),ne=Zu({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h}),oe=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of ee){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[ee,h]),ie=cc(),re=r(()=>new Map,[ee]),ae=Hu({colorBy:y,colorScale:te.colorScale,color:E,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,a=o.range;return t("div",{className:"semiotic-tooltip",style:Wi,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),a&&2===a.length&&t("div",{style:{opacity:.8},children:[Number(a[0]).toFixed(1)," – ",Number(a[1]).toFixed(1)]})]})},[]);if(te.earlyReturn)return te.earlyReturn;const le=$c({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e(xc,{componentName:"Histogram",message:le,width:z,height:Y});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),k?{rExtent:k}:oe&&{rExtent:oe}),{size:[z,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),cl({title:V,description:U,summary:K,accessibleTable:Q,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),dl({tooltip:b,defaultTooltipContent:se})),ul({linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"Histogram",width:z,height:Y,children:e(ma,Object.assign({ref:s},ce))})});od.displayName="Histogram";const id=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Ic(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:F,categoryFormat:W}=t,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=o,ee=r(()=>me(s),[s]),te=Ec({data:ee,rawData:s,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:z,height:Y}),ne=Zu({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:d}),oe=cc(),ie=r(()=>new Map,[ee]),re=Hu({colorBy:y,colorScale:te.colorScale,color:E,themeCategorical:oe,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:I,strokeWidth:H,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>ed({valueAccessor:d}),[d]);if(te.earlyReturn)return te.earlyReturn;const se=$c({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(se)return e(xc,{componentName:"ViolinPlot",message:se,width:z,height:Y});const 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({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[z,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),cl({title:V,description:U,summary:K,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:b,defaultTooltipContent:ae})),ul({linkedHover:j,onObservation:M,onClick:P,hoverHighlight:_,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"ViolinPlot",width:z,height:Y,children:e(ma,Object.assign({ref:a},le))})});id.displayName="ViolinPlot";const rd=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Ic(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,chartId:M,loading:P,loadingContent:_,emptyContent:L,legendInteraction:T,legendPosition:$,color:N,stroke:B,strokeWidth:D,opacity:E,showCategoryTicks:I,categoryFormat:H}=t,{width:R,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:K}=o,Q=r(()=>me(s),[s]),Z=Ec({data:Q,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:$,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:C,hoverHighlight:j,chartType:"RidgelinePlot",chartId:M,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:R,height:F}),J=cc(),ee=r(()=>new Map,[Q]),te=Hu({colorBy:y,colorScale:Z.colorScale,color:N,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:B,strokeWidth:D,opacity:E,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=r(()=>ed(),[]);if(Z.earlyReturn)return Z.earlyReturn;const oe=$c({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return e(xc,{componentName:"RidgelinePlot",message:oe,width:R,height:F});const ie=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:"ridgeline"},null!=s&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[R,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:I,oSort:!1,amplitude:f}),Z.legendBehaviorProps),cl({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:b,defaultTooltipContent:ne})),ul({linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"RidgelinePlot",width:R,height:F,children:e(ma,Object.assign({ref:a},ie))})});rd.displayName="RidgelinePlot";const ad=g(function(n,o){const a=vc(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=i(null);Ic(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:B,opacity:D,categoryFormat:E}=n,I="vertical"===y,{width:H,height:R,enableHover:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q}=a,X=I?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},V=r(()=>me(l),[l]),U=f||g,K=!U,Q=Ec({data:V,rawData:l,colorBy:U,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"FunnelChart",chartId:j,showLegend:W,userMargin:c,marginDefaults:X,loading:M,loadingContent:P,emptyContent:_,width:H,height:R});Pc("FunnelChart",V,"stepAccessor",d),Pc("FunnelChart",V,"valueAccessor",h);const Z=cc(),J=r(()=>new Map,[V]),ee=r(()=>{if(K)return $||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,$,Z,p]),te=Hu({colorBy:ee?void 0:U,colorScale:Q.colorScale,color:null!=ee?ee:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:N,strokeWidth:B,opacity:D,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection}),ne=r(()=>n=>{var o,i,r,a,s,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(a=null==c?void 0:c.__funnelPercent)&&void 0!==a?a:null==c?void 0:c.__barFunnelPercent,g=null!==(s=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==s?s:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:Wi,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const oe=$c({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(oe)return e(xc,{componentName:"FunnelChart",message:oe,width:H,height:R});const ie=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:I?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:I?"vertical":"horizontal",barPadding:I?40:0,pieceStyle:te,size:[H,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),E&&{oFormat:E}),{showGrid:I}),!I&&{connectorOpacity:m}),{showLabels:v}),Q.legendBehaviorProps),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ne:Vi(b)||ne}),(A||S||O||C)&&{customHoverBehavior:Q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"FunnelChart",width:H,height:R,children:e(ma,Object.assign({ref:s},ie))})});ad.displayName="FunnelChart";const sd=g(function(t,n){var o;const a=vc(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Ic(n,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:k,regression:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,color:D,stroke:E,strokeWidth:I,opacity:H,categoryFormat:R}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=a,Z=r(()=>me(l),[l]),J=Ec({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"DotPlot",chartId:_,showLegend:G,userMargin:c,marginDefaults:a.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),ee=hc(Z,m,h),te=cc(),ne=r(()=>new Map,[Z]),oe=Hu({colorBy:p,colorScale:J.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:I,opacity:H,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=r(()=>vl({categoryAccessor:d,valueAccessor:h,valueFormat:f}),[d,h,f]);if(J.earlyReturn)return J.earlyReturn;const re=$c({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e(xc,{componentName:"DotPlot",message:re,width:F,height:W});const ae=Wc(w),se=ae?[ae,...k||[]]:k,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({chartType:"point"},null!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:K,rLabel:Q,rFormat:f}),R&&{oFormat:R}),{showGrid:Y,oSort:m}),J.legendBehaviorProps),cl({title:q,description:X,summary:V,accessibleTable:U,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:x,defaultTooltipContent:ie})),ul({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),se&&se.length>0&&{annotations:se}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Sc,{componentName:"DotPlot",width:F,height:W,children:e(ma,Object.assign({ref:s},le))})});sd.displayName="DotPlot";const ld=g(function(t,n){var o,a;const s=vc(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(a=t.height)&&void 0!==a?a:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:P,legendInteraction:_,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,showLegend:H,title:R,description:F,summary:W,accessibleTable:z}=s,Y=r(()=>me(c),[c]),G=f||h,q=Ec({data:Y,rawData:c,colorBy:G,colorScheme:p,legendInteraction:_,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:C,showLegend:H,userMargin:u,marginDefaults:s.marginDefaults,loading:j,loadingContent:M,emptyContent:P,width:D,height:E}),X=cc(),V=r(()=>new Map,[Y]),U=Hu({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:p,categoryIndexMap:V,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:B,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=r(()=>vl({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Q=$c({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:J}=Iu({ref:n,frameRef:l,setup:q});if(q.earlyReturn)return q.earlyReturn;const ee=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:"pie"},null!=c&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Z),cl({title:R,description:F,summary:W,accessibleTable:z,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:v,defaultTooltipContent:K})),ul({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Q?e(xc,{componentName:"PieChart",message:Q,width:D,height:E}):e(Sc,{componentName:"PieChart",width:D,height:E,children:e(ma,Object.assign({ref:l},ee))})});ld.displayName="PieChart";const cd=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:P,legendInteraction:_,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,showLegend:H,title:R,description:F,summary:W,accessibleTable:z}=o,Y=r(()=>me(s),[s]),G=f||u,q=Ec({data:Y,rawData:s,colorBy:G,colorScheme:p,legendInteraction:_,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:C,showLegend:H,userMargin:l,marginDefaults:o.marginDefaults,loading:j,loadingContent:M,emptyContent:P,width:D,height:E}),X=null!=h?h:Math.max(2,.15*Math.min(D,E)),V=cc(),U=r(()=>new Map,[Y]),K=Hu({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:p,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:B,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=r(()=>vl({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),Z=$c({componentName:"DonutChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:J,effectiveMargin:ee}=Iu({ref:n,frameRef:a,setup:q});if(q.earlyReturn)return q.earlyReturn;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({chartType:"donut"},null!=s&&{data:Y}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:K,innerRadius:X,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),cl({title:R,description:F,summary:W,accessibleTable:z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:v,defaultTooltipContent:Q})),ul({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(xc,{componentName:"DonutChart",message:Z,width:D,height:E}):e(Sc,{componentName:"DonutChart",width:D,height:E,children:e(ma,Object.assign({ref:a},te))})});function ud(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function dd(e){return Math.max(0,Math.min(1,e))}function hd(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function gd(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function fd(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:dd(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=dd(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,a=r>0?(o-t.offset)/r:0,s=hd(t.color),l=hd(i.color);if(!s||!l)return.5>a?t.color:i.color;const[c,u,d]=s,[h,g,f]=l;return gd(c+(h-c)*a,u+(g-u)*a,d+(f-d)*a)}return n[n.length-1].color}function pd(e,t,n){return`${e}-${t}`}cd.displayName="DonutChart";const yd=g(function(n,o){const a=vc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),s=i(null),l="context"===n.mode,{compactMode:c}=a,{value:u,min:d=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:k,valueFormat:w,showScaleLabels:A=!c,sweep:S=240,fillZones:O=!0,tooltip:C,annotations:j,frameProps:M={},className:P,stroke:_,strokeWidth:L,opacity:T}=n,{width:$,height:N,title:B,description:D,summary:E,accessibleTable:I}=a,H=f&&"object"==typeof f?f:void 0,R=Math.max(d,Math.min(h,u)),F=h-d||1,W=(R-d)/F,{gaugeData:z,pieceStyle:Y,gaugeAnnotations:G}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=s?h:1,t=pd("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(fd(c.colorStops,e*(t+.5)/n));const i=pd("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(i,{fill:o[0]||a})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-r),u=s?Math.max(0,i-c):0;if(c>0){const e=pd("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=pd("bg",n);p.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:a,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:a},gaugeAnnotations:m}}({min:d,max:h,value:u,thresholds:g,fillColor:p,backgroundColor:y,fillZones:O,showScaleLabels:A,gradientFill:H}),[u,d,h,g,p,y,A,O,H]),q=r(()=>Hc(Y,{stroke:_,strokeWidth:L,opacity:T}),[Y,_,L,T]),{sweepRad:X,startAngleDeg:V}=ud(S),U=function(e=240){const{sweepRad:t,offsetRad:n}=ud(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.min(...i),s=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:a,maxX:s,minY:l,maxY:c,width:s-a,height:c-l,cx:(a+s)/2,cy:(l+c)/2}}(S),K=Math.min(10,Math.max(1,Math.min($,N)/12)),Q=U.cx,Z=U.cy,J=Math.max(4,Math.min(($-2*K)/U.width,(N-2*K)/U.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=$/2-Q*J,ne=N/2-Z*J,oe=2*(J+4),ie=r(()=>{if(c&&null==k)return null;if(null!=k)return"function"==typeof k?k(R,d,h):k;const n=w?w(R):Math.round(R)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[k,R,d,h,w,A,J,c]),re=r(()=>l&&null==k?{type:"gauge-value",text:w?w(R):Math.round(R)+""}:null,[l,k,R,w]),ae=r(()=>{if(!b)return null;const e=-Math.PI/2+V*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,V,X,ee,x]),se=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||$)/2,a=(i.height||N)/2,s=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*s)),c=Math.max(1,Math.min(5,.6*s));return t("g",{transform:`translate(${r},${a})`,children:[e("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+V*Math.PI/180+(n.value-d)/F*X,a=(i.width||$)/2,s=(i.height||N)/2,l=ee-1,c=J+1,u=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${a},${s})`,children:[e("line",{x1:u,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?e("text",{x:(i.width||$)/2,y:(i.height||N)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[$,N,d,F,V,X,ee,J]),le=r(()=>{const e=[...G,...j||[]];return ae&&e.push(ae),re&&e.push(re),e},[G,j,ae,re]),ce=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(R):"Remaining"})]})},[R]);if(0===z.length)return e(xc,{componentName:"GaugeChart",message:"No data to display",width:$,height:N});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:q,innerRadius:ee,startAngle:V,sweepAngle:S},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[$,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:N-ne-oe/2,left:te-oe/2,right:$-te-oe/2},enableHover:a.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===C?()=>null:Vi(C)||ce,svgAnnotationRules:se}),le.length>0&&{annotations:le}),B&&{title:B}),D&&{description:D}),E&&{summary:E}),void 0!==I&&{accessibleTable:I}),P&&{className:P}),null!=n.animate&&{animate:n.animate}),M);return e(Sc,{componentName:"GaugeChart",width:$,height:N,children:e(ma,Object.assign({ref:s},ue))})});yd.displayName="GaugeChart";const md=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,color:D,stroke:E,strokeWidth:I,opacity:H,categoryFormat:R}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:K,valueLabel:Q}=o,Z=r(()=>me(s),[s]),J=p||d,ee=Ec({data:Z,rawData:s,colorBy:J,colorScheme:y,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:P,chartType:"GroupedBarChart",chartId:_,showLegend:G,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),te=cc(),ne=r(()=>new Map,[Z]),oe=Hu({colorBy:J,colorScale:ee.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:S.pieceStyle,stroke:E,strokeWidth:I,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>vl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),re=$c({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ae,effectiveMargin:se}=Iu({ref:n,frameRef:a,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const 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({chartType:"clusterbar"},null!=s&&{data:Z}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:Q,rFormat:f}),R&&{oFormat:R}),{showGrid:Y}),ae),cl({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:k,defaultTooltipContent:ie})),ul({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:P,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e(xc,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e(Sc,{componentName:"GroupedBarChart",width:F,height:W,children:e(ma,Object.assign({ref:a},le))})});md.displayName="GroupedBarChart";const vd=g(function(t,n){const o=vc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,chartId:P,loading:_,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:N,color:B,stroke:D,strokeWidth:E,opacity:I,categoryFormat:H,rTickValues:R,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=t,{width:X,height:V,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=o,ie=r(()=>me(s),[s]),re=p||d,ae=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,e.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?V:X)-2*n)/(n-1))):1},[m,t.mode,ie,u,g,X,V]),se=Ec({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:$,legendPosition:N,selection:S,linkedHover:O,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:M,chartType:"SwimlaneChart",chartId:P,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:T,width:X,height:V}),le=Zu({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h}),ce=cc(),ue=r(()=>new Map,[ie]),de=Hu({colorBy:re,colorScale:se.colorScale,color:B,themeCategorical:ce,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:D,strokeWidth:E,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,cycleByCategory:!0}),he=r(()=>vl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ge=$c({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:fe,effectiveMargin:pe}=Iu({ref:n,frameRef:a,setup:se});if(se.earlyReturn)return se.earlyReturn;const 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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:ae,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:f}),R&&{rTickValues:R}),null!=F&&{tickLabelEdgeAlign:F}),H&&{oFormat:H}),void 0!==W&&{showCategoryTicks:W}),{showGrid:K}),fe),cl({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({tooltip:v,defaultTooltipContent:he})),ul({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=Y&&{trackFill:Y}),null!=G&&{roundedTop:G}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e(xc,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e(Sc,{componentName:"SwimlaneChart",width:X,height:V,children:e(ma,Object.assign({ref:a},ye))})});function bd(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(o)};return o(e),n}function xd(e,t,n,o){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],r="function"==typeof o?o(e):e[o];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function kd(e){return"function"==typeof e?e:t=>t[e]||1}function wd({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:i,baseStyle:r={}}){return a=>{const s=Object.assign({fillOpacity:i},r);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=mt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=mt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*i);return s}}function Ad(e){const{nodes:t,edges:n,inferNodes:o=!0,sourceAccessor:i="source",targetAccessor:a="target",colorBy:s,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:k,loading:w,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,C=r(()=>me(n),[n]),j=r(()=>me(t),[t]),M=Mc(w,x,k,A),P=M?null:jc("nodes"===O?void 0===t?void 0:j:void 0===n?void 0:C,x,k,S),_=r(()=>o?xd(j,C,i,a):j,[o,j,C,i,a]),L=dc(_,s,l),T=cc(),$=r(()=>{if(Array.isArray(l))return l;if(T&&T.length>0)return T;if("string"==typeof l){const e=ht[l];if(Array.isArray(e)&&e.length>0)return e}return gt},[l,T]),N=r(()=>{if(!s)return[];const e=new Set;for(const t of _){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[_,s]),B=yc(d,s,N),{legend:D,margin:E,legendPosition:I}=pc({data:_,colorBy:s,colorScale:L,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:N}),H=gc({selection:h,linkedHover:g,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:R,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y}=H;return{safeNodes:_,safeEdges:C,colorScale:L,effectivePalette:$,themeCategorical:T,allCategories:N,legendState:B,legend:D,margin:E,legendPosition:I,customHoverBehavior:R,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y,loadingEl:M,emptyEl:P}}vd.displayName="SwimlaneChart";const Sd=g(function(t,n){var o;const a=i(null);Ic(n,{variant:"network",frameRef:a});const s=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:C,frameProps:j={},onObservation:M,onClick:P,chartId:_,selection:L,linkedHover:T,loading:$,loadingContent:N,emptyContent:B,legendInteraction:D,legendPosition:E,stroke:I,strokeWidth:H,opacity:R}=t,F=null!==(o=null!=h?h:g)&&void 0!==o?o:"id",{width:W,height:z,enableHover:Y,showLegend:G,showLabels:q=!1,title:X,description:V,summary:U,accessibleTable:K}=s,Q=Ad({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:m,colorScheme:v,showLegend:G,legendPosition:E,legendInteraction:D,selection:L,linkedHover:T,onObservation:M,onClick:P,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:u,width:W,height:z,loading:$,loadingContent:N,emptyContent:B,emptyDataKey:"nodes"}),Z=r(()=>new Map,[]),J=r(()=>e=>{const t={};return t.fill=m?mt(e.data||e,m,Q.colorScale):uc(void 0,Q.themeCategorical,v,void 0,Z),"number"==typeof b&&(t.r=b),t},[m,Q.colorScale,b,Q.themeCategorical,v,Z]),ee=r(()=>Hc(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ne=r(()=>Hc(te,{stroke:I,strokeWidth:H,opacity:R}),[te,I,H,R]),oe=r(()=>{if(q&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[q,y]),ie=Bc({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:F}});return ie?e(xc,{componentName:"ForceDirectedGraph",message:ie,width:W,height:z}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:e(Sc,{componentName:"ForceDirectedGraph",width:W,height:z,children:e(ll,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:Q.safeNodes},null!=c&&{edges:Q.safeEdges},{size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,nodeIDAccessor:F,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ee,edgeStyle:ne,colorBy:m,colorScheme:Q.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:q,enableHover:Y,tooltipContent:!1===C?()=>null:Vi(C)||void 0,customHoverBehavior:T||M||P?Q.customHoverBehavior:void 0,customClickBehavior:M||P?Q.customClickBehavior:void 0,legend:Q.legend,legendPosition:Q.legendPosition},D&&"none"!==D&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},{className:d,title:X,description:V,summary:U,accessibleTable:K},null!=t.animate&&{animate:t.animate},j))})});Sd.displayName="ForceDirectedGraph";const Od=g(function(t,n){const o=i(null);Ic(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",padAngle:v=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:C,chartId:j,selection:M,linkedHover:P,loading:_,loadingContent:L,emptyContent:T,legendInteraction:$,stroke:N,strokeWidth:B,opacity:D}=t,{width:E,height:I,enableHover:H,showLabels:R=!0,title:F,description:W,summary:z,accessibleTable:Y}=a,G=Ad({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:$,selection:M,linkedHover:P,onObservation:O,onClick:C,chartType:"ChordDiagram",chartId:j,marginDefaults:a.marginDefaults,userMargin:c,width:E,height:I,loading:_,loadingContent:L,emptyContent:T}),q=r(()=>new Map,[]),X=G.safeNodes.length>0,V=r(()=>{if(X)return(e,t)=>{var n,o;const i={stroke:"black",strokeWidth:1};if(p)i.fill=mt(e.data||e,p,G.colorScale);else{const r=Array.isArray(y)?y:ht[y]||gt,a=Array.isArray(r)?r:gt,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;i.fill=a[s%a.length]}return i}},[X,p,G.colorScale,y]),U=r(()=>V?Hc(V,{stroke:N,strokeWidth:B,opacity:D}):void 0,[V,N,B,D]),K=r(()=>{if(X)return wd({edgeColorBy:m,colorBy:p,colorScale:G.colorScale,nodeStyleFn:U||(e=>({fill:uc(void 0,G.themeCategorical,y,void 0,q)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[X,m,p,G.colorScale,U,w,G.themeCategorical,y,q]),Q=r(()=>K?Hc(K,{stroke:N,strokeWidth:B,opacity:D}):void 0,[K,N,B,D]),Z=r(()=>{if(!R)return;const e=k||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[R,k,f]),J=Bc({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(xc,{componentName:"ChordDiagram",message:J,width:E,height:I}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:e(Sc,{componentName:"ChordDiagram",width:E,height:I,children:e(ll,Object.assign({ref:o,chartType:"chord"},G.safeNodes.length>0&&{nodes:G.safeNodes},null!=l&&{edges:G.safeEdges},{size:[E,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,padAngle:v,groupWidth:b,sortGroups:x,nodeStyle:U,edgeStyle:Q,colorBy:p,colorScheme:G.effectivePalette,edgeColorBy:m,edgeOpacity:w,nodeLabel:Z,showLabels:R,enableHover:H,tooltipContent:!1===A?()=>null:Vi(A)||void 0,customHoverBehavior:P||O||C?G.customHoverBehavior:void 0,customClickBehavior:O||C?G.customClickBehavior:void 0},$&&"none"!==$&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},{className:u,title:F,description:W,summary:z,accessibleTable:Y},null!=t.animate&&{animate:t.animate},S))})});Od.displayName="ChordDiagram";const Cd=g(function(t,n){const o=i(null);Ic(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",orientation:v="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:C={},onObservation:j,onClick:M,chartId:P,selection:_,linkedHover:L,loading:T,loadingContent:$,emptyContent:N,showLegend:B,legendPosition:D,legendInteraction:E,stroke:I,strokeWidth:H,opacity:R}=t,{width:F,height:W,enableHover:z,showLabels:Y=!0,title:G,description:q,summary:X,accessibleTable:V}=a,U=Ad({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:B,legendPosition:D,legendInteraction:E,selection:_,linkedHover:L,onObservation:j,onClick:M,chartType:"SankeyDiagram",chartId:P,marginDefaults:a.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:$,emptyContent:N}),K=r(()=>new Map,[]),Q=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?mt(e.data||e,p,U.colorScale):uc(void 0,U.themeCategorical,y,void 0,K),t},[p,U.colorScale,U.themeCategorical,y,K]),Z=r(()=>Hc(Q,{stroke:I,strokeWidth:H,opacity:R}),[Q,I,H,R]),J=r(()=>wd({edgeColorBy:m,colorBy:p,colorScale:U.colorScale,nodeStyleFn:Z,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[m,p,U.colorScale,Z,A]),ee=r(()=>Hc(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>{if(!Y)return;const e=w||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[Y,w,f]),ne=Bc({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e(xc,{componentName:"SankeyDiagram",message:ne,width:F,height:W}):U.loadingEl?U.loadingEl:U.emptyEl?U.emptyEl:e(Sc,{componentName:"SankeyDiagram",width:F,height:W,children:e(ll,Object.assign({ref:o,chartType:"sankey"},U.safeNodes.length>0&&{nodes:U.safeNodes},null!=l&&{edges:U.safeEdges},{size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,orientation:v,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:Z,edgeStyle:ee,colorBy:p,colorScheme:U.effectivePalette,edgeColorBy:m,edgeOpacity:A,edgeSort:S,nodeLabel:te,showLabels:Y,enableHover:z,tooltipContent:!1===O?()=>null:Vi(O)||void 0,customHoverBehavior:L||j||M?U.customHoverBehavior:void 0,customClickBehavior:j||M?U.customClickBehavior:void 0,legend:U.legend,legendPosition:U.legendPosition},E&&"none"!==E&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},{className:u,title:G,description:q,summary:X,accessibleTable:V},null!=t.animate&&{animate:t.animate},C))})});function jd(e,t,n){const o=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of o)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const a={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},s=()=>{r.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=a[e.kind])&&void 0!==n?n:99)-(null!==(o=a[t.kind])&&void 0!==o?o:99)})},l=r.length?Math.min(...r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};s();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let n=t-("top"===e.side?p:y);if(n>0){const t="top"===e.side?"bot":"top",o=Math.min(n,"top"===t?p:y);if(o>0){const i=g(e.time);f.push({time:i,delta:-o,kind:"transfer-out",side:t}),f.push({time:i,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?p-=o:y-=o,"top"===e.side?p+=o:y+=o,n-=o}n>0&&null!==u&&(f.push({time:u,delta:+n,kind:"create",side:e.side}),"top"===e.side?p+=n:y+=n)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),s();let m=0,v=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>k&&(k=v),w.push({t:e.time,topMass:m,botMass:v})}const S=[];let O=0;for(;w.length>O;){let e=O;for(;w.length>e+1&&w[e+1].t===w[O].t;)e++;S.push(w[O]);for(let t=O+1;e>=t;t++){const e=S[S.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||S.push(w[t])}O=e+1}const C=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let j=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===j||j>e.systemInTime)&&(j=e.systemInTime);let M=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===M||e.systemOutTime>M)&&(M=e.systemOutTime);if(S.length>0){const e=S[S.length-1],t=Math.max(null!=C?C:-1/0,null!=M?M:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&S.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=S[0],o=Math.min(null!=c?c:1/0,null!=j?j:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&S.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function Md(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Pd(e,t){return e.map(e=>({t:Md(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function _d(e,t,n){const o=e.value*n;if("out"===e.kind){const i=e.sideMassBefore*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}const i=e.sideMassAfter*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}function Ld(e,t){let n=0;for(let o=0;t.length>o;o++)for(let i=o+1;t.length>i;i++){const r=t[o],a=t[i];r.source!==a.source&&r.target!==a.target&&r.source!==a.target&&r.target!==a.source&&(Math.min(r.endTime,a.endTime)>Math.max(r.startTime,a.startTime)&&e[a.source]>e[r.source]!=e[a.target]>e[r.target]&&n++)}return n}function Td(e,t){let n=0;for(const o of t)n+=Math.abs(e[o.source]-e[o.target])*(o.value||1);return n}function $d(e,t){return 1e3*Ld(e,t)+Td(e,t)}function Nd(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Bd(e,t,n){e.length>8||n.length>40?(function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Nd(e,t),a=$d(t,n);for(let s=0;o>s;s++){const o=Array(i).fill(0),s=Array(i).fill(0);for(const e of n){const n=t[e.source],i=t[e.target];o[n]+=i*(e.value||1),s[n]+=e.value||1,o[i]+=n*(e.value||1),s[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(s[e]>0?o[e]/s[e]:e)-(s[t]>0?o[t]/s[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=$d(t,n);if(a>d)a=d,r=Nd(e,t);else if(d===a)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,r)}(e,t,n,6),function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=$d(t,n);for(let a=0;o>a;a++){let o=!1;for(let a=0;i-1>a;a++){const i=e[a];e[a]=e[a+1],e[a+1]=i;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=$d(t,n);if(r>s)r=s,o=!0;else{const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!o)break}}(e,t,n,6)):function(e,t,n){const o=e.length;if(1>=o)return;const i=Object.assign({},t),r=Object.keys(i),a=Array.from({length:o},(e,t)=>t),s=a.slice(),l=Object.assign({},i);let c=a.slice(),u=1/0;const d=()=>{for(const e of r)l[e]=s[i[e]];const e=$d(l,n);u>e&&(u=e,c=a.slice())},h=(e,t)=>{const n=a[e],o=a[t];a[e]=o,a[t]=n,s[n]=t,s[o]=e};d();const g=Array(o).fill(0);let f=0;for(;o>f;)f>g[f]?(h(f%2==0?0:g[f],f),d(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,n)}function Dd(e,t,n,o,i){var r,a,s,l,c,u,d,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=n[t.id].topPeak||0,x[t.id]=n[t.id].botPeak||0;const k="half"===v,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,n=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of o.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of o.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}w[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},S=[];if("reuse"===y){const n=new Map;for(const t of e)n.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const d=[];for(const t of e)0===(null!==(a=i.get(t.id))&&void 0!==a?a:0)&&d.push(t.id);for(;d.length;){const e=d.shift();for(const t of null!==(s=o.outgoing[e])&&void 0!==s?s:[]){const o=(null!==(l=n.get(e))&&void 0!==l?l:0)+1;o>(null!==(c=n.get(t.target))&&void 0!==c?c:0)&&n.set(t.target,o),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&d.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var o,i;const r=null!==(o=n.get(e.id))&&void 0!==o?o:0,a=null!==(i=n.get(t.id))&&void 0!==i?i:0;return r!==a?r-a:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let n=-1;for(let e=0;S.length>e;e++){const o=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=S.length-1),S[n].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),S[n].peak.topPeak=Math.max(S[n].peak.topPeak,b[e.id]),S[n].peak.botPeak=Math.max(S[n].peak.botPeak,x[e.id]),A[e.id]=n}}else e.forEach((e,t)=>{var n,o;S.push({occupants:[{id:e.id,end:null!==(o=null===(n=w[e.id])||void 0===n?void 0:n.end)&&void 0!==o?o:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let O=null,C=null,j=null,M=null;const P=()=>{O=Ld(A,t),j=Td(A,t)},_=()=>{C=Ld(A,t),M=Td(A,t)};"crossing-min"===m?(P(),Bd(S,A,t),_()):"inside-out"===m?(P(),function(e,t){const n=e.length;if(1>=n)return;const o=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>o(t.slot)-o(e.slot)),r=Array(n),a=Math.floor((n-1)/2);r[a]=i[0].idx;let s=a-1,l=a+1;for(let e=1;i.length>e;e++)e%2==1&&n>l||0>s?r[l++]=i[e].idx:r[s--]=i[e].idx;const c=r.map(t=>e[t]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(S,A),_()):"crossing-min+inside-out"===m&&(P(),Bd(S,A,t),function(e,t,n){const o=e.length;if(1>=o)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((o-1)/2);let a=$d(t,n);for(const{slot:s}of i){const i=e.indexOf(s);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const u=new Map;for(let e=0;o>e;e++)u.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)u.set(e,e-1);u.set(i,l)}else{for(let e=l;i>e;e++)u.set(e,e+1);u.set(i,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=$d(t,n);if(d>a){const n=e[l];e.splice(l,1),e.splice(i,0,n);const r=new Map;for(let e=0;o>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else a=d}}(S,A,t),_());const L=S.map(e=>{const t=new Map;for(const o of e.occupants){const e=n[o.id];if(e)for(const n of e.samples){const e=t.get(n.t)||{top:0,bot:0};t.set(n.t,{top:Math.max(e.top,n.topMass),bot:Math.max(e.bot,n.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let n={top:0,bot:0};for(const[o,i]of e){if(o>t)break;n=i}return n},$=[];for(let e=0;S.length-1>e;e++){const t=L[e],n=L[e+1],o=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let i=0;for(const e of o){const o=T(t,e),r=T(n,e);o.bot+r.top>i&&(i=o.bot+r.top)}$.push(i)}const N=[];let B=f+(null!==(h=null===(d=S[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&N.push(B);for(let e=1;S.length>e;e++)B+=$[e-1]*p+f,N.push(B);if(S.length>0&&(B+=S[S.length-1].peak.botPeak*p+f),B>g){const e=g/B;for(let t=0;N.length>t;t++)N[t]*=e}const D=0===S.length?0:S[0].peak.topPeak+$.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,E={};for(const t of e)E[t.id]=N[A[t.id]];return{effectiveSlotsHeight:D,centerlines:E,laneLifetime:w,slots:S,slotByNode:A,slotCenter:N,crossingsBefore:O,crossingsAfter:C,lengthBefore:j,lengthAfter:M}}Cd.displayName="SankeyDiagram";const Ed=e=>{var t,n;const{bands:o=[],ribbons:i=[],showLabels:r=!0}=e.config,a=[];for(const e of i)a.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];a.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of o)a.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const s=r?o.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:o.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:a,labels:s}};function Id(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Hd(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Rd(e,t){return"function"==typeof e?e(t):t[e]}const Fd=g(function(o,a){const{nodes:s,edges:c,domain:u,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:m="startTime",endTimeAccessor:v="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:k="xExtent",edgeIdAccessor:w="id",colorBy:S,colorScheme:O,showLegend:C,legendPosition:j="right",pairing:M="temporal",packing:P="reuse",laneOrder:_="crossing-min",ribbonLane:L="both",lifetimeMode:T="half",showLaneRails:$=!1,showQualityReadout:N=!1,showLabels:B=!0,width:D=600,height:E=400,margin:I,title:H,description:R,summary:F,accessibleTable:W,responsiveWidth:z,responsiveHeight:Y,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:V=.35,timeFormat:U,valueFormat:K,tooltip:Q,enableHover:Z=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:ne,chartId:oe,frameProps:ie={}}=o,[re,ae]=d([]),[se,le]=d([]),ce=i(re),ue=i(se);ce.current=re,ue.current=se;const de=l(e=>{ce.current=e,ae(e)},[]),he=l(e=>{ue.current=e,le(e)},[]),ge=void 0!==c,fe=me(ge?c:re),pe=r(()=>{const e=me(null!=s?s:[]),t=se;if(0===e.length&&0===t.length)return xd([],fe,f,p);const n=new Set,o=[];for(const t of e){const e=Rd(g,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Rd(g,e)+"";n.has(t)||(n.add(t),o.push(e))}const i=xd([],fe,f,p);for(const e of i)n.has(e.id)||(n.add(e.id),o.push(e));return o},[s,se,fe,g,f,p]),ye=i(null),ve=l((e,t)=>{const n=Rd(w,e);return null!=n?n+"":`${Rd(f,e)}-${Rd(p,e)}-${t}`},[w,f,p]),be=l(e=>{if(null==e)return!1;const t=e;return null!=Rd(f,t)&&null!=Rd(p,t)},[f,p]);Ic(a,{variant:"network",frameRef:ye,overrides:{push(e){if(be(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");de([...ce.current,e])}else he([...ue.current,e])},pushMany(e){const t=[],n=[];for(const o of e)be(o)?t.push(o):n.push(o);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):de([...ce.current,...t])),n.length>0&&he([...ue.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){const e=ce.current,o=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ve(r,i))?n.push(r):o.push(r)}o.length!==e.length&&de(o)}const o=ue.current,i=[];for(const e of o){const o=Rd(g,e)+"";t.has(o)?n.push(e):i.push(e)}return i.length!==o.length&&he(i),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){let e=!1;const i=ce.current.map((i,r)=>n.has(ve(i,r))?(o.push(i),e=!0,t(i)):i);e&&de(i)}let i=!1;const r=ue.current.map(e=>{const r=Rd(g,e)+"";return n.has(r)?(o.push(e),i=!0,t(e)):e});return i&&he(r),o},clear(){var e;ge||de([]),he([]),null===(e=ye.current)||void 0===e||e.clear()},getData:()=>null!=fe?fe:[],getScales:()=>null},deps:[ge,be,ve,g,fe,de,he]});const xe=ve,ke=l(e=>Rd(g,e)+"",[g]),{nodes:we,edges:Ae,domain:Se,rawNodeById:Oe,rawEdgeById:Ce}=r(()=>{const e=(null!=pe?pe:[]).map(e=>{const t={id:ke(e),__raw:e},n=k?Rd(k,e):null;if(Array.isArray(n)&&2===n.length){const e=Hd(n[0]),o=Hd(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=fe?fe:[]).map((e,t)=>{const n={id:xe(e,t),source:Rd(f,e)+"",target:Rd(p,e)+"",value:Number(Rd(y,e)),startTime:Hd(Rd(m,e)),endTime:Hd(Rd(v,e)),__raw:e};if(b){const t=Hd(Rd(b,e));Number.isFinite(t)&&(n.systemInTime=t)}if(x){const t=Hd(Rd(x,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[Hd(u[0]),Hd(u[1])],o=new Map;for(const t of e)null!=t.__raw&&o.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:n,rawNodeById:o,rawEdgeById:i}},[pe,fe,u,ke,xe,k,f,p,y,m,v,b,x]),je=Ad({nodes:pe,edges:fe,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:S,colorScheme:O,showLegend:!1,legendPosition:j,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:oe,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:I,width:D,height:E,loading:G,loadingContent:q,emptyContent:X}),Me=(null!=C?C:!!S)&&!!S,Pe=l(e=>null!=I&&("number"==typeof I||null!=I[e]),[I]),_e=r(()=>{const e=Object.assign({},je.margin);return Me&&("right"===j&&!Pe("right")&&140>e.right?e.right=140:"bottom"===j&&!Pe("bottom")&&80>e.bottom&&(e.bottom=80)),e},[je.margin,Me,j,Pe]),Le=D-_e.left-_e.right,Te=E-_e.top-_e.bottom,$e=r(()=>function(e,t,n){const o=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(n)&&2===n.length,a=r&&Number.isFinite(n[0])&&Number.isFinite(n[1]);r&&a&&a&&n[1]>=n[0]||o.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||o.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||o.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||o.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||o.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||o.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):o.push({kind:"invalid-edge-time",id:e.id});return o}(we,Ae,Se),[we,Ae,Se]),Ne=r(()=>$e.length>0?null:function(e,t,n){var o;const{plotH:i,pairing:r="temporal",packing:a="reuse",laneOrder:s="crossing-min",lifetimeMode:l="half"}=n,c=function(e,t){const n={},o={};for(const t of e)n[t.id]=[],o[t.id]=[];for(const e of t)o[e.source]&&o[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:o}}(e,t),u=function(e,t,n,o="value"){const i="temporal"===o?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===o?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const n=new Map;for(const o of e){const e=o[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=n.get(e);i.edges.push(o),i.total+=o.value,i.earliestStart=Math.min(i.earliestStart,o.startTime),i.latestEnd=Math.max(i.latestEnd,o.endTime)}const a=[...n.values()];a.sort("temporal"===o?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?r:i);return a};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)s(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=n});else if(0===e.length)s(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=n});else{const t=s(o,"source"),n=s(e,"target"),i=Math.max(t.length,n.length);for(let e=0;i>e;e++){const o=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)a.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)a.get(t.id).sourceSide=o}}}return a}(e,t,c,r);let d={};for(const t of e)d[t.id]=jd(t,c,u);const h=Dd(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],n=h.slotByNode[e.target];if(void 0===t||void 0===n)continue;const o=u.get(e.id);t!==n?t>n?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(g.add(e.id),o.sourceSide="bot",o.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],n=c.incoming[t.id],o=new Set(e.map(e=>u.get(e.id).sourceSide)),i=new Set(n.map(e=>u.get(e.id).targetSide));if(1===o.size&&n.length>0){const e=[...o][0];for(const t of n)h.slotByNode[t.source]===h.slotByNode[t.target]&&(u.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const n of e)h.slotByNode[n.source]===h.slotByNode[n.target]&&(u.get(n.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],n=c.outgoing[t.id];if(0===e.length||0===n.length)continue;const o=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===u.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===u.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=o(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,a="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=a)return!1;const s=Math.min(r,a),l=n.filter(t=>!g.has(t.id)&&u.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=n.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=jd(t,c,u);const f=Dd(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),p=null!==(o=f.effectiveSlotsHeight)&&void 0!==o?o:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=Dd(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:a,laneOrder:s,lifetimeMode:l});return{nodeData:d,sides:u,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(we,Ae,{plotH:Te,pairing:M,packing:P,laneOrder:_,lifetimeMode:T}),[$e,we,Ae,Te,M,P,_,T]),Be=r(()=>A().domain(Se).range([0,Le]),[Se,Le]),De=l((e,t)=>{if(S&&pe){const t=Oe.get(e);if(t)return mt(t,S,je.colorScale)}return je.effectivePalette[t%je.effectivePalette.length]||"#475569"},[S,pe,Oe,je.colorScale,je.effectivePalette]),Ee=r(()=>{const e=new Map;return we.forEach((t,n)=>e.set(t.id,n)),e},[we]),Ie=r(()=>{if(!Ne)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Ne,o=[],i=[];return we.forEach((i,r)=>{var a;const s=t[i.id];if(!s||0===s.samples.length)return;const l=function(e,t,n,o,i){if(0===e.length)return null;const r=Pd(e,i),a=e=>t-r[e].topMass*n,s=e=>t+r[e].botMass*n;let l=`M${o(r[0].t)},${a(0)}`;for(let e=1;r.length>e;e++)l+=` L${o(r[e].t)},${a(e)}`;l+=` L${o(r[r.length-1].t)},${s(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${o(r[e].t)},${s(e)}`;return l+" Z"}(s.samples,e[i.id],n,Be,Se);if(!l)return;const c=Pd(s.samples,Se),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*n/2,h=De(i.id,r),g=null!==(a=Oe.get(i.id))&&void 0!==a?a:i,f=function(e,t,n,o,i){const r=n.nodeData[e];if(!r||0===r.samples.length)return[];const a=n.valueScale,s=n.centerlines[e],l=Pd(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=o(c.t),h=o(u.t),g=e=>o(Md(e,i)),f=[],p=(e,t,n,o)=>`M${e},${t} L${n},${t} L${n},${o} L${e},${o} Z`;for(const n of t){if(n.source===e&&null!=n.systemInTime&&Number.isFinite(n.systemInTime)){const e=r.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=g(n.systemInTime),o=g(n.startTime),i=t-20,r=Math.max(d,i);if(o>r){const[n,l]=_d(e,s,a);f.push({pathD:p(r,n,o,l),x0:i,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=r.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=g(n.systemOutTime),o=g(n.endTime),i=t+20,r=Math.min(h,i);if(r>o){const[n,l]=_d(e,s,a);f.push({pathD:p(o,n,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,Ae,Ne,Be,Se);o.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Be(u.t)-4,labelY:d,labelText:i.id}))}),Ae.forEach(o=>{var r,a,s,l;const c=null===(r=t[o.source])||void 0===r?void 0:r.localAttachments.get(o.id),u=null===(a=t[o.target])||void 0===a?void 0:a.localAttachments.get(o.id);if(!c||!u)return;const d=null!==(s=Ee.get(o.source))&&void 0!==s?s:0,h=De(o.source,d),g=function(e,t,n,o,i,r,a,s){const l=i,c=e=>s?Math.max(s[0],Math.min(s[1],e)):e,u=r(c(e.time)),d=r(c(n.time)),h=e.value*l,g=n.value*l,f=e.sideMassBefore*l,p=n.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===n.side?(v=o-p,b=v+g):(b=o+p,v=b-g);const x="source"===a?u+.85*(d-u):"target"===a?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[o.source],u,e[o.target],n,Be,L,Se),{pathD:f,bezier:p}=ls(g),y=null!==(l=Ce.get(o.id))&&void 0!==l?l:o;i.push({id:o.id,pathD:f,fill:h,opacity:V,rawDatum:y,bezier:p})}),{bands:o,ribbons:i}},[Ne,we,Ae,Be,Se,De,Oe,Ce,L,V,Ee]),He=r(()=>({bands:Ie.bands,ribbons:Ie.ribbons,showLabels:B}),[Ie,B]),Re=r(()=>{if(!Me||!S)return;const e=new Map;(null!=pe?pe:[]).forEach((t,n)=>{const o=Rd(S,t),i=null==o?"":o+"";i&&!e.has(i)&&e.set(i,{label:i,color:De(ke(t),n)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Me,S,pe,De,ke]),Fe=r(()=>!1!==Q&&Z?void 0===Q||!0===Q?null:Vi(Q)||null:null,[Q,Z]),We=l(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),ze=l(e=>K?K(e):e+"",[K]),Ye=l(o=>{if(!o||!o.data)return null;const i=o.data;if(!Id(i))return null;const r=i.data;if(Fe)return Fe(r);if("band"===i.__kind){const n=i.id,o=Ne?function(e){if(!e)return[];const t=new Set,n=[];for(const o of e.samples){const e=o.topMass+o.botMass,i=`${o.t}:${e}`;t.has(i)||(t.add(i),n.push({t:o.t,total:e}))}return n}(Ne.nodeData[n]):[],r=5,a=o.length>r?o.length:null,s=function(e,t=5){if(t>=e.length)return e.slice();const n=[...e].sort((e,t)=>e.total-t.total),o=n.length-1,i=[Object.assign(Object.assign({},n[0]),{mark:"min"}),Object.assign(Object.assign({},n[Math.floor(.25*o)]),{mark:"q25"}),Object.assign(Object.assign({},n[Math.floor(.5*o)]),{mark:"median"}),Object.assign(Object.assign({},n[Math.floor(.75*o)]),{mark:"q75"}),Object.assign(Object.assign({},n[o]),{mark:"max"})],r=new Set,a=[];for(const e of i)r.has(e.t)||(r.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:n}),s.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=a&&e("th",{})]})}),e("tbody",{children:s.map((n,o)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:We(n.t)}),e("td",{style:{textAlign:"right"},children:ze(n.total)}),null!=a&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:n.mark})]},o))})]}),null!=a&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",a," samples"]})]})}const a=r,s=Rd(f,a),l=Rd(p,a),c=Rd(y,a),u=Rd(m,a),d=Rd(v,a);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[s+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(n,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:ze(Number(c))})]}),null!=u&&t(n,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:We(Hd(u))})]}),null!=d&&t(n,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:We(Hd(d))})]})]})]})},[Ne,Fe,We,ze,f,p,y,m,v]),Ge=r(()=>{if(!Ne)return null;const{centerlines:n,laneLifetime:o,nodeData:i,valueScale:r,compressedPadding:a,crossingsBefore:s,crossingsAfter:l,lengthBefore:c,lengthAfter:u}=Ne;let d=null,g=null;for(const e of we){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Be(t.start),i=Be(t.end);(null===d||d>n)&&(d=n),(null===g||i>g)&&(g=i)}const f=e=>Math.max(0,Math.min(Le,e)),p=f(null!=d?d:0),y=Math.max(p,f(null!=g?g:Le));return t("g",{children:[N&&null!==(null!=l?l:null)&&t("text",{x:Le,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),a&&e("text",{x:Le,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,n)=>{const o=Be(Hd(t.date));return p-.5>o||o>y+.5?null:e("line",{x1:o,y1:0,x2:o,y2:Te,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),$&&we.map((a,s)=>{const l=o[a.id];if(!l||null===l.start)return null;const c=i[a.id],u=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},d=n[a.id]+(u.botPeak-u.topPeak)*r/2,h=Be(l.start),g=Be(l.end),f=De(a.id,s);return t("g",{children:[e("line",{x1:h,y1:d,x2:g,y2:d,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:d-4,x2:h,y2:d+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:d-4,x2:g,y2:d+4,stroke:f,strokeOpacity:.5})]},"lane-"+a.id)}),e("line",{x1:p,y1:Te+4,x2:y,y2:Te+4,stroke:"#94a3b8"}),h.map((n,o)=>{const i=Hd(n.date),r=Be(i);if(p-.5>r||r>y+.5)return null;const a=null!=n.label?n.label:U?U(new Date(i)):"";return t("g",{transform:`translate(${r},${Te+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:a})]},o)})]})},[Ne,h,Be,Le,Te,$,we,De,N,U]),qe=r(()=>(null!=pe?pe:[]).map(e=>({id:ke(e),data:e})),[pe,ke]),Xe=r(()=>{const e=new Map;for(const t of Ie.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Ie]),Ve=r(()=>(null!=fe?fe:[]).map((e,t)=>{const n=xe(e,t),o=Number(Rd(y,e));return{id:n,source:Rd(f,e)+"",target:Rd(p,e)+"",value:Number.isFinite(o)?o:0,bezier:Xe.get(n),data:e}}),[fe,xe,f,p,y,Xe]),Ue=je.loadingEl,Ke=je.emptyEl;return $e.length>0?t("svg",{width:D,height:E,role:"img","aria-label":null!=H?H:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),$e.map((t,n)=>{return e("text",{x:20,y:56+18*n,fontSize:12,fill:"#64748b",children:"• "+(o=t,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},n);var o})]}):Ue||Ke||e(ll,Object.assign({ref:ye,chartType:"force",nodes:qe,edges:Ve,customNetworkLayout:Ed,layoutConfig:He,size:[D,E],responsiveWidth:z,responsiveHeight:Y,margin:_e,title:H,description:null!=R?R:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:F,accessibleTable:W,enableHover:Z,tooltipContent:!1===Q?()=>null:Ye,backgroundGraphics:Ge,showParticles:te,particleStyle:ne,legend:Re,legendPosition:j,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;Id(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:oe,colorScheme:Array.isArray(O)?O:void 0},ie))});function Wd(t){const n=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,layout:s="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:O,loadingContent:C,legendInteraction:j,stroke:M,strokeWidth:P,opacity:_}=t,{width:L,height:T,enableHover:$,showLabels:N=!0,title:B,description:D,summary:E,accessibleTable:I}=n,H=Ad({nodes:r(()=>bd(null!=o?o:null,c),[o,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:j,selection:A,linkedHover:S,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:i,width:L,height:T,loading:O,loadingContent:C}),R=r(()=>new Map,[]),F=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?mt(e.data||e,h,H.colorScale):uc(void 0,H.themeCategorical,g,void 0,R),t},[h,f,H.colorScale,H.themeCategorical,g,R]),W=r(()=>Hc(F,{stroke:M,strokeWidth:P,opacity:_}),[F,M,P,_]),z=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=r(()=>Hc(z,{stroke:M,strokeWidth:P,opacity:_}),[z,M,P,_]),G=r(()=>{if("treemap"===s||"circlepack"===s||"partition"===s)return kd(u)},[s,u]),q=Nc({componentName:"TreeDiagram",data:o});return q?e(xc,{componentName:"TreeDiagram",message:q,width:L,height:T}):H.loadingEl?H.loadingEl:e(Sc,{componentName:"TreeDiagram",width:L,height:T,children:e(ll,Object.assign({chartType:s},null!=o&&{data:o},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:H.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:H.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:N?y||d:void 0,showLabels:N,enableHover:$,tooltipContent:!1===v?()=>null:Vi(v)||void 0,customHoverBehavior:S||x||k?H.customHoverBehavior:void 0,customClickBehavior:x||k?H.customClickBehavior:void 0},j&&"none"!==j&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:a,title:B,description:D,summary:E,accessibleTable:I},null!=t.animate&&{animate:t.animate},b))})}function zd(t){const n=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:m,nodeStyle:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:C,loadingContent:j,legendInteraction:M,stroke:P,strokeWidth:_,opacity:L}=t,{nodeStyle:T}=x,$=zc(x,["nodeStyle"]),{width:N,height:B,enableHover:D,showLabels:E=!0,title:I,description:H,summary:R,accessibleTable:F}=n,W=Ad({nodes:r(()=>bd(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:g?void 0:d,colorScheme:h,showLegend:!1,legendInteraction:M,selection:k,linkedHover:w,onObservation:A,onClick:S,chartType:"Treemap",chartId:O,marginDefaults:n.marginDefaults,userMargin:i,width:N,height:B,loading:C,loadingContent:j}),z=Dc(k),Y=W.customHoverBehavior,G=l(e=>{if(!e)return Y(null);const t=e.data||e;Y({data:(null==t?void 0:t.data)||t})},[Y]),q=r(()=>new Map,[]),X=r(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:d?mt(e.data||e,d,W.colorScale):uc(void 0,W.themeCategorical,h,void 0,q),t},[d,g,W.colorScale,W.themeCategorical,h,q]),V=r(()=>v||T?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},X(e)),T&&null!==(t=T(e))&&void 0!==t?t:{}),v&&null!==(n=v(e))&&void 0!==n?n:{})}:X,[X,v,T]),U=r(()=>Hc(V,{stroke:P,strokeWidth:_,opacity:L}),[V,P,_,L]),K=r(()=>W.activeSelectionHook?e=>{var t;const n=Object.assign({},U(e));if(W.activeSelectionHook.isActive)if(W.activeSelectionHook.predicate(e.data||e))(null==z?void 0:z.selectedStyle)&&Object.assign(n,z.selectedStyle);else{const e=null!==(t=null==z?void 0:z.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==z?void 0:z.unselectedStyle)&&Object.assign(n,z.unselectedStyle)}return n}:U,[U,W.activeSelectionHook,z]),Q=r(()=>kd(c),[c]),Z=void 0!==m?m:!E||"parent"!==f&&"all"!==f?void 0:18,J=Nc({componentName:"Treemap",data:o});return J?e(xc,{componentName:"Treemap",message:J,width:N,height:B}):W.loadingEl?W.loadingEl:e(Sc,{componentName:"Treemap",width:N,height:B,children:e(ll,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[N,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:u,childrenAccessor:s,hierarchySum:Q,padding:y,paddingTop:Z,nodeStyle:K,colorBy:d,colorScheme:W.effectivePalette,colorByDepth:g,nodeLabel:E?p||u:void 0,showLabels:E,labelMode:f,enableHover:D,tooltipContent:!1===b?()=>null:Vi(b)||void 0},(w||A||S)&&{customHoverBehavior:G},(A||S)&&{customClickBehavior:W.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},{className:a,title:I,description:H,summary:R,accessibleTable:F},null!=t.animate&&{animate:t.animate},$))})}function Yd(t){const n=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,loadingContent:S,legendInteraction:O,stroke:C,strokeWidth:j,opacity:M}=t,{width:P,height:_,enableHover:L,showLabels:T=!0,title:$,description:N,summary:B,accessibleTable:D}=n,E=Ad({nodes:r(()=>bd(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:O,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:i,width:P,height:_,loading:A,loadingContent:S}),I=r(()=>new Map,[]),H=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:u?mt(e.data||e,u,E.colorScale):uc(void 0,E.themeCategorical,d,void 0,I),t},[u,h,E.colorScale,f,E.themeCategorical,d,I]),R=r(()=>Hc(H,{stroke:C,strokeWidth:j,opacity:M}),[H,C,j,M]),F=r(()=>kd(l),[l]),W=Nc({componentName:"CirclePack",data:o});return W?e(xc,{componentName:"CirclePack",message:W,width:P,height:_}):E.loadingEl?E.loadingEl:e(Sc,{componentName:"CirclePack",width:P,height:_,children:e(ll,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[P,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:E.margin,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:F,padding:p,nodeStyle:R,colorBy:u,colorScheme:E.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:Vi(y)||void 0,customHoverBehavior:w||v||b?E.customHoverBehavior:void 0,customClickBehavior:v||b?E.customClickBehavior:void 0},O&&"none"!==O&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},{className:a,title:$,description:N,summary:B,accessibleTable:D},null!=t.animate&&{animate:t.animate},m))})}Fd.displayName="ProcessSankey",Wd.displayName="TreeDiagram",zd.displayName="Treemap",Yd.displayName="CirclePack";const Gd=pt;function qd(t){const n=vc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:C,onClick:j,chartId:M,selection:P,linkedHover:_,loading:L,loadingContent:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,title:H,description:R,summary:F,accessibleTable:W}=n,z=Ad({nodes:r(()=>bd(o,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:P,linkedHover:_,onObservation:C,onClick:j,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:D,height:E,loading:L,loadingContent:T}),Y=r(()=>new Map,[]),{colorScale:G,customClickBehavior:q,customHoverBehavior:X,themeCategorical:V}=z,U=r(()=>{if(Array.isArray(u))return u;const e=ht[u];return Array.isArray(e)?e:gt},[u]),K=r(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?U[0]:Gd[(e.depth||0)%Gd.length]:c?mt(e.data||e,c,G):uc(void 0,V,u,void 0,Y),n.opacity=o?1:.85,n},[c,d,G,U,V,u,Y]),Q=r(()=>Hc(K,{stroke:$,strokeWidth:N,opacity:B}),[K,$,N,B]),Z=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=r(()=>{if(X)return e=>{X(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[X]),ee=r(()=>{if(q)return e=>{q(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[q]),te=Nc({componentName:"OrbitDiagram",data:o});return te?e(xc,{componentName:"OrbitDiagram",message:te,width:D,height:E}):z.loadingEl?z.loadingEl:e(Sc,{componentName:"OrbitDiagram",width:D,height:E,children:e(ll,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Q,edgeStyle:Z,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&I,tooltipContent:k?void 0:!1===w?()=>null:Vi(w)||void 0,customHoverBehavior:_||C||j?J:void 0,customClickBehavior:C||j?ee:void 0,foregroundGraphics:A,annotations:S,className:a,title:H,description:R,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=t.animate&&{animate:t.animate},O))})}qd.displayName="OrbitDiagram";const Xd={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Vd={opacity:.7,marginRight:4};function Ud(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function Kd(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Qd(e={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=e;return e=>{var a;const s=null!==(a=null==e?void 0:e.data)&&void 0!==a?a:null,l=Ud(s,n,"time"),c=Ud(s,o,"value");return t("div",{className:"semiotic-tooltip",style:Xd,children:[t("div",{children:[t("span",{style:Vd,children:[i,":"]}),Kd(l)]}),t("div",{children:[t("span",{style:Vd,children:[r,":"]}),Kd(c)]})]})}}function Zd(e,t){var n;return null!=e?e:Math.max(null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0,200)}const Jd=g(function(t,n){var o,r,a,s,c;const u=vc(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(s=null===(a=t.size)||void 0===a?void 0:a[1])&&void 0!==s?s:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:C,opacity:j,background:M,tooltipContent:P,tooltip:_,onHover:L,annotations:T,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:D,decay:E,pulse:I,staleness:H,transition:R,linkedHover:F,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=t,K=u.showAxes,Q=u.enableHover,Z=null!=h?h:u.marginDefaults,J=null!=d?d:[u.width,u.height],ee=null!==(c=null!=P?P:_)&&void 0!==c?c:Qd({timeAccessor:b,valueAccessor:x}),te=i(null),{customHoverBehavior:ne}=gc({selection:W,linkedHover:F,unwrapData:!0,onObservation:z,chartType:"RealtimeLineChart",chartId:Y}),oe=l(e=>{L&&L(e),ne(e)},[L,ne]);p(n,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Mc(G,J[0],J[1],q),re=ie?null:jc(v,J[0],J[1],X),ae={stroke:S,strokeWidth:O,strokeDasharray:C};null!=j&&(ae.opacity=j);const se=Zd(m,v);return ie||re||e($r,{ref:te,chartType:"line",runtimeMode:"streaming",size:J,margin:Z,className:V?`${g||""} semiotic-emphasis-${V}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:ae,showAxes:K,background:M,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:oe,annotations:T,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:D,decay:E,pulse:I,staleness:H,transition:R,pointIdAccessor:t.pointIdAccessor,legendPosition:U})});function eh(e,t,n){const o="function"==typeof t?t(e):e[null!=t?t:n];if(null==o)return null;if(o instanceof Date)return o.getTime();if("string"==typeof o&&""===o.trim())return null;const i=Number(o);return Number.isFinite(i)?i:null}Jd.displayName="RealtimeLineChart";const th=g(function(n,o){var a,s,c,u,d;const h=vc(n.mode,{width:null!==(s=null===(a=n.size)||void 0===a?void 0:a[0])&&void 0!==s?s:n.width,height:null!==(u=null===(c=n.size)||void 0===c?void 0:c[1])&&void 0!==u?u:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:g,size:f,margin:y,className:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x,data:k,timeAccessor:w,valueAccessor:A,direction:S="up",timeExtent:O,valueExtent:C,extentPadding:j,categoryAccessor:M,colors:P,fill:_,stroke:L,strokeWidth:T,opacity:$,gap:N,background:B,tooltipContent:D,tooltip:E,onHover:I,annotations:H,autoPlaceAnnotations:R,svgAnnotationRules:F,tickFormatTime:W,tickFormatValue:z,linkedHover:Y,selection:G,decay:q,pulse:X,staleness:V,transition:U,onObservation:K,chartId:Q,loading:Z,loadingContent:J,emptyContent:ee,emphasis:te,legendPosition:ne,brush:oe,onBrush:ie,linkedBrush:re}=n,ae=h.showAxes,se=h.enableHover,le=null!=y?y:h.marginDefaults,ce=null!=f?f:[h.width,h.height],ue=null!==(d=null!=D?D:E)&&void 0!==d?d:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r;const a=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==a?void 0:a.binStart)||null==(null==a?void 0:a.binEnd)){const n=Ud(a,o,"time"),r=Ud(a,i,"value");return t("div",{className:"semiotic-tooltip",style:Xd,children:[t("div",{children:[e("span",{style:Vd,children:"x:"}),Kd(n)]}),t("div",{children:[e("span",{style:Vd,children:"y:"}),Kd(r)]})]})}return t("div",{className:"semiotic-tooltip",style:Xd,children:[t("div",{children:[e("span",{style:Vd,children:"range:"}),Kd(a.binStart),"–",Kd(a.binEnd)]}),null!=a.total&&t("div",{children:[e("span",{style:Vd,children:"count:"}),Kd(a.total)]}),null!=a.category&&t("div",{children:[e("span",{style:Vd,children:"category:"}),Kd(a.category)]})]})}}({timeAccessor:w,valueAccessor:A}),de=i(null),{customHoverBehavior:he}=gc({selection:G,linkedHover:Y,unwrapData:!0,onObservation:K,chartType:"RealtimeHistogram",chartId:Q}),ge=l(e=>{I&&I(e),he(e)},[I,he]),fe=!0===oe?{dimension:"x",snap:"bin"}:"x"===oe?{dimension:"x"}:"object"==typeof oe?oe:void 0,pe=Gl(re),ye=Tl(Object.assign({name:(null==pe?void 0:pe.name)||"__unused_hist_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof w?w:"time")},(null==pe?void 0:pe.yField)?{yField:pe.yField}:{})),me=i(ye.brushInteraction);me.current=ye.brushInteraction;const ve=l(e=>{if(ie&&ie(e),K&&K(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Q}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Q}),pe){const t=me.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ie,K,Q,pe]);p(o,()=>({push:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=de.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const be=Mc(Z,ce[0],ce[1],J),xe=be?null:jc(k,ce[0],ce[1],ee),ke={};null!=_&&(ke.fill=_),null!=L&&(ke.stroke=L),null!=T&&(ke.strokeWidth=T),null!=$&&(ke.opacity=$),null!=N&&(ke.gap=N);const we=te?`${m||""} semiotic-emphasis-${te}`.trim():m,Ae=Zd(x,k),Se=r(()=>"down"!==S?C:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:r}){var a;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const s=new Map;for(const i of e){const e=eh(i,n,"time"),r=eh(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/o)*o;s.set(l,(null!==(a=s.get(l))&&void 0!==a?a:0)+r)}let l=0;for(const e of s.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:k,valueAccessor:A,timeAccessor:w,binSize:g,valueExtent:C,extentPadding:j}),[S,k,A,w,g,C,j]);return be||xe||e($r,{ref:de,chartType:"bar",runtimeMode:"streaming",size:ce,margin:le,className:we,arrowOfTime:v,windowMode:b,windowSize:Ae,data:k,timeAccessor:w,valueAccessor:A,xExtent:O,yExtent:Se,extentPadding:j,binSize:g,categoryAccessor:M,barColors:P,barStyle:ke,showAxes:ae,background:B,hoverAnnotation:se,tooltipContent:ue,customHoverBehavior:ge,annotations:H,autoPlaceAnnotations:R,svgAnnotationRules:F,tickFormatTime:W,tickFormatValue:z,decay:q,pulse:X,staleness:V,transition:U,pointIdAccessor:n.pointIdAccessor,legendPosition:ne,brush:fe||(re?{dimension:"x"}:void 0),onBrush:fe||re?ve:void 0})});function nh(t){return e(th,Object.assign({},t,{windowMode:"growing"}))}th.displayName="RealtimeHistogram",nh.displayName="TemporalHistogram";const oh=th,ih=g(function(t,n){var o,r,a,s,c;const u=vc(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(s=null===(a=t.size)||void 0===a?void 0:a[1])&&void 0!==s?s:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:C,fill:j,opacity:M,stroke:P,strokeWidth:_,background:L,tooltipContent:T,tooltip:$,onHover:N,annotations:B,autoPlaceAnnotations:D,svgAnnotationRules:E,tickFormatTime:I,tickFormatValue:H,linkedHover:R,selection:F,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=t,U=u.showAxes,K=u.enableHover,Q=null!=h?h:u.marginDefaults,Z=null!=d?d:[u.width,u.height],J=null!==(c=null!=T?T:$)&&void 0!==c?c:Qd({timeAccessor:b,valueAccessor:x}),ee=i(null),{customHoverBehavior:te}=gc({selection:F,linkedHover:R,unwrapData:!0,onObservation:W,chartType:"RealtimeSwarmChart",chartId:z}),ne=l(e=>{N&&N(e),te(e)},[N,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ee.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Mc(Y,Z[0],Z[1],G),ie=oe?null:jc(v,Z[0],Z[1],q),re={};null!=C&&(re.radius=C),null!=j&&(re.fill=j),null!=M&&(re.opacity=M),null!=P&&(re.stroke=P),null!=_&&(re.strokeWidth=_);const ae=X?`${g||""} semiotic-emphasis-${X}`.trim():g,se=Zd(m,v);return oe||ie||e($r,{ref:ee,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:Q,className:ae,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:re,showAxes:U,background:L,hoverAnnotation:K,tooltipContent:J,customHoverBehavior:ne,annotations:B,autoPlaceAnnotations:D,svgAnnotationRules:E,tickFormatTime:I,tickFormatValue:H,legendPosition:V,pointIdAccessor:t.pointIdAccessor})});ih.displayName="RealtimeSwarmChart";const rh=g(function(n,o){var r,a,s,c,u;const d=vc(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:C,connectorStroke:j,connectorWidth:M,gap:P,stroke:_,strokeWidth:L,opacity:T,background:$,tooltipContent:N,tooltip:B,onHover:D,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:F,linkedHover:W,selection:z,onObservation:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,emphasis:U,legendPosition:K}=n,Q=d.showAxes,Z=d.enableHover,J=null!=g?g:d.marginDefaults,ee=null!=h?h:[d.width,d.height],te=null!==(u=null!=N?N:B)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r,a;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,l=Ud(s,o,"time"),c=null!==(a=null==s?void 0:s.delta)&&void 0!==a?a:Ud(s,i,"value"),u=null==s?void 0:s.cumEnd,d="number"==typeof c?0>c?Kd(c):"+"+Kd(c):Kd(c);return t("div",{className:"semiotic-tooltip",style:Xd,children:[t("div",{children:[e("span",{style:Vd,children:"x:"}),Kd(l)]}),t("div",{children:[e("span",{style:Vd,children:"Δ:"}),d]}),null!=u&&t("div",{children:[e("span",{style:Vd,children:"total:"}),Kd(u)]})]})}}({timeAccessor:x,valueAccessor:k}),ne=i(null),{customHoverBehavior:oe}=gc({selection:z,linkedHover:W,unwrapData:!0,onObservation:Y,chartType:"RealtimeWaterfallChart",chartId:G}),ie=l(e=>{D&&D(e),oe(e)},[D,oe]);p(o,()=>({push:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ne.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ne.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ne.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const re=Mc(q,ee[0],ee[1],X),ae=re?null:jc(b,ee[0],ee[1],V),se={};null!=O&&(se.positiveColor=O),null!=C&&(se.negativeColor=C),null!=j&&(se.connectorStroke=j),null!=M&&(se.connectorWidth=M),null!=P&&(se.gap=P),null!=_&&(se.stroke=_),null!=L&&(se.strokeWidth=L),null!=T&&(se.opacity=T);const le=U?`${f||""} semiotic-emphasis-${U}`.trim():f,ce=Zd(v,b);return re||ae||e($r,{ref:ne,chartType:"waterfall",runtimeMode:"streaming",size:ee,margin:J,className:le,arrowOfTime:y,windowMode:m,windowSize:ce,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:se,showAxes:Q,background:$,hoverAnnotation:Z,tooltipContent:te,customHoverBehavior:ie,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:H,tickFormatTime:R,tickFormatValue:F,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});rh.displayName="RealtimeWaterfallChart";const ah=g(function(n,o){var r,a,s,c,u;const d=vc(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:C=20,heatmapYBins:j=20,aggregation:M="count",background:P,tooltipContent:_,tooltip:L,onHover:T,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:E,decay:I,pulse:H,staleness:R,linkedHover:F,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=n,K=d.showAxes,Q=d.enableHover,Z=null!=g?g:d.marginDefaults,J=null!=h?h:[d.width,d.height],ee=null!==(u=null!=_?_:L)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i,xLabel:r="x",yLabel:a="y"}=n;return n=>{var s,l,c,u;const d=null!==(s=null==n?void 0:n.data)&&void 0!==s?s:null,h=null!==(l=null==d?void 0:d.xCenter)&&void 0!==l?l:Ud(d,o,"time"),g=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:Ud(d,i,"value"),f=null==d?void 0:d.count,p=null==d?void 0:d.sum,y=null==d?void 0:d.value,m=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return t("div",{className:"semiotic-tooltip",style:Xd,children:[t("div",{children:[t("span",{style:Vd,children:[r,":"]}),Kd(h)]}),t("div",{children:[t("span",{style:Vd,children:[a,":"]}),Kd(g)]}),null!=f&&t("div",{children:[e("span",{style:Vd,children:"count:"}),Kd(f)]}),"sum"===m&&null!=p&&t("div",{children:[e("span",{style:Vd,children:"sum:"}),Kd(p)]}),"mean"===m&&null!=y&&t("div",{children:[e("span",{style:Vd,children:"mean:"}),Kd(y)]})]})}}({timeAccessor:x,valueAccessor:k}),te=i(null),{customHoverBehavior:ne}=gc({selection:W,linkedHover:F,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:Y}),oe=l(e=>{T&&T(e),ne(e)},[T,ne]);p(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Mc(G,J[0],J[1],q),re=ie?null:jc(b,J[0],J[1],X),ae=V?`${f||""} semiotic-emphasis-${V}`.trim():f,se=Zd(v,b);return ie||re||e($r,{ref:te,chartType:"heatmap",runtimeMode:"streaming",size:J,margin:Z,className:ae,arrowOfTime:y,windowMode:m,windowSize:se,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:C,heatmapYBins:j,heatmapAggregation:M,showAxes:K,background:P,hoverAnnotation:Q,tooltipContent:ee,customHoverBehavior:oe,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:E,decay:I,pulse:H,staleness:R,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});function sh(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}ah.displayName="RealtimeHeatmap";const lh=864e5;function ch(e){return 10>e?"0"+e:e+""}const uh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dh(e){let t,n=e;return(o,i,r)=>{const a=o instanceof Date?o:new Date(o);e||!r||2>r.length||r===t||(t=r,n=function(e){if(2>e.length)return"days";const t=[];for(let n=1;e.length>n;n++)t.push(e[n]-e[n-1]);t.sort((e,t)=>e-t);const n=t[Math.floor(t.length/2)];return 12e4>n?"seconds":72e5>n?"minutes":2*lh>n?"hours":60*lh>n?"days":400*lh>n?"months":"years"}(r));const s=n||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,n){const o=e.getUTCFullYear()!==t.getUTCFullYear(),i=o||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),a=r||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=uh[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=ch(e.getUTCHours()),h=ch(e.getUTCMinutes()),g=ch(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:a?`${d}:${h}:${g}`:s?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return o?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return o?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return o?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(r[i-1]),s):function(e,t){const n=uh[e.getUTCMonth()],o=e.getUTCDate(),i=e.getUTCFullYear(),r=ch(e.getUTCHours()),a=ch(e.getUTCMinutes()),s=ch(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${i} ${r}:${a}:${s}`;case"minutes":case"hours":return`${n} ${o}, ${i} ${r}:${a}`;case"days":return`${n} ${o}, ${i}`;case"months":return`${n} ${i}`;case"years":return""+i}}(a,s)}}function hh(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 gh(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")}`}function fh(e,t){return Yc(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:i=2,background:r="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),ph(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);yh(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*i,n=l.height*i,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,n),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),a.toBlob(n=>{n?(yh(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function ph(e,t){var n;const o=e.children,i=t.children,r=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,i.length)>e;e++)ph(o[e],i[e])}function yh(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const mh={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"},autoPlaceAnnotations:{type:["boolean","object"]},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},vh={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},bh={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},xh=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],kh=["vertical","horizontal"],wh={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},gradientFill:{type:["boolean","object"]},semanticGradient:{type:"array"},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:xh},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},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({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{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"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{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:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{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:kh},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},mh),{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({},mh),{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:"none",dataAccessors:[],props:Object.assign(Object.assign({},mh),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},gradientFill:{type:"object"},arcWidth:{type:"number"},cornerRadius:{type:"number"},sweep:{type:"number"},fillZones:{type:"boolean"},showNeedle:{type:"boolean"},needleColor:{type:"string"},color:{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({},mh),bh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{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({},mh),{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({},mh),{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:kh},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"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},mh),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},mh),{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({},mh),{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({},mh),{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"]},nodeStyle:{type:"function"}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},mh),{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({},mh),{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"},autoPlaceAnnotations:{type:["boolean","object"]},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"},direction:{type:"string",enum:["up","down"]},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"},autoPlaceAnnotations:{type:["boolean","object"]},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"}}},TemporalHistogram:{required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],props:{data:{type:"array"},binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"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"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","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"},autoPlaceAnnotations:{type:["boolean","object"]},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"},autoPlaceAnnotations:{type:["boolean","object"]},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"},autoPlaceAnnotations:{type:["boolean","object"]},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({},mh),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},mh),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},mh),{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({},mh),{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({},mh),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},mh),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})},BigNumber:{required:[],dataShape:"none",dataAccessors:[],props:{width:{type:["number","string"]},height:{type:["number","string"]},className:{type:"string"},onClick:{type:"function"},value:{type:"number"},label:{type:"string"},caption:{type:"string"},format:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},locale:{type:"string"},currency:{type:"string"},precision:{type:"number"},prefix:{type:"string"},suffix:{type:"string"},unit:{type:"string"},comparison:{type:"object"},target:{type:"object"},delta:{type:"number"},deltaFormat:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},showDeltaPercent:{type:"boolean"},direction:{type:"string",enum:["higher-is-better","lower-is-better","neutral"]},sentiment:{type:"string",enum:["auto","positive","negative","neutral"]},thresholds:{type:"array"},chartSlot:{type:["string","number","array","object","function"]},chartSize:{type:"number"},windowSize:{type:"number"},mode:{type:"string",enum:["tile","presentation","inline","thumbnail"]},align:{type:"string",enum:["start","center","end"]},padding:{type:["number","object"]},emphasis:{type:"string",enum:["primary","secondary"]},color:{type:"string"},background:{type:"string"},borderColor:{type:"string"},borderRadius:{type:["number","string"]},animate:{type:["boolean","object"]},stalenessThreshold:{type:"number"},staleLabel:{type:"string"},headerSlot:{type:["string","number","array","object","function"]},valueSlot:{type:["string","number","array","object","function"]},deltaSlot:{type:["string","number","array","object","function"]},trendSlot:{type:["string","number","array","object","function"]},footerSlot:{type:["string","number","array","object","function"]},onObservation:{type:"function"}}}},Ah=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Sh=new Set(["data","nodes","edges"]),Oh="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Ch(e,t,n){if(!wh[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(wh).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),i={};for(const[e,n]of Object.entries(t))null!=n&&(Ah.has(e)||!o&&Sh.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(i[e]=Oh(n))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function jh(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!wh[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Oh(e.props)}}function Mh(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ph(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function _h(e){return Yc(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Lh(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Lh(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function Th(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function $h(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function Nh(e){return"nominal"===e||"ordinal"===e}function Bh(e){return"quantitative"===e||"temporal"===e}const Dh={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},Eh={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},Ih={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Hh(e){var t,n,o,i,r,a,s,l,c,u,d,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:zc(e,["type"])}}(e.mark),y=e.encoding||{},m=y.x,v=y.y,b=y.color,x=y.size,k=y.theta,w=y.opacity;let A;(null===(t=e.data)||void 0===t?void 0:t.values)?A=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&g.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&g.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&g.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&g.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||y.facet||y.row||y.column)&&g.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&g.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&g.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const S={};e.width&&(S.width=e.width),e.height&&(S.height=e.height);const O=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(O&&(S.title=O),(null==b?void 0:b.field)&&(S.colorBy=b.field,null===(o=b.scale)||void 0===o?void 0:o.scheme)){const e=Dh[b.scale.scheme];e&&(S.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(S.pointOpacity=w.value);const C=null==m?void 0:m.aggregate,j=null==v?void 0:v.aggregate;if(A&&(C||j)){const e=j?v:m,t=j?m:v,n=Ih[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:n,value:o,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[n]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of r){let o;switch(i){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(A,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const n of A){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}A=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(S.data=A),(null==m?void 0:m.bin)?(S.valueAccessor=m.field,(null==v?void 0:v.field)&&(S.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(S.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(S.valueAccessor=v.field,(null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(S.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),n="object"==typeof t?t.maxbins:void 0;return n&&(S.bins=n),Fh(e,S,g)}let M;switch(f){case"bar":M=function(e,t,n,o,i,r,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",Nh(null==e?void 0:e.type)&&Bh(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):Bh(null==e?void 0:e.type)&&Nh(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=r?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),i&&(o.data=i),g}(m,v,b,S,A,C,j);break;case"line":if(M="LineChart",Rh(m,v,S,C,j),(null==b?void 0:b.field)&&(S.lineBy=b.field),p.interpolate){const e=Eh[p.interpolate];e&&(S.curve=e)}!0===p.point&&(S.showPoints=!0),A&&(S.data=A);break;case"area":if((null==b?void 0:b.field)?(M="StackedAreaChart",S.areaBy=b.field):M="AreaChart",Rh(m,v,S,C,j),p.interpolate){const e=Eh[p.interpolate];e&&(S.curve=e)}void 0!==p.opacity&&(S.areaOpacity=p.opacity),A&&(S.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(M="BubbleChart",S.sizeBy=x.field,(null===(a=x.scale)||void 0===a?void 0:a.range)&&(S.sizeRange=x.scale.range)):M="Scatterplot",Rh(m,v,S,C,j),A&&(S.data=A);break;case"rect":M="Heatmap",(null==m?void 0:m.field)&&(S.xAccessor=m.field),(null==v?void 0:v.field)&&(S.yAccessor=v.field),(null==b?void 0:b.field)&&(S.valueAccessor=b.field,delete S.colorBy),(null===(s=null==m?void 0:m.axis)||void 0===s?void 0:s.title)&&(S.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(S.yLabel=v.axis.title),A&&(S.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(M="DonutChart",S.innerRadius=p.innerRadius):M="PieChart",(null==k?void 0:k.field)?S.valueAccessor=k.field:(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null==b?void 0:b.field)&&(S.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(S.categoryAccessor=m.field),A&&(S.data=A);break;case"tick":M="DotPlot",Nh(null==m?void 0:m.type)?(S.categoryAccessor=m.field,(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(S.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(S.valueLabel=v.axis.title)):Nh(null==v?void 0:v.type)?(S.categoryAccessor=v.field,(null==m?void 0:m.field)&&(S.valueAccessor=C?"value":m.field),S.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(S.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(S.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field)),A&&(S.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),M="Scatterplot",Rh(m,v,S,C,j),A&&(S.data=A)}return Fh(M,S,g)}function Rh(e,t,n,o,i){var r,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function Fh(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}const Wh=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),zh=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Yh=new Set(["PieChart","DonutChart","FunnelChart"]),Gh=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function qh(e,t){var n,o;return zh.has(e)||Yh.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:null!==(n=t.categoryAccessor)&&void 0!==n?n:t.stepAccessor,dimensionFallback:"category"}:{measure:null!==(o=t.yAccessor)&&void 0!==o?o:t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Xh(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function Vh(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Uh(e,t={}){var n,o;const i=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,a=new Set;for(const t of e){const e=null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.supersedes;e&&"retracted"!==(null===(o=null==t?void 0:t.lifecycle)||void 0===o?void 0:o.status)&&a.add(e)}return e.filter(e=>{var t,n;if("retracted"===(null===(t=null==e?void 0:e.lifecycle)||void 0===t?void 0:t.status)&&!i)return!1;const o=null===(n=null==e?void 0:e.provenance)||void 0===n?void 0:n.stableId;return!(o&&a.has(o)&&!r)})}const Kh={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value"},Qh=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]);function Zh(e){return Kh[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}const Jh=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),eg={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},tg={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},ng=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],og={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function ig(e="en"){let t,n;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch(e){t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?n.format(e):t.format(e):e+""}const rg={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function ag(e){const t=rg["string"==typeof e.type?e.type:"annotation"]||"an annotation",n=function(e){var t,n;const o=e.provenance&&"object"==typeof e.provenance?e.provenance:null,i=null!==(n=null!==(t=null==o?void 0:o.authorKind)&&void 0!==t?t:null==o?void 0:o.source)&&void 0!==n?n:null==o?void 0:o.basis;return"watcher"===i?"a watcher-flagged ":"agent"===i||"ai"===i||"llm-inference"===i?"an AI-suggested ":""}(e),o=n?n+t.replace(/^an? /,""):t,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${o} labeled "${i}"`:o}function sg(e,t,n={}){var o,i;const r=void 0!==n.levels,a=new Set(null!==(o=n.levels)&&void 0!==o?o:["l1","l2","l3"]);!r&&n.capability&&a.add("l4");const s=ig(null!==(i=n.locale)&&void 0!==i?i:"en"),l=Zh(e),c=Array.isArray(t.data)?t.data:null,u=Xh(t),{measure:d,measureFallback:h,dimension:g,dimensionFallback:f}=qh(e,t),p="string"==typeof d&&d?d:h,y="string"==typeof g&&g?g:f,m={};if(a.has("l1"))if(Wh.has(e)||zh.has(e))m.l1=`A ${l} of ${p} by ${y}`+(u?`, split by ${u}.`:".");else if(Yh.has(e))m.l1=`A ${l} showing ${p} across ${y} categories.`;else if(Gh.has(e))m.l1=`A ${l} of the distribution of ${p}`+(u?` by ${u}.`:".");else if(Qh.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,n=Array.isArray(t.edges)?t.edges.length:void 0,o=[null!=e?`${e} ${cg(e,"node")}`:null,null!=n?`${n} ${cg(n,"edge")}`:null].filter(Boolean);m.l1=`A ${l}${o.length?" with "+o.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:p;m.l1=`A single value${e?" for "+e:""}.`}else m.l1=`A ${l}.`;const v=Wh.has(e)||zh.has(e)||Yh.has(e)||Gh.has(e);let b=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&v&&c&&c.length>0&&(b=function(e,t,n,o){let i=0,r=0,a=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,g=null,f=NaN,p=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===i&&(f=e,h=n),p=e,g=n,a>e&&(a=e,l=n,u=i),e>s&&(s=e,c=n,d=i),i++,r+=e)}return 0===i?null:{count:i,min:a,max:s,mean:r/i,minLabel:Vh(null!=l?n(l):null,o),maxLabel:Vh(null!=c?n(c):null,o),first:f,last:p,firstLabel:Vh(null!=h?n(h):null,o),lastLabel:Vh(null!=g?n(g):null,o),minIndex:u,maxIndex:d}}(c,Re(d,h),Fe(g,f),s)),a.has("l2")&&v&&(c&&0!==c.length?b&&(m.l2=Yh.has(e)?`${b.count} segments totaling ${s(function(e){return e.mean*e.count}(b))}. Largest is ${b.maxLabel} at ${s(b.max)}; smallest is ${b.minLabel} at ${s(b.min)}.`:`${p} ranges from ${s(b.min)} (${b.minLabel}) to ${s(b.max)} (${b.maxLabel}), with a mean of ${s(b.mean)} across ${b.count} points.`):m.l2="No data is loaded yet."),a.has("l3")&&b&&Wh.has(e)?m.l3=function(e,t,n){const{first:o,last:i,min:r,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:g}=e,f=a-r,p=i-o;if(0===f)return`${lg(t)} is constant at ${n(o)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${lg(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`;const y=h>0&&g-1>h,m=d>0&&g-1>d,v=(a-Math.max(o,i))/f,b=(Math.min(o,i)-r)/f;return y&&v>.15?`Overall ${t} climbs to a peak of ${n(a)} (${s}), then falls to ${n(i)} (${u}).`:m&&b>.15?`Overall ${t} drops to a low of ${n(r)} (${l}), then recovers to ${n(i)} (${u}).`:.05>Math.abs(p)/f?`${lg(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`:p>0?h===g-1?`Overall ${t} rises from ${n(o)} (${c}) to a peak of ${n(i)} (${u}).`:`Overall ${t} rises from ${n(o)} (${c}) to ${n(i)} (${u}), after peaking at ${n(a)} (${s}).`:d===g-1?`Overall ${t} falls from ${n(o)} (${c}) to a low of ${n(i)} (${u}).`:`Overall ${t} falls from ${n(o)} (${c}) to ${n(i)} (${u}), after dipping to ${n(r)} (${l}).`}(b,p,s):a.has("l3")&&b&&zh.has(e)&&(m.l3=`The highest ${y} is ${b.maxLabel} and the lowest is ${b.minLabel}.`),a.has("l4")){const o=function(e,t){var n;const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,n={};for(const[e,o]of Object.entries(t.intentScores))"number"==typeof o&&Number.isFinite(o)&&(n[e]=o);return{family:t.family,intentScores:Object.keys(n).length?n:void 0}}return e}}(t);if(null==o?void 0:o.act)return o.act;if(null==o?void 0:o.intentScores){const e=function(e){let t,n=0;for(const[o,i]of Object.entries(e))if("number"==typeof i&&i>0)if(i>n)t=o,n=i;else if(i===n&&void 0!==t){const e=ng.indexOf(o),n=ng.indexOf(t);-1===e||-1!==n&&e>=n||(t=o)}return t}(o.intentScores);if(e&&eg[e]&&(null!==(n=o.intentScores[e])&&void 0!==n?n:0)>=3)return eg[e]}return(null==o?void 0:o.family)?tg[o.family]:function(e){return Yh.has(e)||"StackedAreaChart"===e?"apportioning":Jh.has(e)?"relating":zh.has(e)?"comparing":Gh.has(e)?"characterizing":Wh.has(e)?"tracking":Qh.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,n.capability);o&&(m.l4=function(e,t,n,o,i,r,a,s){const l=og[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof n.label&&n.label?n.label:i} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${r} and ${i} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,n,o,i,r){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+n;case"comparing":return`compare ${n} across ${o}`;case"ranking":return"read it top to bottom by "+n;case"apportioning":return`read each ${o}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+n;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,n){if(zh.has(n)||Yh.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:o,last:i,min:r,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,g=a-r;if(g>0){const e=d>0&&h-1>d,n=u>0&&h-1>u,f=(a-Math.max(o,i))/g,p=(Math.min(o,i)-r)/g;if(e&&f>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(n&&p>.15)return`the dip to ${t(r)} at ${s} is the point to investigate`;if(i>=a)return`the climb to ${t(i)} at ${c} warrants a closer look`;if(r>=i)return`the drop to ${t(i)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(a)}) and ${s} (${t(r)}) — are the points to check`}(t,i,r);case"tracking":return`read it for the trajectory of ${n}, which ${function(e){const t=e.max-e.min,n=e.last-e.first;return 0===t||.05>Math.abs(n)/t?"holds roughly steady":n>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${n} across ${o}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${n}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,n=e>0?Math.round(t.max/e*100):null;return`read each ${o}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=n?` (${n}%)`:""}`}case"characterizing":return`read it for the spread of ${n}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,o,i,r,a,t)}return`${u}; ${d}.${function(e,t){var n;if(!t)return"";const o=null===(n=t.familiarity)||void 0===n?void 0:n[e];return"number"!=typeof o||o>2?"":` This ${Zh(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(o,e,t,b,p,y,s,n.audience))}const x=["l1","l2","l3","l4"].filter(e=>a.has(e)&&m[e]).map(e=>m[e]).join(" "),k=function(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const n=Uh(t.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return;const o=n.map(ag),i=o.slice(0,5),r=o.length-i.length,a=function(e){var t;return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:null!==(t=e[0])&&void 0!==t?t:""}(i)+(r>0?`, and ${r} more`:""),s=n.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}(t);return Object.assign({text:k?`${k} ${x}`.trim():x,levels:m},k?{annotations:k}:{})}function lg(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function cg(e,t){return 1===e?t:t+"s"}function ug(e,t,n={}){var o,i,r;const a=null!==(o=n.locale)&&void 0!==o?o:"en",s=Math.max(1,null!==(i=n.maxLeaves)&&void 0!==i?i:200),l=ig(a),c={id:"root",role:"chart",label:sg(e,t,{locale:a}).text||"Chart.",level:1,children:[]},u=function(e,t){const n=Array.isArray(e.annotations)?e.annotations:null;if(!n)return null;const o=Uh(n.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return null;let i=0;const r=o.slice(0,t).map(e=>{var t;const n=null===(t=e.lifecycle)||void 0===t?void 0:t.status,o=n&&"accepted"!==n?` (${n})`:"";return{id:"annotation-"+i++,role:"annotation",level:3,label:`${r=ag(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${o}.`,datum:e};var r});o.length>t&&r.push({id:"annotation-"+i++,role:"annotation",level:3,label:`…and ${o.length-t} more annotations.`});const a=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:r}}(t,s),d=Array.isArray(t.data)?t.data:null,h=Wh.has(e)||zh.has(e)||Yh.has(e)||Gh.has(e);if(!d||0===d.length||!h)return u&&(c.children=[u]),c;const{measure:g,measureFallback:f,dimension:p,dimensionFallback:y}=qh(e,t),m=Re(g,f),v=Fe(p,y),b="string"==typeof g&&g?g:f,x="string"==typeof p&&p?p:y,k=Xh(t);let w=0;const A=e=>`${e}-${w++}`,S=(e,t)=>{const n=e.slice(0,s).map(e=>((e,t)=>{const n=m(e),o=Vh(v(e),l);return{id:A("datum"),role:"datum",level:t,label:`${o}: ${Number.isFinite(n)?l(n):"—"}`,value:Number.isFinite(n)?n:void 0,datum:e}})(e,t));return e.length>s&&n.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),n},O=[];if(Wh.has(e)||zh.has(e)){let t=1/0,n=-1/0,o=1/0,i=-1/0;const r=[];let a=!0;for(const e of d){const s=m(e);Number.isFinite(s)&&(t>s&&(t=s),s>n&&(n=s));const l=v(e);r.push(l),"number"==typeof l&&Number.isFinite(l)?(o>l&&(o=l),l>i&&(i=l)):a=!1}const s=new Set,c=[];for(const e of r){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=a?`${l(o)} to ${l(i)}`:`${Vh(c[0],l)} to ${Vh(c[c.length-1],l)} (${zh.has(e)?c.length+" categories":d.length+" points"})`;O.push({id:A("axis"),role:"axis",level:2,label:`${zh.has(e)?"Category axis":"X axis"}: ${x}, ${u}.`}),t>n||O.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${b}, ${l(t)} to ${l(n)}.`})}if(k){const n=Fe(k,k),o=new Map;for(const e of d){const t=(null!==(r=n(e))&&void 0!==r?r:"—")+"",i=o.get(t);i?i.push(e):o.set(t,[e])}const i=[];for(const[n,r]of o){const o=sg(e,Object.assign(Object.assign({},t),{data:r}),{levels:["l2","l3"],locale:a}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${n}: ${o}`,children:S(r,3)})}c.children=[...O,...i]}else c.children=[...O,...S(d,2)];return u&&c.children.push(u),c}const dg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function hg({tree:n,label:i,visible:r=!1,className:a,onActiveChange:s,activeId:l,chartId:c}){const[u,d]=o.useState(()=>new Set([n.id])),[h,g]=o.useState(n.id),f=void 0!==l,p=f?l:h,y=o.useRef(null),m=o.useRef(new Map),v=o.useMemo(()=>function(e){const t=new Map,n=e=>{var o;for(const i of null!==(o=e.children)&&void 0!==o?o:[])t.set(i.id,e),n(i)};return n(e),t}(n),[n]),b=o.useMemo(()=>function(e,t){const n=[],o=e=>{if(n.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)o(t)};return o(e),n}(n,u),[n,u]);o.useEffect(()=>{f||b.some(e=>e.id===h)||g(n.id)},[b,h,n.id,f]),o.useEffect(()=>{const e=[];let t=v.get(p);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&d(t=>{if(e.every(e=>t.has(e)))return t;const n=new Set(t);for(const t of e)n.add(t);return n})},[p,v]),o.useEffect(()=>{var e,t;(null===(e=y.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=m.current.get(p))||void 0===t||t.focus())},[p]);const x=o.useCallback((e,t,n)=>{},[c]),k=o.useCallback(e=>{e.id!==p&&(f||g(e.id),null==s||s(e),x(e,"focus"))},[s,f,x,p]),w=e=>{d(t=>new Set(t).add(e.id)),x(e,"toggle",!0)},A=e=>{d(t=>{const n=new Set(t);return n.delete(e.id),n}),x(e,"toggle",!1)},S=(n,o,i)=>{const a=!!n.children&&n.children.length>0,s=u.has(n.id);return t("li",{role:"treeitem","aria-label":n.label,"aria-level":n.level,"aria-posinset":o,"aria-setsize":i,"aria-expanded":a?s:void 0,"aria-selected":n.id===p,tabIndex:n.id===p?0:-1,ref:e=>{m.current.set(n.id,e)},onClick:e=>{e.stopPropagation(),k(n),a&&(s?A:w)(n)},style:r?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(n.level-1),cursor:a?"pointer":"default",fontSize:13,background:n.id===p?"var(--semiotic-surface, #f0f4f8)":"transparent",outline:"none"}:void 0,children:[t("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+n.role,children:[r&&a?s?"▾ ":"▸ ":"",n.label]}),a&&s&&e("ul",{role:"group",style:r?{margin:0,padding:0}:void 0,children:n.children.map((e,t)=>S(e,t+1,n.children.length))})]},n.id)};return e("div",{ref:y,className:"semiotic-nav-tree"+(a?" "+a:""),style:r?void 0:dg,onKeyDown:e=>{const t=b.findIndex(e=>e.id===p);if(-1===t)return;const n=b[t],o=!!n.children&&n.children.length>0,i=u.has(n.id);let r=!0;switch(e.key){case"ArrowDown":k(b[Math.min(t+1,b.length-1)]);break;case"ArrowUp":k(b[Math.max(t-1,0)]);break;case"Home":k(b[0]);break;case"End":k(b[b.length-1]);break;case"ArrowRight":o&&!i?w(n):o&&i?k(n.children[0]):r=!1;break;case"ArrowLeft":if(o&&i)A(n);else{const e=v.get(n.id);e?k(e):r=!1}break;case"Enter":case" ":o?(i?A:w)(n):r=!1;break;default:r=!1}r&&(e.preventDefault(),e.stopPropagation())},children:e("ul",{role:"tree","aria-label":i||"Chart navigation",style:r?{margin:0,padding:0}:void 0,children:S(n,1,1)})})}const gg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function fg(){const n=function(){const e=o.useContext(gi);return e?()=>e.setVisible(e=>!e):null}();return n?e("button",{className:"semiotic-chart-action",onClick:n,title:"Data summary","aria-label":"Toggle data summary",style:bg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const pg={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function yg({height:t}){return e("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function mg({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const vg=o.forwardRef(function({title:i,subtitle:r,children:a,width:s="100%",height:l=400,actions:c,chartConfig:u,describe:d,navigable:h,controls:g,loading:f=!1,error:p,errorBoundary:y=!1,status:m,detailsPanel:v,className:b,style:x},k){var w;const A=o.useRef(null),S=o.useRef(null),[O,C]=o.useState(!1),j=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),M=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),P=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,_=!0===(null==c?void 0:c.dataSummary),L=o.useMemo(()=>{if(!d||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return"";const e="object"==typeof d?d.levels:void 0;try{return sg(u.component,u.props,e?{levels:e}:{}).text}catch(e){return""}},[d,u]),T="object"==typeof d&&!0===d.visible,$=o.useMemo(()=>{if(!h||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return null;const e="object"==typeof h?h.maxLeaves:void 0;try{return ug(u.component,u.props,e?{maxLeaves:e}:{})}catch(e){return null}},[h,u]),N="object"==typeof h&&!0===h.visible,B=o.useMemo(()=>"object"==typeof(null==c?void 0:c.export)?c.export:{},[null==c?void 0:c.export]),D="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",E=o.useCallback(e=>Yc(this,void 0,void 0,function*(){S.current&&(yield fh(S.current,Object.assign(Object.assign({},B),e)))}),[B]),I=o.useCallback(()=>{A.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):A.current.requestFullscreen().catch(()=>{}))},[]),H=o.useCallback(e=>Yc(this,void 0,void 0,function*(){var t,n;u&&(yield _h(Object.assign(Object.assign({},u),{version:null!==(t=u.version)&&void 0!==t?t:"1",createdAt:null!==(n=u.createdAt)&&void 0!==n?n:(new Date).toISOString()}),e||D||"json"))}),[u,D]);o.useEffect(()=>{const e=()=>{C(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),o.useImperativeHandle(k,()=>({export:E,toggleFullscreen:I,copyConfig:H,element:A.current}),[E,I,H]);const R=i||r||g||j||M||P||_||m,F=f?e(yg,{height:l}):p?e(mg,{error:p}):y?e(kc,{children:a}):a;return W=t(n,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:A,className:"semiotic-chart-container"+(b?" "+b:""),style:Object.assign(Object.assign({width:s,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},O?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),x),children:[R&&t("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[g,j&&e("button",{className:"semiotic-chart-action",onClick:()=>E(),title:"Export chart","aria-label":"Export chart",style:bg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),_&&e(fg,{}),M&&e("button",{className:"semiotic-chart-action",onClick:I,title:O?"Exit fullscreen":"Fullscreen","aria-label":O?"Exit fullscreen":"Enter fullscreen",style:bg,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(n,O?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),P&&e("button",{className:"semiotic-chart-action",onClick:()=>H(),title:"Copy config","aria-label":"Copy chart configuration",style:bg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),m&&e("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:pg[m].bg,color:pg[m].color,lineHeight:"18px"},children:m})]})]}),L&&e("div",{className:"semiotic-chart-description",role:"note",style:T?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:gg,children:L}),$&&e("div",{className:"semiotic-chart-nav",style:N?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:e(hg,{tree:$,label:"string"==typeof i&&i?i+" — navigable structure":"Chart navigable structure",visible:N,chartId:"string"==typeof(null===(w=null==u?void 0:u.props)||void 0===w?void 0:w.chartId)?u.props.chartId:void 0})}),t("div",{className:"semiotic-chart-body",ref:S,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},O?{flex:1}:{height:l}),children:[F,v]})]})]}),_?e(fi,{children:W}):W;var W}),bg={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function xg({children:t,columns:n="auto",minCellWidth:i=300,gap:r=16,className:a,style:s}){const l="number"==typeof n?n:void 0;return e("div",{className:"semiotic-chart-grid"+(a?" "+a:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},s),children:o.Children.map(t,t=>o.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function kg({children:n,context:o,position:i="right",contextSize:r=250,gap:a=12,className:s,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:a,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:n}),e("div",{style:h,children:o})]})}xg.displayName="ChartGrid",kg.displayName="ContextLayout";function wg({children:n,position:o="right",size:r=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[m,v]=d(null),[b,x]=d(null),[k,w]=d(!1),[A,S]=d(!1),O=i(null),C=i(void 0),j="click"===s?["click","click-end"]:["hover","hover-end"],{latest:M}=Nl({types:j,chartId:c,limit:1}),P=void 0!==u?u:M,_=l(()=>{S(!0),w(!1),clearTimeout(C.current),C.current=setTimeout(()=>{S(!1),v(null),x(null)},200)},[]);if(a(()=>{if(P)if("click"===P.type||"hover"===P.type){const e=P;v(e.datum),x(e),w(e=>(e||(S(!0),clearTimeout(C.current),C.current=setTimeout(()=>S(!1),200)),!0))}else!h||"click-end"!==P.type&&"hover-end"!==P.type||_()},[h,_,P]),a(()=>{null==f||f(k)},[k,f]),a(()=>()=>clearTimeout(C.current),[]),!m&&!A)return null;const L=m&&b?n(m,b):null;if(null===L&&!A)return null;const T=function(e,t,n,o){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(o,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${o}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:_,"aria-label":"Close details",style:Ag,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const Ag={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function Sg(e){var t;if("datum"===e.role&&e.datum)return e.datum;for(const n of null!==(t=e.children)&&void 0!==t?t:[]){const e=Sg(n);if(e)return e}return null}function Og(e,t){return e?t.map(t=>e[t]+"").join(""):""}function Cg(e){var t;const{tree:n,chartId:o,observe:s=["hover","click"]}=e,c=null!==(t=e.selectionName)&&void 0!==t?t:"__semiotic-nav-sync"+(o?":"+o:""),u=r(()=>{if(e.matchFields)return e.matchFields;const t=Sg(n);return t?Object.keys(t).filter(e=>{return!e.startsWith("_")&&(null==(n=t[e])||"string"==typeof n||"number"==typeof n||"boolean"==typeof n);var n}):[]},[e.matchFields,n]),h=r(()=>{const e=new Map,t=n=>{var o;if("datum"===n.role&&n.datum){const t=Og(n.datum,u);e.has(t)||e.set(t,n.id)}for(const e of null!==(o=n.children)&&void 0!==o?o:[])t(e)};return t(n),e},[n,u]),{selectPoints:g,clear:f}=Pl({name:c}),{latest:p}=Nl({chartId:o,types:[...s,"hover-end"],limit:1}),[y,m]=d(n.id);a(()=>{m(n.id),f()},[n,f]);const v=l(e=>{if(m(e.id),"datum"===e.role&&e.datum&&u.length>0){const t={};for(const n of u)t[n]=[e.datum[n]];g(t)}else f()},[u,g,f]),b=e.annotations,x=r(()=>{const e=new Set;if(0===u.length||!b)return e;for(const t of b){const n=h.get(Og(t,u));n&&e.add(n)}return e},[b,h,u]),k=l(e=>{const t="number"==typeof e?null==b?void 0:b[e]:e;if(!t||0===u.length)return!1;const n=h.get(Og(t,u));if(!n)return!1;m(n);const o={};for(const e of u)o[e]=[t[e]];return g(o),!0},[b,h,u,g]),w=i(null);return a(()=>{if(!p||p===w.current)return;if(w.current=p,"hover-end"===p.type)return;const e=p.datum;if(!e||0===u.length)return;const t=h.get(Og(e,u));t&&t!==y&&m(t)},[p,h,u,y]),{activeId:y,onActiveChange:v,selection:{name:c},annotatedIds:x,focusAnnotation:k}}wg.displayName="DetailsPanel";export{hg as AccessibleNavTree,iu as AreaChart,Ru as BarChart,td as BoxPlot,cu as BubbleChart,Vl as CARBON_ALERT,Xl as CARBON_CATEGORICAL_14,Ae as COLOR_BLIND_SAFE_CATEGORICAL,Tu as CandlestickChart,xl as CategoryColorProvider,vg as ChartContainer,kc as ChartErrorBoundary,xg as ChartGrid,Od as ChordDiagram,Yd as CirclePack,Jc as ConnectedScatterplot,kg as ContextLayout,Oe as DARK_THEME,wg as DetailsPanel,au as DifferenceChart,cd as DonutChart,sd as DotPlot,Sd as ForceDirectedGraph,ad as FunnelChart,yd as GaugeChart,md as GroupedBarChart,Ce as HIGH_CONTRAST_THEME,lu as Heatmap,od as Histogram,Le as IncrementalExtent,Se as LIGHT_THEME,Qu as LikertChart,tu as LineChart,zl as LinkedCharts,bu as MinimapChart,_u as MultiAxisLineChart,qi as MultiLineTooltip,Du as NetworkCustomChart,qd as OrbitDiagram,Eu as OrdinalCustomChart,ld as PieChart,Fd as ProcessSankey,Ou as QuadrantChart,ah as RealtimeHeatmap,th as RealtimeHistogram,Jd as RealtimeLineChart,ih as RealtimeSwarmChart,oh as RealtimeTemporalHistogram,rh as RealtimeWaterfallChart,rd as RidgelinePlot,_e as RingBuffer,Cd as SankeyDiagram,Qc as Scatterplot,mu as ScatterplotMatrix,su as StackedAreaChart,Fu as StackedBarChart,ll as StreamNetworkFrame,ma as StreamOrdinalFrame,$r as StreamXYFrame,Ju as SwarmPlot,vd as SwimlaneChart,Ul as THEME_PRESETS,nh as TemporalHistogram,ic as ThemeProvider,Gi as Tooltip,Wd as TreeDiagram,zd as Treemap,id as ViolinPlot,Bu as XYCustomChart,dh as adaptiveTimeTicks,ug as buildNavigationTree,Lh as configToJSX,_h as copyConfig,aa as createHatchPattern,hh as darkenColor,$h as deserializeSelections,fh as exportChart,jh as fromConfig,Ph as fromURL,Hh as fromVegaLite,gh as lightenColor,Vi as normalizeTooltip,Kl as resolveThemePreset,Th as serializeSelections,sh as smartTickFormat,Ql as themeToCSS,Zl as themeToTokens,Ch as toConfig,Mh as toURL,Tl as useBrushSelection,kl as useCategoryColors,Nl as useChartObserver,$l as useFilteredData,_l as useLinkedHover,Cg as useNavigationSync,Pl as useSelection,rc as useTheme};
|