semiotic 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +113 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +67 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +44 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
- package/dist/components/realtime/types.d.ts +2 -4
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +1 -3
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +1 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +13 -0
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +45 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +35 -1
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +44 -1
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +38 -17
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{createContext as o,useMemo as i,useContext as a,useRef as s,useCallback as c,useSyncExternalStore as l,useState as u,useEffect as d,forwardRef as h,useImperativeHandle as y,useId as g}from"react";import{interpolateNumber as p}from"d3-interpolate";import{min as f,groups as v,max as m,sum as b,mean as x,group as k}from"d3-array";import{schemeCategory10 as A,interpolatePlasma as w,interpolateViridis as S,interpolatePurples as O,interpolateOranges as L,interpolateGreens as j,interpolateReds as D,interpolateBlues as C,schemeSet3 as E,schemeTableau10 as P}from"d3-scale-chromatic";import{forceLink as I,forceSimulation as _,forceManyBody as M,forceCenter as T,forceX as N,forceY as W}from"d3-force";import{scaleLinear as $,scaleOrdinal as B}from"d3-scale";import{ribbon as R,chord as z}from"d3-chord";import{arc as H,pie as F}from"d3-shape";import{hierarchy as Y,partition as q,pack as X,treemap as G,treemapBinary as V,cluster as K,tree as U}from"d3-hierarchy";function Z(e,t,r,n){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:r,time:t,value:r}),n)}const Q={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},J={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class ee{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 r=this.particles[t];return r.active=!0,r.t=0,r.offset=Math.random()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}step(e,t,r,n){var o;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=r[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(i);continue}const c=n&&null!==(o=n[a.edgeIndex])&&void 0!==o?o:1;a.t+=e*t*c*(s.bezier.circular?.3:1),1>a.t?te(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(i))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].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 r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}}function te(e,t,r,n){if(e.circular&&e.segments)return void function(e,t,r,n,o){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),c=a-s,[l,u,d,h]=e[s];re(l,u,d,h,c,o);const y=h.x-l.x,g=h.y-l.y,p=Math.sqrt(y*y+g*g);if(p>.001){const e=y/p;o.x+=-g/p*r*n*2,o.y+=e*r*n*2}}(e.segments,t,r,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[o,i,a,s]=e.points;re(o,i,a,s,t,n);const c=s.x-o.x,l=s.y-o.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;n.x+=-l/u*r*e.halfWidth*2,n.y+=t*r*e.halfWidth*2}}function re(e,t,r,n,o,i){const a=1-o,s=a*a,c=s*a,l=o*o,u=l*o;i.x=c*e.x+3*s*o*t.x+3*a*l*r.x+u*n.x,i.y=c*e.y+3*s*o*t.y+3*a*l*r.y+u*n.y}function ne(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function oe(e,t){var r,n=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===r?(u(r,o),d=!0):i[n]||(d=l(n));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[n=s[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,t){var r=[].concat(t).concat(e);n.push(r)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)r[c]=-1,n[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function y(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var y=e[t=l[l.length-1]];if(y.length>i[t]){for(var g=i[t];y.length>g;++g){var p=y[g];if(0>r[p]){r[p]=n[p]=u,o[p]=!0,u+=1,c.push(p),l.push(p);break}o[p]&&(n[t]=0|Math.min(n[t],n[p])),0>a[p]||s[t].push(a[p])}i[t]=g}else{if(n[t]===r[t]){var f=[],v=[],m=0;for(g=c.length-1;g>=0;--g){var b=c[g];if(o[b]=!1,f.push(b),v.push(s[b]),m+=s[b].length,a[b]=d.length,b===t){c.length=g;break}}d.push(f);var x=Array(m);for(g=0;v.length>g;g++)for(var k=0;v[g].length>k;k++)x[--m]=v[g][k];h.push(x)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&y(c);for(c=0;h.length>c;c++){var g=h[c];if(0!==g.length){g.sort(function(e,t){return e-t}),l=[g[0]];for(var p=1;g.length>p;p++)g[p]!==g[p-1]&&l.push(g[p]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],r=a);var c=o[r];if(!c)return!1;var l=e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})});return{leastVertex:i,adjList:l}}r=0;for(var h=e.length;h>r;){var y=d(r);if(r=y.leastVertex,s=y.adjList){for(var g=0;s.length>g;g++)for(var p=0;s[g].length>p;p++){var f=s[g][p];i[+f]=!1,a[f]={}}l(r),r+=1}else r=h}return n}function ie(e){return e.y0-e.y1>0?"up":"down"}function ae(e,t){return t(e.source)==t(e.target)}function se(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function ce(e){return e.target.x0-e.source.x1}function le(e,t){var r=de(e),n=ce(t)/Math.tan(r);return"up"==ie(e)?e.y1-n:e.y1+n}function ue(e,t){var r=de(e),n=ce(t)/Math.tan(r);return"up"==ie(e)?e.y1+n:e.y1-n}function de(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function he(e,t){return t(e)}function ye(e){return pe(e.source)}function ge(e){return pe(e.target)}function pe(e){return(e.y0+e.y1)/2}function fe(e){return e.virtual?0:e.value}function ve(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!ae(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!ae(e,t)?n+1:n}),r+n}function me(e){return e.target.depth}function be(e,t){return e.sourceLinks.length?e.depth:t-1}function xe(e,t){return e.y0-t.y0}function ke(e,t){return t.y0-e.y0}function Ae(e,t){return e.y1-t.y1}function we(e,t){return t.y1-e.y1}function Se(e,t){return Le(e.source,t.source)||e.index-t.index}function Oe(e,t){return Le(e.target,t.target)||e.index-t.index}function Le(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function je(e,t){return De(e)==De(t)?"bottom"==e.circularLinkType?ke(e,t):xe(e,t):De(t)-De(e)}function De(e){return e.target.column-e.source.column}function Ce(e,t){return Ee(e)==Ee(t)}function Ee(e){return e.y0-e.y1>0?"up":"down"}function Pe(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=f(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),Ie(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),Ie(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.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,ae(e,t)&&se(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+o+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-o-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,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?ke:xe);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?we:Ae),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+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-o-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,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function Ie(e,t,r){e.sort(je);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(ae(e,t)&&se(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var s=n[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&_e(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function _e(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Me(e){return function(){return e}}function Te(e){return e.index}function Ne(e){return e.nodes}function We(e){return e.links}function $e(e,t,r){var n=v(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(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=pe(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=pe(e.target)*t,n+=t}}),n>0?o/n:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=s.get(e),n=s.get(t),o=r.bc,i=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(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ve(t,r)-ve(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.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==ve(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function Be(e,t,r,n,o,i){var a=v(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,c=i;c>0;--c)l(s*=.99,r),u();function l(t,r){var n=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&ve(o,r)>0){var c=x(o.sourceLinks,ge),l=x(o.targetLinks,ye),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-pe(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=x(o.sourceLinks,ge),y=x(o.targetLinks,ye),g=((h&&y?(h+y)/2:h||y)-pe(o))*t;o.y0+=g,o.y1+=g}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||Le),s=0;l>s;++s)(a=c-(i=r[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+n;if((a=c-n-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=r[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function Re(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Oe),e.targetLinks.sort(Se)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=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=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function ze(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=Te,c=be,l=void 0,u=32,d=2,h=Ne,y=We;function g(){var g={nodes:h.apply(null,arguments),links:y.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return k(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=ne(r,n)),"object"!=typeof o&&(o=e.target=ne(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;n[a]||(n[a]=[]),n[s]||(n[s]=[]),-1===n[a].indexOf(s)&&n[a].push(s)}var c=oe(n);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||l[n]&&l[n][t]?(e.circular=!0,e.circularLinkID=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,l),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){he(e,t)!=he(o.source,t)&&he(e,t)!=he(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),ae(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(b(e.sourceLinks,fe),b(e.targetLinks,fe)),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,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-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(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,l,c);var y=i;if(null!==a){var g=v(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=m(g,function(e){return e.length});p>1&&(y=Math.max(1,(n-t)*a/(p-1)))}(function(e,t,r){var n=v(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 o=f(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/b(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=m(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,y,o),$e(h,l,s),Be(h,l,s,y,y,u),Re(h),Pe(h,s,d,10,8),$e(h,l,s),Be(h,l,s,y,y,u),Re(h),Pe(h,s,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return he(r.source,t)==he(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ce(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=le(t,e);return e.y1-r}if(t.target.column>e.target.column)return le(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return he(r.target,t)==he(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ce(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=ue(t,e);return e.y0-r}if(t.source.column>e.source.column)return ue(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){var i=f(t,function(e){return e.y0}),a=m(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function c(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),r.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=c(e.y0)-e.y0;e.y0=c(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),Pe(h,s,d,10,8)}(g),g}return g.update=function(e){return Re(e),Pe(e,s,d,10,8),e},g.nodeWidth=function(e){return arguments.length?(o=+e,g):o},g.nodePadding=function(e){return arguments.length?(i=+e,g):i},g.nodePaddingRatio=function(e){return arguments.length?(a=+e,g):a},g.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Me(e),g):h},g.links=function(e){return arguments.length?(y="function"==typeof e?e:Me(e),g):y},g.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Me(e),g):s},g.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Me(e),g):c},g.nodeSort=function(e){return arguments.length?(l=e,g):l},g.iterations=function(e){return arguments.length?(u=+e,g):u},g.circularLinkGap=function(e){return arguments.length?(d=+e,g):d},g.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],g):[[e,t],[r,n]]},g.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],g):[r-e,n-t]},g}const He=e=>{let t,r,n,o,i,a,s,c,l;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=p(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${r},${l} ${r},${a}L${n},${a}C${n},${l} ${o},${c} ${o},${i}Z`):(t=e.source.x1,r=e.target.x0,s=p(t,r),n=s(.5),o=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,c=e.y1+e.sankeyWidth/2,l=e.y0+e.sankeyWidth/2,`M${t},${i}C${n},${i} ${o},${a} ${r},${a}L${r},${c}C${o},${c} ${n},${l} ${t},${l}Z`)};function Fe(e){var t;const r=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,o=e.circularPathData;if(!o)return null;if("down"===e.direction)return null;if(e._circularStub){const t=o.sourceX,n=o.sourceY,i=o.targetX,a=o.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*(o.rightFullExtent-t))),c=Math.max(15,Math.min(40,.33*(i-o.leftFullExtent)));return`M${t},${n-r}L${t+s},${n-r}L${t+s},${n+r}L${t},${n+r}ZM${i},${a-r}L${i-c},${a-r}L${i-c},${a+r}L${i},${a+r}Z`}const i=o.sourceX,a=o.sourceY,s=o.targetX,c=o.targetY,l=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,y=Math.max(4,Math.min(n,15));return`M${i},${a-h*r}L${l},${a-h*r}L${l+n},${a-h*r+h*y}L${l+n},${d+h*n-h*y}L${l+n-y},${d+h*n}L${u-n+y},${d+h*n}L${u-n},${d+h*n-h*y}L${u-n},${c-h*r+h*y}L${u-n+y},${c-h*r}L${s},${c-h*r}L${s},${c+h*r}L${u+n},${c+h*r}L${u+n},${d-h*n}L${l-n},${d-h*n}L${l-n},${a+h*r}L${i},${a+h*r}Z`}const Ye=new Set,qe=new WeakMap;function Xe(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let r=qe.get(e);if(r){const e=r.get(t);if(e)return e}else r=new Map,qe.set(e,r);const n=new Proxy(e,{get(e,r,n){if("string"==typeof r&&!(r in e)&&e.data&&r in e.data){const e=`${t}:${r}`;Ye.has(e)||(Ye.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,r,n)}});return r.set(t,n),n}const Ge={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(me))-1:0},justify:be};function Ve(e){return"string"==typeof e?e:e.id}const Ke={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i,a,s,c,l,u;if(0===e.length)return;const d="vertical"===r.orientation?"down":"right",h=r.nodeAlign||"justify",y=null!==(o=r.nodeWidth)&&void 0!==o?o:15,g=null!==(i=r.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=r.iterations)&&void 0!==a?a:100,f=e.map(e=>Object.assign({},e)),v=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 m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=ze().extent(m).links(v).nodes(f).nodeAlign(Ge[h]||be).nodeId(e=>e.id).nodeWidth(y).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(g),b();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of f)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(null!==(c=null!==(s=n._circularWidth)&&void 0!==s?s:n.width)&&void 0!==c?c:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-r,u=n[0],d=n[1];if(i>0&&a>0&&(0>e||0>r||t>u||o>d)){const t=Math.min(u/i,d/a),n=-e*t+(u-i*t)/2,o=-r*t+(d-a*t)/2;for(const e of f)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of v)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(null!==(l=e.width)&&void 0!==l?l:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of f){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 v){const t=Ve(e.source),r=Ve(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${r}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u: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=d;const o=x.get(t),i=x.get(r);o&&(n.source=o),i&&(n.target=i)}}},buildScene(e,t,r,n){var o,i,a,s,c,l;const u="vertical"===r.orientation?"down":"right",d=r.nodeStyle,h=r.edgeStyle,y=null!==(o=r.edgeOpacity)&&void 0!==o?o:.5,g=r.edgeColorBy||"source",p=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:A,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=d?d(Xe(t,"nodeStyle")):{},o={fill:n.fill||f.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof o.fill?o.fill:null)||f.get(t.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:o,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:o,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 o=(null===(i=r.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=r.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";o="function"==typeof g?g(e)||o:"target"===g?x.get(n.id)||f.get(n.id)||o:x.get(t.id)||f.get(t.id)||o;const u=h?h(Xe(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),i=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=u.fill||o;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+n},${t.sourceY-r}L${t.sourceX+n},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:y,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-i},${t.targetY-r}L${t.targetX-i},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:a,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:y,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-i,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?Fe(e):He(e),!d)continue;const p={fill:u.fill||o,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:y,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==r.showLabels){const t=(w=r.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const r of e){const e=r.x1-r.x0,o=r.y1-r.y0;if(0>=e||0>=o)continue;const i=t?t(r):r.id;if(!i)continue;let a,s,c;"down"===u?(a=r.y0+(r.y1-r.y0)/2,s=r.x1+14,c="start"):(n[0]/2>r.x0+e/2?(a=r.x0-6,c="end"):(a=r.x1+6,c="start"),s=r.y0+o/2),b.push({x:a,y:s,text:i+"",anchor:"down"===u?"middle":c,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},Ue={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i;if(0===e.length)return;const a=null!==(o=r.forceStrength)&&void 0!==o?o:.1,s=n[0]/2,c=n[1]/2,l=r.__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),r=null==l?void 0:l.get(t.id);e?u++:r?(t.x=r.x,t.y=r.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of d){const n=Ze(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=Qe(e.id),i=o%360*(Math.PI/180),a=10+o%20;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=Qe(e.id),r=t%360*(Math.PI/180),n=15+t%30;e.x=s+n*Math.cos(r),e.y=c+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5),o=r*t;n.x=s+e*Math.cos(o),n.y=c+e*Math.sin(o)}}}const y=null!==(i=r.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=0===r.iterations?0:h?40:y,p=Je(r.nodeSize,r.nodeSizeRange,e),f=e=>p(e);if(g>0){const r=I().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),n=_().force("charge",M().strength(e=>-25*f(e))).force("center",T(s,c).strength(.8)).force("x",N(s).strength(.15)).force("y",W(c).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}));n.force("link",r),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;g>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=f(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 v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){var o,i,a,s,c,l,u;const d=r.nodeStyle,h=r.edgeStyle,y=Je(r.nodeSize,r.nodeSizeRange,e),g=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:A,p=new Map;e.forEach((e,t)=>{p.set(e.id,g[t%g.length])});const f=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=y(Xe(t,"nodeSize")),n=d?d(Xe(t,"nodeStyle")):{},s={fill:n.fill||p.get(t.id)||(null===(o=r.themeSemantic)||void 0===o?void 0:o.primary)||"#007bff",stroke:n.stroke||(null===(i=r.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=n.strokeWidth)&&void 0!==a?a:2,opacity:n.opacity};f.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),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 o=h?h(Xe(e,"edgeStyle")):{},i={stroke:o.stroke||(null===(s=r.themeSemantic)||void 0===s?void 0:s.border)||(null===(c=r.themeSemantic)||void 0===c?void 0:c.secondary)||"#999",strokeWidth:null!==(l=o.strokeWidth)&&void 0!==l?l:1,opacity:null!==(u=o.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:i,datum:e})}if(!1!==r.showLabels){const t=(x=r.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=y(Xe(r,"nodeSize"));m.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:f,sceneEdges:v,labels:m}}};function Ze(e,t,r){const n=[];for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,i="string"==typeof o.target?o.target:o.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=r.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function Qe(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function Je(e,t,r){var n,o;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=r.map(t=>{var r;return null===(r=t.data)||void 0===r?void 0:r[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(n=f(a))&&void 0!==n?n:0,c=null!==(o=m(a))&&void 0!==o?o:1;if(s===c)return()=>(i[0]+i[1])/2;const l=$().domain([s,c]).range(i).clamp(!0);return t=>{var r;const n=null===(r=t.data)||void 0===r?void 0:r[e];return null==n||"number"!=typeof n?i[0]:l(n)}}const et=A,tt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=r,s=Math.min(n[0],n[1])/2,c=s-i,l=n[0]/2,u=n[1]/2,d=(h=r.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 y=new Map;for(let t=0;e.length>t;t++)y.set(e[t].id,t);const g=e.length,p=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=y.get("string"==typeof e.source?e.source:e.source.id),n=y.get(t);if(void 0===r||void 0===n)continue;const o=d(e);p[r][n]=o}const f=z().padAngle(o);a&&f.sortGroups(a);const v=f(p),m=v.groups,b=H().innerRadius(c).outerRadius(s);for(const t of m){const r=e[t.index],n=b.centroid(t);r.x=n[0]+l,r.y=n[1]+u,r.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,r=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);r&&(e.source=r),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 v){const r=e[t.source.index].id,n=e[t.target.index].id,o=k.get(`${r}\0${n}`)||k.get(`${n}\0${r}`);o&&(o.chordData=t)}},buildScene(e,t,r,n){var o,i,a,s;const{groupWidth:c=20,edgeOpacity:l=.5}=r,u=Math.min(n[0],n[1])/2,d=u-c,h=n[0]/2,y=n[1]/2,g=r.nodeStyle,p=r.edgeStyle,f=r.edgeColorBy||"source",v=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:et,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=R().radius(d),x=[],k=[],A=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.arcData;if(!n)continue;let i;i=g?g(Xe(r,"nodeStyle")).fill||m.get(r.id)||v[t%v.length]:m.get(r.id)||v[t%v.length];const a=g?g(Xe(r,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(o=a.strokeWidth)&&void 0!==o?o:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:y,innerR:d,outerR:u,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:s,datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=b(t);if(!n)continue;const o=rt(n,h,y);let c=(null===(i=r.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=r.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(p)c=p(Xe(e,"edgeStyle")).fill||c;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===f&&r?c=m.get(r.id)||c:t&&(c=m.get(t.id)||c)}const u=p?p(Xe(e,"edgeStyle")):{},d={fill:c,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:l,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:o,style:d,datum:e})}if(!1!==r.showLabels){const t=(w=r.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,n=u+12;for(const r of e){const e=r.arcData;if(!e)continue;const o=t?t(r):r.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;A.push({x:h+Math.cos(a)*n,y:y+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:x,sceneEdges:k,labels:A}}};function rt(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}const nt=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function ot(e){const[t,r,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*r+.114*n>150?"#222":"#fff"}function it(e,t,r){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-"+r}function at(e){return e?"function"==typeof e?e:t=>{var r;return(null===(r=t.data)||void 0===r?void 0:r[e])||t[e]||t.id}:null}function st(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:nt}function ct(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 lt(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}const ut={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){var o;const i=r.__hierarchyRoot;if(!i)return;const a=r.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(r.childrenAccessor),c=r.hierarchySum,l="function"==typeof c?c:"string"==typeof c?e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0},u=Y(i,s);u.sum(l),u.sort((e,t)=>{var r,n;return(null!==(r=t.value)&&void 0!==r?r:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(a){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=U();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=K();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"treemap":!function(e,t,r,n){var o,i;const a=null!==(o=t.padding)&&void 0!==o?o:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,c=G().size([r,n]).tile(V).padding(a);s>0&&c.paddingTop(s),c(e)}(u,r,d,h);break;case"circlepack":!function(e,t,r,n){var o;const i=null!==(o=t.padding)&&void 0!==o?o:4;X().size([r,n]).padding(i)(e)}(u,r,d,h);break;case"partition":!function(e,t,r,n){var o;q().size([r,n]).padding(null!==(o=t.padding)&&void 0!==o?o:1)(e)}(u,r,d,h)}const y=u.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;y.length>t;t++){const n=y[t],i={id:it(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=n.value)&&void 0!==o?o:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===a||"cluster"===a?dt(i,n,r):"treemap"===a||"partition"===a?ht(i,n):"circlepack"===a&&yt(i,n),i.__hierarchyNode=n,e.push(i),g.set(n,i)}if("tree"===a||"cluster"===a)for(const e of y)if(e.parent){const r=g.get(e.parent),n=g.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){var a,s,c,l,u,d,h,y;const g=[],p=[],f=[],v=r.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(A=r.nodeSize)?A:5;var A;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const i=o(Xe(t,"nodeStyle"));let c=i.fill||ct(r);if(r.colorByDepth&&void 0!==t.depth){const e=st(r);c=e[t.depth%e.length]}const l={fill:c,stroke:i.stroke||(null===(a=r.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(s=i.strokeWidth)&&void 0!==s?s:1,opacity:i.opacity};g.push({type:"circle",cx:e,cy:n,r:k,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const w=null!==(c=r.edgeOpacity)&&void 0!==c?c:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,a=t.y,s=n.x,c=n.y;m&&(o+=b,a+=x,s+=b,c+=x);const y=lt(o,a,s,c,v),g=i(Xe(e,"edgeStyle")),f={fill:"none",stroke:g.stroke||(null===(l=r.themeSemantic)||void 0===l?void 0:l.border)||(null===(u=r.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=g.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=g.opacity)&&void 0!==h?h:w};p.push({type:"curved",pathD:y,style:f,datum:e})}if(!1!==r.showLabels){const t=at(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,s=r.y;if(m&&(a+=b,s+=x),m){const e=a-b,t=s-x,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=s+t/r*10,i=0>e?"end":"start"):(n=a,o=s-12,i="middle")}else"horizontal"===v?((null===(y=r.data)||void 0===y?void 0:y.children)&&0!==r.data.children.length?(n=a-k-6,i="end"):(n=a+k+6,i="start"),o=s):(n=a,o=s+k+14,i="middle");f.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:p,labels:f}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){var o,i,a,s,c;const l=[],u=[];for(const r of e){const e=r.x1-r.x0,a=r.y1-r.y0;if(0>=e||0>=a)continue;const s=n(Xe(r,"nodeStyle"));let c=s.fill||ct(t);if(t.colorByDepth&&void 0!==r.depth){const e=st(t);c=e[r.depth%e.length]}const u={fill:c,stroke:s.stroke||(null===(o=t.themeSemantic)||void 0===o?void 0:o.surface)||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};l.push({type:"rect",x:r.x0,y:r.y0,w:e,h:a,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=at(t.nodeLabel),o=t.labelMode||"leaf",i="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,d=l.y1-l.y0;if(0>=e||0>=d)continue;const h=!((null===(a=l.data)||void 0===a?void 0:a.children)&&l.data.children.length>0);if(!i){if("leaf"===o&&!h)continue;if("parent"===o&&h)continue}const y=r?r(l):l.id;if(!y)continue;if((h?30:40)>e||(h?16:14)>d)continue;let g=n(Xe(l,"nodeStyle")).fill||ct(t);if(t.colorByDepth&&void 0!==l.depth){const e=st(t);g=e[l.depth%e.length]}const p="string"==typeof g?ot(g):null!==(c=null===(s=t.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==c?c:"#000";u.push(h?{x:l.x0+e/2,y:l.y0+d/2,text:y+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:l.x0+4,y:l.y0+12,text:y+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:l,sceneEdges:[],labels:u}}(e,r,0,o);case"circlepack":return function(e,t,r,n){var o,i,a,s,c,l,u,d,h,y;const g=[],p=[];for(const r of e){const e=null!==(o=r.__radius)&&void 0!==o?o:5;if(0>=e)continue;const c=n(Xe(r,"nodeStyle"));let l=c.fill||ct(t);if(t.colorByDepth&&void 0!==r.depth){const e=st(t);l=e[r.depth%e.length]}const u={fill:l,stroke:c.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=c.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=c.opacity)&&void 0!==s?s:.7};g.push({type:"circle",cx:r.x,cy:r.y,r:e,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=at(t.nodeLabel);for(const o of e){const e=null!==(c=o.__radius)&&void 0!==c?c:5,i=r?r(o):o.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=o.data)||void 0===l?void 0:l.children)&&o.data.children.length>0);let s=n(Xe(o,"nodeStyle")).fill||ct(t);if(t.colorByDepth&&void 0!==o.depth){const e=st(t);s=e[o.depth%e.length]}if(a){const r="string"==typeof s?ot(s):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:o.x,y:o.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:r})}else p.push({x:o.x,y:o.y-e+14,text:i+"",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===(y=t.themeSemantic)||void 0===y?void 0:y.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:g,sceneEdges:[],labels:p}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function dt(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-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 ht(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 yt(e,t){var r;const n=null!==(r=t.r)&&void 0!==r?r: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 gt(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const pt={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),c=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var r;return(null!==(r=e[t])&&void 0!==r?r:"")+""}}(r.nodeIDAccessor),l=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),u=null!==(i=r.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=r.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,y="number"==typeof d?()=>d:d,g=gt(r);g.metaMap.clear(),n.length=0,o.length=0;const p=new Map;function f(e){var t;const r=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,r+1),0===r?e:`${e}__${r}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=f(c(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),g.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,i,a,u,d,p){const v=s(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=l[Math.min(k,l.length-1)],k++,b++;let A=0;for(let m=0;b>m;m++){const x=l[Math.min(m,l.length-1)],k=v.slice(A,A+x);if(!k.length)break;const w=(m+1)/b,S={id:r,depth:d,data:t,parentId:r},O=p?u/h(S)*w:u*w,L=F().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=L(k),D=y(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,l=k[t],u=f(c(l)),h=i+O*Math.sin(s),y=a+O*Math.cos(s)*D;n.push({id:u,x:h,y:y,x0:h,x1:h,y0:y,y1:y,width:0,height:0,value:0,depth:d,data:l}),g.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:r,eccentricity:D}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(l,u,h,y,O,d+1,!0)}A+=x}}(e,x,v,m,b,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){var o,i,a,s,c,l,u;const d=r.nodeStyle,h=r.nodeSize,y="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,g=[],p=[],f=[];if(!1!==r.orbitShowRings){const t=gt(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,c=(o+1)/i*Math.PI*2;p.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(c),y2:t+r*Math.cos(c)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(Xe(t,"nodeSize")),n=d?d(Xe(t,"nodeStyle")):{},l={fill:n.fill||(null===(o=r.themeSemantic)||void 0===o?void 0:o.primary)||"#6366f1",stroke:n.stroke||(null===(i=r.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=n.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=n.opacity)&&void 0!==s?s:0===(null!==(c=t.depth)&&void 0!==c?c:0)?1:.85};g.push({type:"circle",cx:t.x,cy:t.y,r:e,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),r="object"==typeof e.target?e.target:v.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=y(Xe(r,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(r):t&&null!==(u=null===(l=r.data)||void 0===l?void 0:l[t])&&void 0!==u?u:r.id;f.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:g,sceneEdges:p,labels:f}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){var r,n;const o=gt(t),i=null!==(r=t.orbitSpeed)&&void 0!==r?r:.25,a=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 r=null!==(t=e.depth)&&void 0!==t?t:0;return(r%2==0?1:-1)/(r+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())-o.startTime)/1e3,c=i*(Math.PI/6),l=new Map;for(const t of e)l.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=l.get(e.parentId);if(!r)continue;const n=e.angle+s*c*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(n),t.y=r.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,r),!0)},ft={sankey:Ke,force:Ue,chord:tt,tree:ut,cluster:ut,treemap:ut,circlepack:ut,partition:ut,orbit:pt};function vt(e){return ft[e]}function mt(e,t,r){return e+(t-e)*r}function bt(e,t,r){var n,o,i;if(1>=r)return 1;const a=null!==(n=e.minOpacity)&&void 0!==n?n:.1,s=r-1-t;switch(e.type){case"linear":return a+(1-s/(r-1))*(1-a);case"exponential":{const t=null!==(o=e.halfLife)&&void 0!==o?o:r/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*r)>s?1:a;default:return 1}}class xt{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this._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({},Q),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new ee(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({},Q),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new ee(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,r){const{nodeIDAccessor:n="id",sourceAccessor:o="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof n?n:e=>e[n],c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._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({},kt(e)),{data:t}))}for(let e=0;t.length>e;e++){const r=t[e],n=c(r)+"",o=l(r)+"",i=Number(u(r))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},kt(n)),{data:r})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},kt(o)),{data:r}));const a=`${n}\0${o}\0${e}`;this.edges.set(a,{source:n,target:o,value:i,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:a})}this.runLayout(r)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,kt(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,kt(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,r),c=this.edges.get(s);let l=!1;return c?(c.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),o||i||l||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,r,n,o,i,a,s,c;const l=vt(this.config.chartType);if(!l)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!l.hierarchical)return;if(this.prepareForRelayout(),l.supportsStreaming&&!l.hierarchical){const e=new Map;for(const s of u)if(void 0!==s._prevX0){const c=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(r=s._prevX0)&&void 0!==r?r:0),l=(null!==(n=s._prevY1)&&void 0!==n?n:0)-(null!==(o=s._prevY0)&&void 0!==o?o:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+c/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+l/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(l.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,l.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],r=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=r,this.edges.set(r,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.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 y=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),g=null!==(c=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==c?c:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&g>0){const t=e[0]/2,r=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(const e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g}}else y&&g>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g});this._hasRenderedOnce=!0;const p=new Set(this.nodes.keys()),f=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of p)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)p.has(e)||this.removedNodes.add(e);for(const e of f)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)f.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=p,this.previousEdgeKeys=f,this.layoutVersion++}buildScene(e){const t=vt(this.config.chartType);if(!t)return;const r=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=vt(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=vt(this.config.chartType);if(!(null==r?void 0:r.tick))return!1;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return r.tick(n,o,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),r=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=mt(e._prevX0,e._targetX0,r),e.x1=mt(e._prevX1,e._targetX1,r),e.y0=mt(e._prevY0,e._targetY0,r),e.y1=mt(e._prevY1,e._targetY1,r));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=mt(e._prevY0,e._targetY0,r),e.y1=mt(e._prevY1,e._targetY1,r),e.sankeyWidth=mt(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const r=null==e?void 0:e.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.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 r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.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,r="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&r&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,r))}buildStandardBezier(e,t,r){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const o=t.x1,i=r.x0,a=p(o,i);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:n}}const o=t.x1,i=r.x0,a=p(o,i);return{circular:!1,points:[{x:o,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(!r)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,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,r,n,o,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,c=null!==(r=a.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(n=a.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const n=this.nodeTimestamps.get(r);if(!n)continue;const o=e-n;s>o&&(t._pulseIntensity=1-o/s,t._pulseColor=c,t._pulseGlowRadius=l)}for(const t of this.sceneEdges){const r=t.datum;if(!r)continue;const n="object"==typeof r.source?null===(o=r.source)||void 0===o?void 0:o.id:r.source,a="object"==typeof r.target?null===(i=r.target)||void 0===i?void 0:i.id:r.target;if(!n||!a)continue;const l=this.edgeTimestamps.get(`${n}\0${a}`);if(!l)continue;const u=e-l;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=c)}}applyDecay(){var e,t;const r=this.config.decay;if(!r)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 o=this._decaySortedNodes,i=new Map;for(let e=0;o.length>e;e++)i.set(o[e][0],e);for(const o of this.sceneNodes){const a=o.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const c=bt(r,s,n),l=null!==(t=null===(e=o.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;o.style=Object.assign(Object.assign({},o.style),{opacity:l*c})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const r=e-this.lastTopologyChangeTime;if(r>=2e3)return;const n=1-r/2e3;for(const e of this.sceneNodes){const r=e.id;r&&this.addedNodes.has(r)&&(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,r;const n=this.config.thresholds;if(!n)return;const o=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(r=n.criticalColor)&&void 0!==r?r:"#ef4444",a=!1!==n.pulse;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const s=this.nodes.get(r);if(!s)continue;const c=n.metric(s);let l=null;void 0===n.critical||n.critical>c?void 0===n.warning||n.warning>c||(l=o):l=i,l&&(t.style=Object.assign(Object.assign({},t.style),{fill:l}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=l,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const r=e.metric(t);if(void 0!==e.warning&&r>=e.warning||void 0!==e.critical&&r>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const r="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>r-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var r;const n=this.nodes.get(e);if(!n)return null;const o=n.data?Object.assign({},n.data):{};return n.data=t(null!==(r=n.data)&&void 0!==r?r:{}),this.layoutVersion++,o}updateEdge(e,t,r){var n;const o=this.config.valueAccessor,i="function"==typeof o?o:o?e=>e[o]:e=>e.value,a=[];for(const[,o]of this.edges)if(("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t){a.push(o.data?Object.assign({},o.data):{}),o.data=r(null!==(n=o.data)&&void 0!==n?n:{});const e=i(o.data);null!=e&&(o.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,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)!==e&&("string"==typeof r.target?r.target:r.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const r=[];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,o]of this.edges)o.data&&n(o.data)===e&&r.push(t)}else for(const[n,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t&&r.push(n);for(const e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0&&this.layoutVersion++,r.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 kt(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 At(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function wt(e,t,r,n,o=30){let i=null,a=o,s=1/0;for(const t of e){const e=St(t,r,n,o);if(e)if("rect"===t.type){const r=t.w*t.h;s>r&&(i=e,s=r)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=Ct(e,r,n);t&&a>t.distance&&(i=t,a=t.distance)}return i}function St(e,t,r,n=30){switch(e.type){case"circle":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i),s=function(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}(e.r,n);return a>s?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"rect":return function(e,t,r){const n=function(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=At(Math.atan2(o,n)),s=At(e.startAngle),c=At(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);default:return null}}let Ot=null,Lt=null;function jt(){return Lt||(Ot=document.createElement("canvas"),Ot.width=1,Ot.height=1,Lt=Ot.getContext("2d")),Lt}function Dt(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 Ct(e,t,r){switch(e.type){case"bezier":return function(e,t,r){var n,o;if(!e.pathD)return null;const i=Dt(e),a=jt();if(!i||!a)return null;try{if(a.isPointInPath(i,t,r)){const i="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,a="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:r,distance:0}}const s=a.lineWidth;a.lineWidth=10;const c=a.isPointInStroke(i,t,r);if(a.lineWidth=s,c)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,c=e.y1+a*o,l=Math.sqrt(Math.pow(t-s,2)+Math.pow(r-c,2));return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;const n=Dt(e),o=jt();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);default:return null}}function Et(e,t,r){const{group:n,indexInGroup:o}=t,i=r.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>o?i[o+1]._flatIndex:t.flatIndex;case"ArrowLeft":return o>0?i[o-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=r.groups.indexOf(n);return r.groups.length-1>e?Pt(r,r.groups[e+1],i[o]):t.flatIndex}case"ArrowUp":{const e=r.groups.indexOf(n);return e>0?Pt(r,r.groups[e-1],i[o]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*r.flat.length)),r.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*r.flat.length)),0);case"Home":return 0;case"End":return r.flat.length-1;case"Escape":return-1;default:return null}}function Pt(e,t,r){const n=e.byGroup.get(t);let o=0,i=Math.abs(n[0].x-r.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-r.x);i>t&&(i=t,o=e)}return n[o]._flatIndex}function It(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}const _t="var(--semiotic-focus, #005fcc)";function Mt({active:t,hoverPoint:r,margin:n,size:o,shape:i="circle",width:a,height:s}){if(!t||!r)return null;const c=r.x+n.left,l=r.y+n.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),r=Math.max(s,4);u=e("rect",{x:c-t/2-3,y:l-r/2-3,width:t+6,height:r+6,rx:3,fill:"none",stroke:_t,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===i?{cx:c,cy:l,r:12,fill:"none",stroke:_t,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:c,cy:l,r:8,fill:"none",stroke:_t,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Tt({x:t,y:r,containerWidth:o,containerHeight:i,margin:a,children:s,className:c="stream-frame-tooltip",zIndex:l=1}){const u=n.useRef(null),[d,h]=n.useState(null);n.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,c,o,i]);let y;return y=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-r?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>r?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:c,style:{position:"absolute",left:a.left+t,top:a.top+r,transform:y,pointerEvents:"none",zIndex:l,width:"max-content"},children:s})}function Nt(t){const r=o(null),n=Wt(t);return[function({children:n}){const o=i(()=>Wt(t),[]);return e(r.Provider,{value:o,children:n})},e=>{var t;const o=null!==(t=a(r))&&void 0!==t?t:n,i=s(e);i.current=e;const u=c(()=>i.current(o.getState()),[o]),d=c(()=>i.current(o.getState()),[o]);return l(o.subscribe,u,d)}]}function Wt(e){const t=new EventTarget;let r=e(function(e){r=Object.assign(Object.assign({},r),e(r)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>r,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function $t(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 Bt(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:Rt})})),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 Rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],zt={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}},Ht={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}},Ft={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Rt,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"},[Yt,qt]=Nt(e=>({theme:zt,setTheme(t){e(e=>{if("light"===t)return{theme:zt};if("dark"===t)return{theme:Ht};if("high-contrast"===t)return{theme:Ft};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ht:zt;return{theme:Bt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:Bt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const Xt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Gt=new WeakMap;let Vt=0,Kt=!1,Ut=null,Zt=null,Qt=null;function Jt(e,t){var r,n;if(!t)return t;const o=Xt.exec(t);if(!o)return t;const i=e.canvas;if(!i)return(null===(r=o[2])||void 0===r?void 0:r.trim())||t;!function(){if(Kt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Kt=!0;const e=()=>{Vt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ut=new MutationObserver(e),Ut.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Zt=window.matchMedia("(prefers-color-scheme: dark)"),Qt=e,"function"==typeof Zt.addEventListener?Zt.addEventListener("change",Qt):"function"==typeof Zt.addListener&&Zt.addListener(Qt)}catch(e){}}();let a=Gt.get(i);a&&a.version===Vt||(a={version:Vt,map:new Map},Gt.set(i,a));const s=a.map.get(t);if(void 0!==s)return s;const c=getComputedStyle(i).getPropertyValue(o[1]).trim()||(null===(n=o[2])||void 0===n?void 0:n.trim())||t;return a.map.set(t,c),c}function er(e,t,r){return"function"==typeof e?e({size:t,margin:r}):e}function tr(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),r=s(t);r.current=t;const[o,a]=function(e,t,r){const n=s(null),[o,i]=u(null);return d(()=>{if(!t&&!r)return;const e=n.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:r}=t.contentRect;i(t=>t&&t.w===e&&t.h===r?t:{w:e,h:r})}});return o.observe(e),()=>o.disconnect()},[t,r]),[n,[t&&o?o.w:e[0],r&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),l=i(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=a[0]-l.left-l.right,y=a[1]-l.top-l.bottom,g=er(e.foregroundGraphics,a,l),p=er(e.backgroundGraphics,a,l),f=qt(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var r,n;if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&(null===(r=window.matchMedia)||void 0===r?void 0:r.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:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=s(0),k=s(()=>{}),A=c(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const w=s(()=>{}),S=s(()=>{}),O=s(null),L=s(0),j=c(()=>{L.current=0;const e=O.current;O.current=null,e&&w.current(e)},[]),D=c(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===L.current&&(L.current=requestAnimationFrame(j))},[j]),C=c(()=>{O.current=null,0!==L.current&&(cancelAnimationFrame(L.current),L.current=0),S.current()},[]);d(()=>()=>{O.current=null,0!==L.current&&(cancelAnimationFrame(L.current),L.current=0)},[]);const E=e.themeDirtyRef;return d(()=>{E&&(Vt++,E.current=!0,A())},[f,A,E]),{reducedMotion:t,reducedMotionRef:r,responsiveRef:o,size:a,margin:l,adjustedWidth:h,adjustedHeight:y,resolvedForeground:g,resolvedBackground:p,currentTheme:f,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:A,hoverHandlerRef:w,hoverLeaveRef:S,onPointerMove:D,onPointerLeave:C}}const rr={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function nr(e,t,r,n){let o;return o="function"==typeof r?r(e):(0,rr[r])(n(e,t)),o}function or(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ir(e,t,r){return r&&r.size>0?r.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ar=(r,n,o,i,a,s,c,l,u,d)=>{const{type:h="fill",styleFn:y,items:g}=r,p=[];let f=0;const v=!(!n&&!o),m="isolate"===d||void 0===d&&null!=a;return g.forEach((r,d)=>{const b=nr(r,d,h,y),x=ir(r,i,a),k=a&&a.size>0&&a.has(r.label);p.push(t("g",{transform:`translate(0,${f})`,onClick:n?()=>n(r):void 0,onMouseEnter:o?()=>o(r):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&d===c?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=i&&r.label===i||void 0,"aria-label":r.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(r)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const r=(d+("ArrowDown"===e.key?1:-1)+g.length)%g.length;u(l,r);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[r];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{u(l,d),o&&o(r);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*r.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(or,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label})]},"legend-item-"+d)),f+=22}),p};function sr({config:r,orientation:o="vertical",width:i=100}){const{colorFn:a,domain:s,label:c,format:l}=r,u=l||(e=>Math.round(100*e)/100+""),d="grad-legend-"+n.useId();if("horizontal"===o){const r=12,n=Math.min(i,200),o=Math.max(0,(i-n)/2),l=[];for(let t=0;64>=t;t++){const r=t/64;l.push(e("stop",{offset:100*r+"%",stopColor:a(s[0]+r*(s[1]-s[0]))},t))}return t("g",{"aria-label":c||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:l})}),c&&e("text",{x:o+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:c}),e("rect",{x:o,y:0,width:n,height:r,fill:`url(#${d})`,rx:2}),e("text",{x:o,y:r+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:o+n,y:r+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 r=t/64;h.push(e("stop",{offset:100*r+"%",stopColor:a(s[1]-r*(s[1]-s[0]))},t))}return t("g",{"aria-label":c||"Gradient legend",children:[c&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:c}),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 cr(r){const{legendGroups:o,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:c,legendInteraction:l,title:u="Legend",width:d=100,height:h=20,orientation:y="vertical"}=r,[g,p]=n.useState(0),[f,v]=n.useState(0),m=n.useCallback((e,t)=>{p(e),v(t)},[]),b="vertical"===y?(({legendGroups:t,width:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:c,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,y)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:r,y2:d},"legend-top-line legend-symbol-"+y)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+y)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:ar(t,n,o,i,a,s,c,y,l,u)},"legend-group-"+y)),d+=22*t.items.length+8}),h})({legendGroups:o||[],width:d,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:c,focusedGroupIndex:g,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:l}):(({legendGroups:r,height:n,width:o,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:c,focusedGroupIndex:l,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let y=0;const g=[];r.forEach((r,n)=>{let p=0;r.label&&(p+=16);const f=((r,n,o,i,a,s,c,l,u,d,h)=>{const{type:y="fill",styleFn:g,items:p}=r,f=[];let v=0,m=0;const b=!(!n&&!o),x="isolate"===d||void 0===d&&null!=a;p.forEach((r,d)=>{const k=nr(r,d,y,g),A=ir(r,i,a),w=a&&a.size>0&&a.has(r.label),S=26+7*r.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),f.push(t("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(r):void 0,onMouseEnter:o?()=>o(r):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:b?l===s&&d===c?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?w||!1:void 0,"aria-current":b&&!x&&null!=i&&r.label===i||void 0,"aria-label":r.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(r)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const r=(d+("ArrowRight"===e.key?1:-1)+p.length)%p.length;u(l,r);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[r];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{u(l,d),o&&o(r);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*r.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,w&&e(or,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label})]},"legend-item-"+d)),v+=S});let k=0,A=0;for(const e of p){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(k=Math.max(k,A),A=t):A+=t}k=Math.max(k,A);const w=m+1;return{items:f,offset:k,totalRows:w,totalHeight:22*w}})(r,i,a,s,c,l,u,n,d,h,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:r.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),y+=p+12});let p=y>o?0:Math.max(0,(o-y)/2);const f=[];return g.forEach((t,o)=>{const i=r[o];i.label&&(f.push(e("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+o)),p+=16),f.push(e("g",{className:"legend-item",transform:`translate(${p},0)`,children:t.items},"legend-group-"+o)),p+=t.offset+5,r[o+1]&&f.push(e("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+o)),p+=12}),e("g",{children:f})})({legendGroups:o||[],title:u,height:h,width:d,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:c,focusedGroupIndex:g,focusedItemIndex:f,onFocusedIndexChange:m,legendInteraction:l}),x=!(!i&&!a);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==l&&(void 0!==l||null==c))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===y&&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}),b]})}function lr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ur(e){return"object"==typeof e&&null!==e&&"gradient"in e}function dr(t){const{legend:r,totalWidth:n,totalHeight:o,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:c,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!r)return null;const y="top"===a||"bottom"===a;let g,p;return"left"===a?(g=4,p=i.top):"top"===a?(g=0,p=s?32:8):"bottom"===a?(g=0,p=o-i.bottom+50):(g=n-i.right+10,p=i.top),e("g",{transform:`translate(${g}, ${p})`,children:ur(r)?e(sr,{config:r.gradient,orientation:y?"horizontal":"vertical",width:y?n:100}):lr(r)?e(cr,{legendGroups:r.legendGroups,title:"",width:y?n:100,orientation:y?"horizontal":"vertical",customHoverBehavior:c,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):r})}function hr(o){const{width:i,height:a,totalWidth:s,totalHeight:c,margin:l,labels:u,title:d,legend:h,legendHoverBehavior:y,legendClickBehavior:g,legendHighlightedCategory:p,legendIsolatedCategories:f,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=o;return t(r,{children:[t("svg",{role:"img",width:s,height:c,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(${l.left},${l.top})`,children:[u.map((t,r)=>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-"+r)),x&&x.filter(e=>"widget"!==e.type).map((t,r)=>{if(k){const o=k(t,r,{width:i,height:a,sceneNodes:b});if(o)return e(n.Fragment,{children:o},"annotation-"+r)}return null}),m]}),d&&"string"==typeof d?e("text",{x:s/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:d}):d?e("foreignObject",{x:0,y:0,width:s,height:l.top,children:d}):null,dr({legend:h,totalWidth:s,totalHeight:c,margin:l,legendPosition:v,title:d,legendHoverBehavior:y,legendClickBehavior:g,legendHighlightedCategory:p,legendIsolatedCategories:f})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,r)=>{var n,o,i,a,s,c,u,d,h;const y=b.find(e=>{var r,n,o,i,a;return e.id===t.nodeId||(null===(r=e.datum)||void 0===r?void 0:r.id)===t.nodeId||(null===(o=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===o?void 0:o.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!y)return null;const g=l.left+(null!==(n=y.cx)&&void 0!==n?n:null!=y.x&&null!=y.w?y.x+y.w/2:null!==(o=y.x)&&void 0!==o?o:0),p=l.top+(null!==(i=y.cy)&&void 0!==i?i:null!=y.y&&null!=y.h?y.y+y.h/2:null!==(a=y.y)&&void 0!==a?a:0),f=null!==(s=t.dx)&&void 0!==s?s:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,m=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d: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:g+f-m/2,top:p+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+r)})]})}function yr(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}hr.displayName="NetworkSVGOverlay";const gr="undefined"==typeof window||"undefined"==typeof document,pr=n.createContext(null),fr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function vr(e,t,r){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?r+", empty":`${r}, ${n.join(", ")}`}const mr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},br={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},xr={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},kr={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Ar={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},wr={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Sr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Or={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Lr({nodes:r,edges:o,chartType:i,tableId:a,chartTitle:s}){var c,l,u,d,h,y,g,p,f,v,m,b,x,k;const[A,w]=n.useState(!1),S=n.useContext(pr),O=null!==(c=null==S?void 0:S.visible)&&void 0!==c&&c,L=A||O,j=s?"Data summary for "+s:a?`Data summary for ${i} ${a}`:"Data summary for "+i,D=n.useRef(null),C=n.useCallback(()=>{A||O||w(!0)},[A,O]),E=n.useCallback(e=>{var t;O||(null===(t=D.current)||void 0===t?void 0:t.contains(e.relatedTarget))||w(!1)},[O]);if(!r||0===r.length)return a?e("span",{id:a,tabIndex:-1,style:fr}):null;if(!L)return e("div",{id:a,tabIndex:-1,onFocus:C,style:fr,role:"region","aria-label":j,children:t("button",{type:"button",onClick:()=>w(!0),children:["View data summary (",r.length," nodes, ",o.length," edges)"]})});const P=Array.isArray(r)?r:[],I=Array.isArray(o)?o:[],_=new Map,M=new Map,T=new Map,N=new Map;for(const e of I){if(!e||"object"!=typeof e)continue;const t=null!==(l=e.datum)&&void 0!==l?l:e,r="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,n="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=r&&""!==r){const e=r+"";M.set(e,(null!==(h=M.get(e))&&void 0!==h?h:0)+1),N.set(e,(null!==(y=N.get(e))&&void 0!==y?y:0)+o)}if(null!=n&&""!==n){const e=n+"";_.set(e,(null!==(g=_.get(e))&&void 0!==g?g:0)+1),T.set(e,(null!==(p=T.get(e))&&void 0!==p?p:0)+o)}}const W=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const r=null!==(v=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==v?v:t.id,n=null!=r?r+"":"node-"+e,o=null!==(m=_.get(n))&&void 0!==m?m:0,i=null!==(b=M.get(n))&&void 0!==b?b:0,a=null!==(x=T.get(n))&&void 0!==x?x:0,s=null!==(k=N.get(n))&&void 0!==k?k:0;W.push({id:n,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}W.sort((e,t)=>t.degree-e.degree);let $=0,B=0;if(W.length>0){let e=0;for(const t of W)e+=t.degree,t.degree>B&&(B=t.degree);$=e/W.length}const R=I.some(e=>{var t;const r=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==r?void 0:r.value)&&Number.isFinite(r.value)}),z=[`${W.length} nodes, ${I.length} edges.`];W.length>0&&z.push(`Mean degree: ${mr($)}, max degree: ${B}.`);const H=W.slice(0,5);return t("div",{ref:D,id:a,tabIndex:-1,onBlur:E,style:br,role:"region","aria-label":j,children:[e("button",{type:"button",onClick:()=>{O&&S&&S.setVisible(!1),w(!1)},"aria-label":"Close data summary",style:kr,children:"×"}),e("div",{role:"note",style:xr,children:z.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+i,style:Ar,children:[t("caption",{style:Or,children:["Top ",H.length," of ",W.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:wr,children:"id"}),e("th",{style:wr,children:"degree"}),e("th",{style:wr,children:"in"}),e("th",{style:wr,children:"out"}),R&&e("th",{style:wr,children:"w. degree"}),R&&e("th",{style:wr,children:"w. in"}),R&&e("th",{style:wr,children:"w. out"})]})}),e("tbody",{children:H.map((r,n)=>t("tr",{children:[e("td",{style:Sr,children:r.id}),e("td",{style:Sr,children:r.degree}),e("td",{style:Sr,children:r.inDeg}),e("td",{style:Sr,children:r.outDeg}),R&&e("td",{style:Sr,children:mr(r.wDegree)}),R&&e("td",{style:Sr,children:mr(r.wInDeg)}),R&&e("td",{style:Sr,children:mr(r.wOutDeg)})]},n))})]})]})}function jr({summary:t}){return t?e("div",{role:"note",style:fr,children:t}):null}function Dr({tableId:t}){return e("a",{href:"#"+t,style:fr,onClick:e=>{e.preventDefault();const r=document.getElementById(t);r&&requestAnimationFrame(()=>r.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,fr)},children:"Skip to data table"})}function Cr({hoverPoint:t}){let r="";if(t){const e=t.data||t;r="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:fr,children:r})}function Er(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Pr(e,t,r=.3){Er(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Ir(e,t,r=.6){var n,o,i,a,s;if(!Er(t))return;const c=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,l=t.r+c*t._pulseIntensity,u=null!==(i=null!==(o=t.cx)&&void 0!==o?o:t.x)&&void 0!==i?i: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,l,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*r,e.stroke()}function _r(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Mr(e,t){var r,n,o,i,a,s;if(!t.pathD)return;e.save();const c=_r(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const o=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,s="string"==typeof t.style.fill?t.style.fill:"#999",c=Jt(e,s)||s;o.addColorStop(0,1===a.from?c:"transparent"),o.addColorStop(1,1===a.to?c:"transparent"),e.fillStyle=o,e.globalAlpha=i}else e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(i=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==i?i:.5;e.fill(c)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Jt(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(c)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(c)),e.restore()}function Tr(e,t){var r,n;e.save();const o=t.style.stroke||"#999";e.strokeStyle=Jt(e,o)||o,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r: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 Nr(e,t){var r,n,o,i;if(!t.pathD)return;e.save();const a=_r(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i: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 Wr(e,t){var r,n;if(!t.pathD)return;e.save();const o=_r(t),i=t.style.stroke||"#999";e.strokeStyle=Jt(e,i)||i,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(o)),e.restore()}const $r={category10:A,tableau10:P,set3:E,blues:C,reds:D,greens:j,oranges:L,purples:O,viridis:S,plasma:w},Br=A,Rr=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],zr=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Hr=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 Fr(e,t,r){if("function"==typeof t){const n=t(e);return r&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Hr.has(t)}(n)?r(n):n}const n=null==e?void 0:e[t];return r?r(n):Br[Math.abs(function(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return Math.abs(t)}(n+""))%Br.length]}function Yr(e,t,r="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),o=n.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(r))return B().domain(n).range(r).unknown("#999");const i=$r[r]||$r.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of n){const r=Number(t);r>e&&(e=r)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Br;return B().domain(n).range(e).unknown("#999")}}const qr={top:20,right:80,bottom:20,left:80},Xr={top:40,right:40,bottom:40,left:40},Gr=new Set(["chord","force","circlepack","orbit"]),Vr=[800,600],Kr={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 Ur({data:r}){var n,o,i,a,s,c;if("edge"===r.nodeOrEdge){const e=r.data;return e?t("div",{className:"semiotic-tooltip",style:Kr,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 l=r.data;if(!l)return null;const u=l.__hierarchyNode;if(u){const r=[];let s=u;for(;s;){const e=null!==(a=null!==(o=null===(n=s.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==a?a:l.id;null!=e&&r.unshift(e+""),s=s.parent}r.length>1&&r.shift();const c=r.length-1;return t("div",{className:"semiotic-tooltip",style:Kr,children:[e("div",{children:r.map((r,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===c?e("strong",{children:r}):e("span",{style:{opacity:.7},children:r})]},n))}),null!=l.value&&l.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof l.value?l.value.toLocaleString():l.value+""})]})}const d=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(c=l.targetLinks)||void 0===c?void 0:c.length)||0),h=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:Kr,children:[e("div",{style:{fontWeight:600},children:l.id}),null!=l.value&&l.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}const Zr=h(function(r,n){var o,a,l,h,g,p,f,v,m,b,x,k,A,w,S,O,L;const{chartType:j,nodes:D,edges:C,data:E,initialEdges:P,nodeIDAccessor:I="id",sourceAccessor:_="source",targetAccessor:M="target",valueAccessor:T="value",edgeIdAccessor:N,childrenAccessor:W,hierarchySum:$,orientation:B="horizontal",nodeAlign:R="justify",nodePaddingRatio:z=.05,nodeWidth:F=15,iterations:Y=300,forceStrength:q=.1,padAngle:X=.01,groupWidth:G=20,sortGroups:V,edgeSort:K,treeOrientation:U="vertical",edgeType:ee="curve",padding:te,paddingTop:re,tensionConfig:ne,showParticles:oe=!1,particleStyle:ie,nodeStyle:ae,edgeStyle:se,colorBy:ce,colorScheme:le="category10",edgeColorBy:ue="source",edgeOpacity:de=.5,colorByDepth:he=!1,nodeSize:ye=8,nodeSizeRange:ge=[5,20],nodeLabel:pe,showLabels:fe=!0,labelMode:ve,size:me=Vr,responsiveWidth:be,responsiveHeight:xe,margin:ke,className:Ae,background:we,enableHover:Se=!0,tooltipContent:Oe,customHoverBehavior:Le,customClickBehavior:je,onObservation:De,chartId:Ce,onTopologyChange:Ee,annotations:Pe,svgAnnotationRules:Ie,legend:_e,legendPosition:Me,legendHoverBehavior:Te,legendClickBehavior:Ne,legendHighlightedCategory:We,legendIsolatedCategories:$e,title:Be,foregroundGraphics:Re,backgroundGraphics:ze,decay:He,pulse:Fe,transition:Ye,animate:qe,staleness:Xe,thresholds:Ge,accessibleTable:Ve=!0,description:Ke,summary:Ue,orbitMode:Ze,orbitSize:Qe,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:rt,orbitShowRings:nt,orbitAnimated:ot}=r,it=Gr.has(j)?Xr:qr,at=s(!0),st=tr({sizeProp:me,responsiveWidth:be,responsiveHeight:xe,userMargin:ke,marginDefault:it,foregroundGraphics:Re,backgroundGraphics:ze,animate:qe,transitionProp:Ye,themeDirtyRef:at}),{reducedMotionRef:ct,responsiveRef:lt,size:ut,margin:dt,adjustedWidth:ht,adjustedHeight:yt,resolvedForeground:gt,resolvedBackground:pt,transition:ft,introEnabled:vt,tableId:mt,rafRef:bt,renderFnRef:kt,scheduleRender:At,currentTheme:St}=st,Ot=i(()=>Object.assign(Object.assign({},Q),ne),[ne]),Lt=i(()=>Object.assign(Object.assign({},J),ie),[ie]),jt=i(()=>{var e;return{chartType:j,nodeIDAccessor:I,sourceAccessor:_,targetAccessor:M,valueAccessor:T,edgeIdAccessor:N,childrenAccessor:W,hierarchySum:$,orientation:B,nodeAlign:R,nodePaddingRatio:z,nodeWidth:F,iterations:Y,forceStrength:q,padAngle:X,groupWidth:G,sortGroups:V,edgeSort:K,treeOrientation:U,edgeType:ee,padding:te,paddingTop:re,tensionConfig:Ot,showParticles:oe,particleStyle:Lt,nodeStyle:ae,edgeStyle:se,nodeLabel:pe,showLabels:fe,labelMode:ve,colorBy:ce,colorScheme:le,themeCategorical:null===(e=null==St?void 0:St.colors)||void 0===e?void 0:e.categorical,themeSemantic:$t(St),edgeColorBy:ue,edgeOpacity:de,colorByDepth:he,nodeSize:ye,nodeSizeRange:ge,decay:He,pulse:Fe,transition:ft,introAnimation:vt,staleness:Xe,thresholds:Ge,orbitMode:Ze,orbitSize:Qe,orbitSpeed:Je,orbitRevolution:et,orbitRevolutionStyle:tt,orbitEccentricity:rt,orbitShowRings:nt,orbitAnimated:ot}},[j,I,_,M,T,W,$,B,R,z,F,Y,q,X,G,V,K,U,ee,te,re,Ot,oe,Lt,ae,se,pe,fe,ve,ce,le,ue,de,he,ye,ge,He,Fe,null==ft?void 0:ft.duration,null==ft?void 0:ft.easing,vt,Xe,Ge,Ze,Qe,Je,et,tt,rt,nt,ot,St]),Dt=s(null),Ct=s(0),Pt=s(null);Pt.current||(Pt.current=new xt(jt));const[_t,Nt]=u(null),[Wt,Bt]=u(0),[Rt,zt]=u(0),[Ht,Ft]=u(!1),Yt=s(null),qt=s(new Map),Xt=s(0),Gt=c(e=>{if("function"==typeof ce)return ce(e)+"";if("string"==typeof ce&&e.data){const t=e.data[ce];if(void 0!==t){if(!qt.current.has(t+"")){const e=Array.isArray(le)?le:Br;qt.current.set(t+"",e[Xt.current++%e.length])}return qt.current.get(t+"")}}if(qt.current.has(e.id))return qt.current.get(e.id);const t=Array.isArray(le)?le:Br,r=ce?t[Xt.current++%t.length]:t[0];return qt.current.set(e.id,r),r},[ce,le]),Vt=(null===(o=null==St?void 0:St.colors)||void 0===o?void 0:o.border)||(null===(a=null==St?void 0:St.colors)||void 0===a?void 0:a.secondary)||(null===(l=null==St?void 0:St.colors)||void 0===l?void 0:l.primary)||"#999",Kt=c(e=>{if("function"==typeof ue)return ue(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===ue&&r?Gt(r):t?Gt(t):Vt},[ue,Gt,Vt]),Ut=c(e=>{if(!(null==ie?void 0:ie.colorBy))return Kt(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===Lt.colorBy&&r?Gt(r):t?Gt(t):Vt},[null==ie?void 0:ie.colorBy,Lt.colorBy,Gt,Kt,Vt]),Zt="sankey"===j&&oe||!!Fe||null!==(g=null===(h=Pt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;d(()=>{var e;null===(e=Pt.current)||void 0===e||e.updateConfig(jt),at.current=!0,At()},[jt,At]),d(()=>{var e;const t=Pt.current;if(t){t.buildScene([ht,yt]);for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&qt.current.set(r.id,r.style.fill);at.current=!0,At()}},[St,ht,yt,At]);const Qt=c(()=>{var e;const t=Pt.current;if(!t)return;t.runLayout([ht,yt]),t.buildScene([ht,yt]),at.current=!0;for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&qt.current.set(r.id,r.style.fill);const r=Array.isArray(le)?le:Br,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];qt.current.has(t.id)||qt.current.set(t.id,r[e%r.length])}if(Xt.current=n.length,Bt(t.layoutVersion),Ee){const{nodes:e,edges:r}=t.getLayoutData();Ee(e,r)}},[ht,yt,Ee,le]),er=c(e=>{const t=Pt.current;t&&(t.ingestEdge(e)&&Qt(),At())},[Qt,At]),rr=c(e=>{const t=Pt.current;if(!t)return;let r=!1;for(const n of e)t.ingestEdge(n)&&(r=!0);r&&Qt(),At()},[Qt,At]),nr=c(()=>{var e;null===(e=Pt.current)||void 0===e||e.clear(),qt.current.clear(),Xt.current=0,Bt(0),Nt(null),Yt.current=null,at.current=!0,At()},[At]),or=c(()=>{const e=Pt.current;e&&(e.tension+=999,Qt(),At())},[Qt,At]);y(n,()=>({push:er,pushMany:rr,removeNode:e=>{var t,r,n;const o=null!==(r=null===(t=Pt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==r&&r;if(o){const t=(null===(n=Yt.current)||void 0===n?void 0:n.data)?"function"==typeof I?I(Yt.current.data):Yt.current.data[I]:void 0;Yt.current&&"node"===Yt.current.nodeOrEdge&&t===e&&(Yt.current=null,Nt(null)),qt.current.delete(e),Qt(),at.current=!0,At()}return o},removeEdge:(e,t)=>{var r,n;const o=null!==(n=null===(r=Pt.current)||void 0===r?void 0:r.removeEdge(e,t))&&void 0!==n&&n;if(o){if(Yt.current&&"edge"===Yt.current.nodeOrEdge){const r=Yt.current.data;let n;n=void 0!==t?("object"==typeof(null==r?void 0:r.source)?r.source.id:null==r?void 0:r.source)===e&&("object"==typeof(null==r?void 0:r.target)?r.target.id:null==r?void 0:r.target)===t:!N||!r||("function"==typeof N?N:e=>null==e?void 0:e[N])(r)===e,n&&(Yt.current=null,Nt(null))}Qt(),at.current=!0,At()}return o},updateNode:(e,t)=>{var r,n;const o=null!==(n=null===(r=Pt.current)||void 0===r?void 0:r.updateNode(e,t))&&void 0!==n?n:null;return o&&(at.current=!0,At()),o},updateEdge:(e,t,r)=>{var n,o;const i=null!==(o=null===(n=Pt.current)||void 0===n?void 0:n.updateEdge(e,t,r))&&void 0!==o?o:[];return i.length>0&&(Qt(),at.current=!0,At()),i},clear:nr,getTopology:()=>{var e,t;return null!==(t=null===(e=Pt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Pt.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:or,getTension:()=>{var e,t;return null!==(t=null===(e=Pt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[er,rr,nr,or,Qt,At]);const ir=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),ar=ir?E||(Array.isArray(C)?void 0:C):void 0;d(()=>{var e;const t=Pt.current;if(t)if(ir&&ar)t.ingestHierarchy(ar,[ht,yt]),t.buildScene([ht,yt]),at.current=!0,At();else{const r=D||[],n=Array.isArray(C)?C:[];if(0===r.length&&0===n.length)return;t.ingestBounded(r,n,[ht,yt]),t.buildScene([ht,yt]);for(const r of t.sceneNodes)r.id&&(null===(e=r.style)||void 0===e?void 0:e.fill)&&qt.current.set(r.id,r.style.fill+"");const o=Array.isArray(le)?le:Br,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];qt.current.has(t.id)||qt.current.set(t.id,o[e%o.length])}Xt.current=i.length,at.current=!0,At()}},[D,C,E,ar,ir,ht,yt,jt,At,le]),d(()=>{P&&P.length>0&&rr(P)},[]);const sr=c(e=>{if(Le&&Le(e),De){const t=Date.now();De(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ce}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ce})}},[Le,De,Ce]),cr=c(e=>{if(je&&je(e),De){const t=Date.now();De(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ce}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ce})}},[je,De,Ce]),{hoverHandlerRef:lr,hoverLeaveRef:ur,onPointerMove:dr,onPointerLeave:pr}=st;lr.current=e=>{if(!Se)return;const t=Dt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-dt.left,o=e.clientY-r.top-dt.top;if(0>n||n>ht||0>o||o>yt)return void(Yt.current&&(Yt.current=null,Nt(null),sr&&(sr(null),at.current=!0),At()));const i=Pt.current;if(!i)return;const a=wt(i.sceneNodes,i.sceneEdges,n,o);if(!a)return void(Yt.current&&(Yt.current=null,Nt(null),sr&&(sr(null),at.current=!0),At()));const s=Z(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Yt.current=s,Nt(s),sr&&(sr(s),at.current=!0),At()},ur.current=()=>{Yt.current&&(Yt.current=null,Nt(null),sr&&(sr(null),at.current=!0),At())};const fr=s(()=>{});fr.current=e=>{if(!je&&!De)return;const t=Dt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-dt.left,o=e.clientY-r.top-dt.top;if(0>n||n>ht||0>o||o>yt)return;const i=Pt.current;if(!i)return;const a=wt(i.sceneNodes,i.sceneEdges,n,o);cr(a?Z(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const mr=c(e=>fr.current(e),[]),br=s(-1),xr=s(null),kr=s(-1),Ar=c(e=>{var t;const r=Pt.current;if(!r)return;const n=function(e){var t,r,n,o,i,a;const s=[];for(const c of e)"circle"===c.type&&null!=c.cx?s.push({x:c.cx,y:c.cy,datum:c.datum,shape:"circle",group:null!==(r=null===(t=c.datum)||void 0===t?void 0:t.id)&&void 0!==r?r:"_default"}):"rect"===c.type&&null!=c.x?s.push({x:c.x+c.w/2,y:c.y+c.h/2,datum:c.datum,shape:"rect",w:c.w,h:c.h,group:null!==(o=null===(n=c.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:"_default"}):"arc"===c.type&&null!=c.cx&&s.push({x:c.cx,y:c.cy,datum:c.datum,shape:"circle",group:null!==(a=null===(i=c.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(r.sceneNodes);if(0===n.length)return;const o=function(e){var t,r;const n=new Map;for(const r of e){const e=null!==(t=r.group)&&void 0!==t?t:"_default";let o=n.get(e);o||(o=[],n.set(e,o)),o.push(r)}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 o=Array.from(n.keys()).sort((e,t)=>{const r=n.get(e),o=n.get(t);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),i=Array.from(n.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(r=i[e].datum)||void 0===r?void 0:r.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:o,byGroup:n,idToIdx:a}}(n),i=br.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),br.current=0,kr.current=-1;const t=o.flat[0];xr.current={shape:t.shape,w:t.w,h:t.h};const r=Z(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Yt.current=r,Nt(r),sr&&(sr(r),at.current=!0),void At()}const a=function(e,t){var r,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[o];return{flatIndex:o,group:null!==(r=i.group)&&void 0!==r?r:"_default",indexInGroup:null!==(n=i._groupIndex)&&void 0!==n?n:0}}(o,i),s=function(e,t,r,n,o){var i,a,s;const c=r.flat[t.flatIndex];if(!c)return Et(e,t,r);const l=null===(i=c.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(a=function(e,t,r){let n=null,o=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,c=a.y-t.y;let l=!1;switch(r){case"right":l=s>0&&Math.abs(s)>=Math.abs(c);break;case"left":l=0>s&&Math.abs(s)>=Math.abs(c);break;case"down":l=c>0&&Math.abs(c)>=Math.abs(s);break;case"up":l=0>c&&Math.abs(c)>=Math.abs(s)}if(!l)continue;const u=s*s+c*c;o>u&&(o=u,n=i)}return n}(r,c,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return n!==t.flatIndex&&(o.current=-1),n}case"Enter":{if(null==l)return t.flatIndex;const e=function(e,t){var r;const n=e+"",o=[];for(const e of t){const t=null!==(r=e.datum)&&void 0!==r?r:e,i=It(t.source),a=It(t.target),s=null!=i,c=null!=a;s&&i+""===n&&c?o.push(a+""):c&&a+""===n&&s&&o.push(i+"")}return o}(l,n);if(0===e.length)return t.flatIndex;const i=null!==(s=r.idToIdx.get(e[(o.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(o.current=-1,i)}default:{const n=Et(e,t,r);return null!==n&&n!==t.flatIndex&&(o.current=-1),n}}}(e.key,a,o,null!==(t=r.sceneEdges)&&void 0!==t?t:[],kr);if(null===s)return;if(e.preventDefault(),0>s)return br.current=-1,xr.current=null,kr.current=-1,Yt.current=null,Nt(null),sr&&(sr(null),at.current=!0),void At();br.current=s;const c=o.flat[s];xr.current={shape:c.shape,w:c.w,h:c.h};const l=c.datum||{},u=Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,x:c.x,y:c.y,time:c.x,value:c.y,nodeOrEdge:"node"});Yt.current=u,Nt(u),sr&&(sr(u),at.current=!0),At()},[sr,At]),wr=c(e=>{br.current=-1,xr.current=null,dr(e)},[dr]);kt.current=()=>{var e,t,r,n,o,i,a;bt.current=0;const s=Dt.current;if(!s)return;const c=s.getContext("2d");if(!c)return;const l=Pt.current;if(!l)return;const u=performance.now(),d=Ct.current?Math.min((u-Ct.current)/1e3,.1):.016;Ct.current=u;const h=l.advanceTransition(ct.current?u+1e6:u),y=!ct.current&&h,g=!ct.current&&l.tickAnimation([ht,yt],d);(h||at.current||g)&&l.buildScene([ht,yt]);const p="undefined"!=typeof window&&window.devicePixelRatio||1;if(!function(e,t,r,n){const o=e.getContext("2d");if(!o)return null;const i=t[0]*n,a=t[1]*n,s=t[0]+"px",c=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==c&&(e.style.height=c),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(n,0,0,n,0,0),o.translate(r.left,r.top),o}(s,ut,dt,p))return;c.clearRect(-dt.left,-dt.top,ut[0],ut[1]),we&&(c.fillStyle=we,c.fillRect(0,0,ht,yt)),He&&l.applyDecay(),Fe&&l.applyPulse(u),Ge&&l.applyThresholds(u),l.applyTopologyDiff(u);const f=null!==(e=null==Xe?void 0:Xe.threshold)&&void 0!==e?e:5e3,v=Xe&&l.lastIngestTime>0&&u-l.lastIngestTime>f;if(v&&(c.globalAlpha=null!==(t=null==Xe?void 0:Xe.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const r of t)switch(r.type){case"bezier":Mr(e,r);break;case"line":Tr(e,r);break;case"ribbon":Nr(e,r);break;case"curved":Wr(e,r)}}(c,l.sceneEdges),function(e,t){var r,n,o;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.strokeRect(t.x,t.y,t.w,t.h)),Pr(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),Ir(e,t),e.restore())}}(c,l.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Jt(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),e.restore()}}(c,l.sceneNodes),oe&&l.particlePool&&!v){const e=Array.from(l.edges.values());if(e.length>0){!function(e,t,r,n){var o,i;const a=null!==(o=n.spawnRate)&&void 0!==o?o:J.spawnRate,s=null!==(i=n.maxPerEdge)&&void 0!==i?i:J.maxPerEdge;for(let n=0;t.length>n;n++){const o=t[n];if(!o.bezier)continue;if(e.countForEdge(n)>=s)continue;const i=o.value*a*r*(o.bezier.circular?.3:1),c=Math.floor(i),l=i-c;let u=c;Math.random()<l&&u++;for(let t=0;u>t&&e.countForEdge(n)<s;t++)e.spawn(n)}}(l.particlePool,e,d,Lt);const t=.5*(null!==(r=Lt.speedMultiplier)&&void 0!==r?r:1);let n;if(Lt.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)}l.particlePool.step(d,t,e,n),function(e,t,r,n,o){var i,a;const s=null!==(i=n.radius)&&void 0!==i?i:J.radius,c=null!==(a=n.opacity)&&void 0!==a?a:J.opacity;e.globalAlpha=c;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const c=r[a.edgeIndex];if(c){if("function"==typeof n.color){const t="object"==typeof c.source?c.source:null;e.fillStyle=t?n.color(c,t):Jt(e,"var(--semiotic-secondary, #666)")}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:o(c);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(c,l.particlePool,e,Lt,Ut)}}v&&(c.globalAlpha=1);const m=at.current;if(at.current=!1,m||y||g){const e=Dt.current;e&&e.setAttribute("aria-label",vr(null!==(o=null===(n=l.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==o?o:0,null!==(a=null===(i=l.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(m||y||g)&&zt(e=>e+1),(Zt||y||null!=l.transition||g||l.hasActivePulses||l.hasActiveThresholds||l.hasActiveTopologyDiff)&&(bt.current=requestAnimationFrame(()=>kt.current()))},d(()=>(At(),()=>{}),[At]),d(()=>{at.current=!0,At()},[j,ht,yt,we,At]),function(e,t,r,n,o,i){d(()=>{if(!e)return;const a=setInterval(()=>{var a;const s=t.current;if(!s||0===s.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(a=e.threshold)&&void 0!==a?a:5e3,u=c-s.lastIngestTime>l;u!==o&&(i(u),r.current=!0,n())},1e3);return()=>clearInterval(a)},[e,o,n])}(Xe,Pt,at,At,Ht,Ft);const Sr=Se&&_t?e(Tt,{x:_t.x,y:_t.y,containerWidth:ht,containerHeight:yt,margin:dt,className:"stream-network-tooltip",zIndex:2,children:Oe?Oe(_t):e(Ur,{data:_t})}):null;if(gr){const r=Pt.current;if(r){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(j),t=e?E||(Array.isArray(C)?void 0:C):void 0;if(e&&t)r.ingestHierarchy(t,[ht,yt]),r.buildScene([ht,yt]);else{const e=D||[],t=Array.isArray(C)?C:[];(e.length>0||t.length>0)&&(r.ingestBounded(e,t,[ht,yt]),r.buildScene([ht,yt]))}}const n=null!==(p=null==r?void 0:r.sceneNodes)&&void 0!==p?p:[],o=null!==(f=null==r?void 0:r.sceneEdges)&&void 0!==f?f:[],i=null!==(v=null==r?void 0:r.labels)&&void 0!==v?v:[];return t("div",{className:"stream-network-frame"+(Ae?" "+Ae:""),role:"img","aria-label":Ke||("string"==typeof Be?Be:"Network chart"),style:{position:"relative",width:ut[0],height:ut[1]},children:[e(jr,{summary:Ue}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:ut[0],height:ut[1],style:{position:"absolute",left:0,top:0},children:[pt&&e("g",{transform:`translate(${dt.left},${dt.top})`,children:pt}),t("g",{transform:`translate(${dt.left},${dt.top})`,children:[we&&e("rect",{x:0,y:0,width:ht,height:yt,fill:we}),o.map((t,r)=>function(t,r){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-"+r);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:yr(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+r)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:yr(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+r)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:yr(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+r)}default:return null}}(t,r)).filter(Boolean),n.map((t,r)=>function(t,r){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:yr(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+r)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:yr(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+r)}case"arc":{const n=t,o=H().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)({})||"";return e("path",{d:o,transform:`translate(${n.cx},${n.cy})`,fill:yr(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+r)}default:return null}}(t,r)).filter(Boolean),i.map((t,r)=>function(t,r){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-"+r)}(t,r)).filter(Boolean)]})]}),e(hr,{width:ht,height:yt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:i,sceneNodes:n,title:Be,legend:_e,legendPosition:Me,legendHoverBehavior:Te,legendClickBehavior:Ne,legendHighlightedCategory:We,legendIsolatedCategories:$e,foregroundGraphics:gt,annotations:Pe,svgAnnotationRules:Ie,annotationFrame:0})]})}const Or=Pt.current;return t("div",{ref:lt,className:"stream-network-frame"+(Ae?" "+Ae:""),role:"group","aria-label":Ke||("string"==typeof Be?Be:"Network chart"),tabIndex:0,style:{position:"relative",width:be?"100%":ut[0],height:xe?"100%":ut[1],overflow:"visible"},onKeyDown:Ar,children:[Ve&&e(Dr,{tableId:mt}),Ve&&e(Lr,{nodes:null!==(m=null==Or?void 0:Or.sceneNodes)&&void 0!==m?m:[],edges:null!==(b=null==Or?void 0:Or.sceneEdges)&&void 0!==b?b:[],chartType:"Network chart",tableId:mt,chartTitle:"string"==typeof Be?Be:void 0}),e(jr,{summary:Ue}),t("div",{role:"img","aria-label":Ke||("string"==typeof Be?Be:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Se?wr:void 0,onMouseLeave:Se?pr:void 0,onClick:je||De?mr:void 0,children:[pt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ut[0],height:ut[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${dt.left},${dt.top})`,children:pt})}),e("canvas",{ref:Dt,"aria-label":vr(null!==(k=null===(x=null==Or?void 0:Or.sceneNodes)||void 0===x?void 0:x.length)&&void 0!==k?k:0,null!==(w=null===(A=null==Or?void 0:Or.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==w?w:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Cr,{hoverPoint:_t}),e(hr,{width:ht,height:yt,totalWidth:ut[0],totalHeight:ut[1],margin:dt,labels:(null==Or?void 0:Or.labels)||[],sceneNodes:null==Or?void 0:Or.sceneNodes,title:Be,legend:_e,legendPosition:Me,legendHoverBehavior:Te,legendClickBehavior:Ne,legendHighlightedCategory:We,legendIsolatedCategories:$e,foregroundGraphics:gt,annotations:Pe,svgAnnotationRules:Ie,annotationFrame:Rt}),e(Mt,{active:br.current>=0,hoverPoint:_t,margin:dt,size:ut,shape:null===(S=xr.current)||void 0===S?void 0:S.shape,width:null===(O=xr.current)||void 0===O?void 0:O.w,height:null===(L=xr.current)||void 0===L?void 0:L.h}),Sr,(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:Ht?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:Ht?"STALE":"LIVE"})]})]})});Zr.displayName="StreamNetworkFrame";const Qr={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 Jr(e,t){return"function"==typeof t?t(e):e[t]}function en(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function tn(r={}){const{fields:n,title:o,format:i,style:a={},className:s=""}=r;return r=>{if(!r||"object"!=typeof r)return null;let c;const l=[];if(o){const e=Jr(r,o);c=en(e,i)}if(n&&n.length>0)n.forEach(e=>{let t,n,o;"string"==typeof e?(t=e,n=e,o=i):(t=e.label,n=e.accessor||e.key||"",o=e.format||i);const a=Jr(r,n);l.push({label:t,value:en(a,o)})});else if(!o){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==r[t]){c=en(r[t],i);break}if(!c){const e=Object.keys(r).filter(e=>!e.startsWith("_"));e.length>0&&(c=en(r[e[0]],i))}}const u=Object.assign(Object.assign({},Qr),a);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[c&&e("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:c}),l.map((e,r)=>t("div",{style:{marginTop:0===r&&c?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},r))]})}}function rn(t){if(!0===t)return tn();if("function"==typeof t){const r=t;return t=>{const n=r(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==n?null:e("div",{className:"semiotic-tooltip",style:Qr,children:n})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?tn(t):tn())}const nn=o(null);function on(e){const t=[];for(const[r,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[r]));else{const[e,o]=n.range;t.push(t=>{const n=t[r];return n>=e&&o>=n})}return e=>t.every(t=>t(e))}function an(e,t){let r=e.get(t);return r||(r={name:t,resolution:"union",clauses:new Map},e.set(t,r)),r}const[sn,cn]=Nt(e=>({selections:new Map,setClause(t,r){e(e=>{const n=new Map(e.selections),o=an(n,t),i=new Map(o.clauses);return i.set(r.clientId,r),n.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:n}})},clearClause(t,r){e(e=>{const n=e.selections.get(t);if(!n)return{};const o=new Map(e.selections),i=new Map(n.clauses);return i.delete(r),o.set(t,Object.assign(Object.assign({},n),{clauses:i})),{selections:o}})},setResolution(t,r){e(e=>{const n=new Map(e.selections),o=an(n,t);return n.set(t,Object.assign(Object.assign({},o),{resolution:r})),{selections:n}})},clearSelection(t){e(e=>{const r=new Map(e.selections),n=r.get(t);return n&&r.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:r}})}})),[ln,un]=Nt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const r=e.observations;return r.push(t),r.length>e.maxObservations&&r.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let dn={positions:new Map};const hn=new Set;function yn(){for(const e of hn)e()}function gn(e,t){const r=dn.positions.get(e);if(null==r?void 0:r.locked)return;if(!r||r.sourceId!==t)return;const n=new Map(dn.positions);n.delete(e),dn={positions:n},yn()}function pn(e){const t=g(),r=e.clientId||t,{name:n}=e,o=cn(e=>e.selections.get(n)),a=cn(e=>e.setClause),s=cn(e=>e.clearClause),l=i(()=>!!o&&o.clauses.size>0,[o]);return{predicate:i(()=>o&&0!==o.clauses.size?function(e,t){const r=[];for(const[n,o]of e.clauses)"crossfilter"===e.resolution&&n===t||r.push(on(o));return 0===r.length?()=>!0:"intersect"===e.resolution?e=>r.every(t=>t(e)):e=>r.some(t=>t(e))}(o,r):()=>!0,[o,r]),isActive:l,selectPoints:c(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"point",values:new Set(n)};a(n,{clientId:r,type:"point",fields:t})},[r,n,a]),selectInterval:c(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"interval",range:n};a(n,{clientId:r,type:"interval",fields:t})},[r,n,a]),clear:c(()=>{s(n,r)},[s,n,r]),clientId:r}}const fn=o(!1);function vn(){var e;const t=qt(e=>e.theme),r=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return r&&r.length>0?r:void 0}function mn(e,t,r,n,o){let i;if(Array.isArray(r))i=r;else if(t&&t.length>0)i=t;else if("string"==typeof r){const e=$r[r];Array.isArray(e)&&(i=e)}return i&&0!==i.length?i[0]:"#007bff"}function bn(e,t,r){const n=a(nn),o=vn();return i(()=>{var i;if(!t)return;const a=null!==(i=null!=r?r:o&&o.length>0?o:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=Yr(r.map(e=>({_cat:e})),"_cat",a);return t=>n[t]||e(t)}return Yr(r.map(e=>({_cat:e})),"_cat",a)}if(n&&Object.keys(n).length>0){const r=Yr(e,t,a);return e=>n[e]||r(e)}return Yr(e,t,a)}if(n&&Object.keys(n).length>0){const e=Yr([{_:"a"}],"_",a);return t=>n[t]||e(t)}},[e,t,r,n,o])}function xn({selection:e,linkedHover:t,fallbackFields:r=[],unwrapData:n=!1,onObservation:o,chartType:a,chartId:s,onClick:l,hoverHighlight:h,colorByField:y}){const p=g(),f=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,r),v=pn({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const t=e.name||"hover",{fields:r}=e,{predicate:n,isActive:o,selectPoints:i,clear:a}=pn({name:t});return{onHover:c(e=>{if(!e)return void a();const t={};for(const n of r){const r=e[n];void 0!==r&&(t[n]=[r])}Object.keys(t).length>0&&i(t)},[r,i,a,t]),predicate:n,isActive:o}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||r||[]}),b=un(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,A]=u(null),w=y||r[0],S=i(()=>{if(!h||null==k||!w)return null;const e=k,t=w;return{isActive:!0,predicate:r=>{var n;return("string"==typeof r[t]?r[t]:(null!==(n=r[t])&&void 0!==n?n:"")+"")===e}}},[h,k,w]),O=c(e=>{var r,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,r){const n=dn.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===r||(dn={positions:new Map(dn.positions).set(e,{xValue:t,sourceId:r})},yn())}(f.name||"hover",Number(e),p)}"x-position"!==(null==f?void 0:f.mode)&&m.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&gn(f.name||"hover",p),"x-position"!==(null==f?void 0:f.mode)&&m.onHover(null);if(h&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const r=null==t?void 0:t[w];A(null!=r?r+"":null)}else A(null);if(o||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(r=e.x)&&void 0!==r?r:0,y:null!==(n=e.y)&&void 0!==n?n:0});o&&o(a),b&&b(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});o&&o(e),b&&b(e)}}},[t,m,f,p,o,a,s,b,h,w]),L=c(e=>{var t,r,n,i;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const r=null==t?void 0:t[f.xField];null!=r&&Number.isFinite(Number(r))&&function(e,t,r){const n=dn.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(dn.positions);return t.delete(e),dn={positions:t},yn(),!1}dn={positions:new Map(dn.positions).set(e,{xValue:t,sourceId:r,locked:!0})},yn()}(f.name||"hover",Number(r),p)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(r=e.y)&&void 0!==r?r:0})}if(o||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});o&&o(a),b&&b(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});o&&o(e),b&&b(e)}}},[l,o,b,a,s,f,p]);return d(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const r=dn.positions.get(e);if(!(null==r?void 0:r.locked))return;if(t&&r.sourceId!==t)return;const n=new Map(dn.positions);n.delete(e),dn={positions:n},yn()}(e,p),gn(e,p)}},[null==f?void 0:f.mode,null==f?void 0:f.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:L,crosshairSourceId:p}}function kn(e,t,r){const[n,o]=u(null),[a,s]=u(new Set),l=c(t=>{"highlight"===e&&o(t?t.label:null)},[e]),d=c(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===r.length?new Set:n})},[e,r.length]),h=i(()=>{if(!e||"none"===e||!t)return null;const r="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(r?e[r]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const n=r?e[r]:"function"==typeof t?t(e):null;return a.has(n)}}:null},[e,t,n,a]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:l,onLegendClick:d,legendSelectionHook:h}}n.createContext(void 0);const An={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 wn(e,t,r){var n,o,i,a,s,c,l;const u=An[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==r?void 0:r.width)?u.width:r.width,height:null!==(o=t.height)&&void 0!==o?o:e&&"primary"!==e||!(null==r?void 0:r.height)?u.height:r.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i: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!==(c=t.showLegend)&&void 0!==c?c:u.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l: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:Sn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Sn(e,t,r){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===r?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function On(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),r)}:(...e)=>Object.assign({},r)}function Ln({componentName:r,message:n,diagnosticHint:o,width:i,height:a}){return e("div",{role:"alert",style:{width:i,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:r}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&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:o})]})})}class jn extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var r,n;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,r=this.state.error;return"function"==typeof t?t(r):void 0!==t?t:e(Ln,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Dn(e,t){const r=e.length,n=t.length,o=Array(n+1);for(let e=0;n>=e;e++)o[e]=e;for(let i=1;r>=i;i++){let r=o[0];o[0]=i;for(let a=1;n>=a;a++){const n=o[a];o[a]=e[i-1]===t[a-1]?r:1+Math.min(r,o[a],o[a-1]),r=n}}return o[n]}function Cn(e,t,r=3){let n,o=r+1;for(const r of t){const t=Dn(e.toLowerCase(),r.toLowerCase());o>t&&(o=t,n=r)}return o>r?void 0:n}function En(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Pn(e,t){var r;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(r=Cn(e,t,3))&&void 0!==r?r:null)}function In({componentName:e,data:t,dataLabel:r="data"}){return null==t?`${e}: No ${r} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${r} 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 _n({componentName:e,nodes:t,edges:r,nodesRequired:n=!1,edgesRequired:o=!0,accessors:i}){if(null==t&&null==r)return null;if(o&&(!r||!Array.isArray(r)||0===r.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(i&&t&&t.length>0){const r=En(t).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in r)){const r=Pn(o,t),i=r?` Try ${n}="${r}".`:"";return`${e}: ${n} "${o}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Mn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Tn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Nn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Wn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],$n=["vertical","horizontal"],Bn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},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({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Tn),{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({},Mn),Tn),{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({},Mn),Tn),{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({},Mn),Tn),{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({},Mn),Tn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},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({},Mn),Nn),{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:$n},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},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({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},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({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Nn),{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({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},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({},Mn),Nn),{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({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:$n},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Mn),{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({},Mn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Mn),Nn),{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({},Mn),Nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Mn),{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({},Mn),{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:$n},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Mn),{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({},Mn),{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({},Mn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Mn),{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({},Mn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Mn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Mn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Mn),{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({},Mn),{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({},Mn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Mn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Rn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const zn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Hn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Fn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Yn=new Set(["LineChart","AreaChart","StackedAreaChart"]),qn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Xn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[r,n,o]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(r)+.7152*i(n)+.0722*i(o)}function Gn(e,t){const r=Xn(e),n=Xn(t);return null===r||null===n?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}const Vn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Kn(e,t){const r=[],n=function(e,t){const r=[],n=Bn[e];if(!n)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Bn).join(", ")}`]};for(const o of n.required)null==t[o]&&r.push(`"${o}" is required for ${e}.`);for(const[e,o]of Object.entries(t)){if(null==o)continue;const t=n.props[e];if(t){if(!Rn(o,t.type)){const n=Array.isArray(t.type)?t.type.join(" | "):t.type;r.push(`"${e}" should be ${n}, got ${Array.isArray(o)?"array":typeof o}.`);continue}t.enum&&"string"==typeof o&&!t.enum.includes(o)&&r.push(`"${e}" value "${o}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const o=Object.keys(n.props),i=new Set(o);for(const n of Object.keys(t))if(void 0!==t[n]&&!i.has(n)){const t=Cn(n,o),i=t?`Unknown prop "${n}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${n}" for ${e}. Valid props: ${o.join(", ")}.`;r.push(i)}if("array"===n.dataShape){const o=t.data,i={};for(const e of n.dataAccessors){const r=t[e];"string"==typeof r&&(i[e]=r)}const a=function({componentName:e,data:t,accessors:r,requiredProps:n}){if(n)for(const[t,r]of Object.entries(n))if(null==r)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(r){const n=En(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 r=Pn(i,t),n=r?` Try ${o}="${r}".`:"";return`${e}: ${o} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}({componentName:e,data:o,accessors:Object.keys(i).length>0?i:void 0});a&&r.push(a)}else if("object"===n.dataShape){const n=In({componentName:e,data:t.data});n&&r.push(n)}else if("network"===n.dataShape){const o=_n({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:n.required.includes("nodes"),edgesRequired:n.required.includes("edges")});o&&r.push(o)}return{valid:0===r.length,errors:r}}(e,t);for(const e of n.errors)r.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Bn[e]?(function(e,t,r){const n=Bn[e];if(n){if("array"===n.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&r.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===n.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&r.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,r),function(e,t,r){const n=t.width,o=t.height;if(void 0===n||"number"==typeof n&&n>0||r.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(n)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===o||"number"==typeof o&&o>0||r.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,n]=t.size;(null!=e&&0>=e||null!=n&&0>=n)&&r.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${n}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,r),function(e,t,r){const n=Bn[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of n.dataAccessors){const n=t[e];"string"==typeof n&&(n in i||r.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${n}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,r),function(e,t,r){zn.has(e)&&Array.isArray(t.data)&&r.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,r),function(e,t,r){Hn.has(e)&&(t.edges||t.data||r.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,r),function(e,t,r){const n=Bn[e];if(!n||"array"!==n.dataShape)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&r.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,r),function(e,t,r){t.linkedHover&&!t.selection&&r.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,r),function(e,t,r){var n;if(!Fn.has(e))return;const o=t.rExtent||t.yExtent;o&&Array.isArray(o)&&o.length>=1&&null!=o[0]&&0!==o[0]&&r.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${o[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(n=o[1])&&void 0!==n?n:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,r),function(e,t,r){if(!Yn.has(e))return;if(t.gapStrategy)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=t.yAccessor||"y";"string"==typeof o&&n.some(e=>{const t=e[o];return null==t||Number.isNaN(t)})&&r.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${o}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,r),function(e,t,r){var n,o;const i=null!==(n=t.width)&&void 0!==n?n:600,a=null!==(o=t.height)&&void 0!==o?o:400,s=t.margin;if(!s||"object"!=typeof s)return;const c=(s.left||0)+(s.right||0),l=(s.top||0)+(s.bottom||0);i>c||r.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${c}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>l||r.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${l}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,r),function(e,t,r){var n;const o=Bn[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let r=0;s>r;r++){const o=null===(n=i[r])||void 0===n?void 0:n[e.name];if("number"==typeof o&&Number.isFinite(o)){t=!1;break}}t&&r.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,r),function(e,t,r){if(!qn.has(e))return;const n=t.barPadding;"number"==typeof n&&10>n&&r.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${n} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,r),function(e,t,r){if("bottom"!==t.legendPosition)return;const n=t.margin;if(!n||"object"!=typeof n)return;const o=n.bottom;"number"==typeof o&&70>o&&r.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${o}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,r),function(e,t,r){var n;if(!t.showLegend)return;if("right"!==(null!==(n=t.legendPosition)&&void 0!==n?n:"right"))return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.right;"number"==typeof i&&100>i&&r.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,r),function(e,t,r){if("Heatmap"!==e)return;const n=t.data;if(!n||!Array.isArray(n)||0===n.length)return;const o=n[0];if(o&&"object"==typeof o)for(const e of["xAccessor","yAccessor"]){const n=t[e];if("string"!=typeof n)continue;const i=o[n];"string"==typeof i&&r.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${n}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,r),function(e,t,r){const n=t.colorScheme;if(!n||!Array.isArray(n))return;const o="string"==typeof t.background?t.background:"#ffffff";if(!o.startsWith("#"))return;const i=[];for(const e of n){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Gn(e,o);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&r.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${o}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,r),function(e,t,r){const n=t.colorScheme;if(!n||!Array.isArray(n)||2>n.length)return;const o=n.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>o.length)return;const i=[];for(let e=0;o.length-1>e;e++){const t=Gn(o[e],o[e+1]);null!==t&&1.5>t&&i.push(`${o[e]} / ${o[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&r.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,r),function(e,t,r){const n="string"==typeof t.title&&t.title.trim().length>0,o="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;n||o||i||r.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,r),function(e,t,r){const n=[];for(const e of Vn)"function"==typeof t[e]&&n.push(e);n.length>0&&r.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${n.length>1?"s":""} detected: ${n.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,r),{ok:r.every(e=>"warning"===e.severity),diagnoses:r}):{ok:0===r.length,diagnoses:r}}var Un;const Zn="undefined"!=typeof process&&"production"!==(null===(Un=process.env)||void 0===Un?void 0:Un.NODE_ENV);function Qn({componentName:t,width:r,height:n,chartProps:o,children:i}){return e(jn,{fallback:i=>{let a="";if(Zn&&o)try{const e=Kn(t,o);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e(Ln,{componentName:t,message:i.message,diagnosticHint:a,width:r,height:n})},children:i})}const Jn={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"},eo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function to(t,r,n,o){return!1===o||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Jn),{width:r,height:n}),children:o||"No data available"}):null}function ro(t,r,n){if(!t)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+a)-a))/2);return e("div",{style:{width:r,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},eo),{position:"absolute",top:s+n*(i+a),left:Math.floor(.1*r),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2})},n))})}const no=h(function(t,r){var n;const o=s(null);y(r,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,r,n,i,a;const s=Array.isArray(e)?e:[e],c=null!==(n=null===(r=null===(t=o.current)||void 0===t?void 0:t.getTopology())||void 0===r?void 0:r.nodes)&&void 0!==n?n:[],l=[];for(const e of s){const t=c.find(t=>t.id===e);t&&l.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(a=o.current)||void 0===a||a.removeNode(e)}return l},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var r;const n=null===(r=o.current)||void 0===r?void 0:r.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const c=wn(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:u,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:p="source",targetAccessor:f="target",nodeLabel:v,colorBy:m,colorScheme:b,nodeSize:x=8,nodeSizeRange:k=[5,20],edgeWidth:A=1,edgeColor:w="#999",edgeOpacity:S=.6,iterations:O=300,forceStrength:L=.1,tooltip:j,frameProps:D={},onObservation:C,onClick:E,chartId:P,selection:I,linkedHover:_,loading:M,emptyContent:T,legendInteraction:N,legendPosition:W,stroke:$,strokeWidth:B,opacity:R}=t,z=c.width,H=c.height,F=c.enableHover,Y=c.showLegend,q=null!==(n=c.showLabels)&&void 0!==n&&n,X=c.title,G=c.description,V=c.summary,K=c.accessibleTable,U=ro(M,z,H),Z=U?null:to(l,z,H,T),Q=l||[],J=u||[],ee=bn(Q,m,b),te=i(()=>{if(!m)return[];const e=new Set;for(const t of Q){const r="function"==typeof m?m(t):t[m];null!=r&&e.add(r+"")}return Array.from(e)},[Q,m]),re=kn(N,m,te),ne=vn(),oe=i(()=>new Map,[]),ie=i(()=>{if(Array.isArray(b))return b;if(ne&&ne.length>0)return ne;const e=$r[b];return Array.isArray(e)?e:Br},[b,ne]),ae=i(()=>e=>{const t={};return t.fill=m?Fr(e.data||e,m,ee):mn(0,ne,b),"number"==typeof x&&(t.r=x),t},[m,ee,x,ne,b,oe]),se=i(()=>On(ae,{stroke:$,strokeWidth:B,opacity:R}),[ae,$,B,R]),ce=i(()=>e=>({stroke:w,strokeWidth:"number"==typeof A?A:"function"==typeof A?A(e):e[A]||1,opacity:S}),[A,w,S]),le=i(()=>On(ce,{stroke:$,strokeWidth:B,opacity:R}),[ce,$,B,R]),ue=i(()=>{if(q&&v)return"function"==typeof v?v:e=>{var t,r,n;return null!==(n=null!==(r=null===(t=e.data)||void 0===t?void 0:t[v])&&void 0!==r?r:e[v])&&void 0!==n?n:e.id}},[q,v]),{legend:de,margin:he,legendPosition:ye}=function({data:e,colorBy:t,colorScale:r,showLegend:n,legendPosition:o="right",userMargin:s,defaults:c={top:50,bottom:60,left:70,right:40},categories:l}){const u=a(fn),d=void 0!==n?n:!u&&!!t,h=i(()=>{if(!d||!t)return;const n=function({data:e,colorBy:t,colorScale:r,getColor:n,strokeColor:o,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?n(a,t,r):r?r(o):Rr[i%Rr.length];return{label:o+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",r={fill:t,stroke:t};return void 0!==o&&(r.stroke=o),void 0!==i&&(r.strokeWidth=i),r},type:"fill",items:s,label:""}]}}({data:e,colorBy:t,colorScale:r,getColor:Fr,categories:l}),o=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==o?n:void 0},[d,t,e,r,l]),y=i(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},c),e);return h&&("right"===o&&110>t.right?t.right=110:"left"===o&&110>t.left?t.left=110:"top"===o&&50>t.top?t.top=50:"bottom"===o&&80>t.bottom&&(t.bottom=80)),t},[c,s,h,o]);return{legend:h,margin:y,legendPosition:o}}({data:Q,colorBy:m,colorScale:ee,showLegend:Y,legendPosition:W,userMargin:d,defaults:c.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:pe}=xn({selection:I,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:E,chartType:"ForceDirectedGraph",chartId:P}),fe=_n({componentName:"ForceDirectedGraph",nodes:l,edges:u,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return fe?e(Ln,{componentName:"ForceDirectedGraph",message:fe,width:z,height:H}):U||Z||e(Qn,{componentName:"ForceDirectedGraph",width:z,height:H,children:e(Zr,Object.assign({ref:o,chartType:"force"},null!=l&&{nodes:Q},null!=u&&{edges:J},{size:[z,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he,nodeIDAccessor:g,sourceAccessor:p,targetAccessor:f,iterations:O,forceStrength:L,nodeStyle:se,edgeStyle:le,colorBy:m,colorScheme:ie,nodeSize:x,nodeSizeRange:k,nodeLabel:ue,showLabels:q,enableHover:F,tooltipContent:!1===j?()=>null:rn(j)||void 0,customHoverBehavior:_||C||E?ge:void 0,customClickBehavior:C||E?pe:void 0,legend:de,legendPosition:ye},N&&"none"!==N&&{legendHoverBehavior:re.onLegendHover,legendClickBehavior:re.onLegendClick,legendHighlightedCategory:re.highlightedCategory,legendIsolatedCategories:re.isolatedCategories},{className:h,title:X,description:G,summary:V,accessibleTable:K},null!=t.animate&&{animate:t.animate},D))})});function oo(e,t){if(!e)return[];const r=[],n=e=>{r.push(e);const o="function"==typeof t?t(e):e[t];o&&Array.isArray(o)&&o.forEach(n)};return n(e),r}function io(e,t,r,n){if(e&&e.length>0)return e;const o=new Set;return t.forEach(e=>{const t="function"==typeof r?r(e):e[r],i="function"==typeof n?n(e):e[n];o.add(t),o.add(i)}),Array.from(o).map(e=>({id:e}))}function ao(e){return"function"==typeof e?e:t=>t[e]||1}function so({edgeColorBy:e,colorBy:t,colorScale:r,nodeStyleFn:n,edgeOpacity:o,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:o},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Fr(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Fr(e.data||e,t,r):e&&(s.fill=n(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*o);return s}}no.displayName="ForceDirectedGraph";const co=h(function(t,r){var n;const o=s(null);y(r,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,r,n,i,a;const s=Array.isArray(e)?e:[e],c=null!==(n=null===(r=null===(t=o.current)||void 0===t?void 0:t.getTopology())||void 0===r?void 0:r.nodes)&&void 0!==n?n:[],l=[];for(const e of s){const t=c.find(t=>t.id===e);t&&l.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(a=o.current)||void 0===a||a.removeNode(e)}return l},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var r;const n=null===(r=o.current)||void 0===r?void 0:r.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const a=wn(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:c,edges:l,margin:u,className:d,sourceAccessor:h="source",targetAccessor:g="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:v,colorScheme:m,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:A=.05,nodeWidth:w=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:L,tooltip:j,frameProps:D={},onObservation:C,onClick:E,chartId:P,selection:I,linkedHover:_,loading:M,emptyContent:T,legendInteraction:N,stroke:W,strokeWidth:$,opacity:B}=t,R=a.width,z=a.height,H=a.enableHover,F=null===(n=a.showLabels)||void 0===n||n,Y=a.title,q=a.description,X=a.summary,G=a.accessibleTable,V=ro(M,R,z),K=V?null:to(l,R,z,T),U=l||[],Z=i(()=>io(c,U,h,g),[c,U,h,g]),Q=bn(Z,v,m),J=i(()=>{if(!v)return[];const e=new Set;for(const t of Z){const r="function"==typeof v?v(t):t[v];null!=r&&e.add(r+"")}return Array.from(e)},[Z,v]),ee=kn(N,v,J),te=vn(),re=i(()=>new Map,[]),ne=i(()=>{if(Array.isArray(m))return m;if(te&&te.length>0)return te;const e=$r[m];return Array.isArray(e)?e:Br},[m,te]),oe=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=v?Fr(e.data||e,v,Q):mn(0,te,m),t},[v,Q,te,m,re]),ie=i(()=>On(oe,{stroke:W,strokeWidth:$,opacity:B}),[oe,W,$,B]),ae=i(()=>so({edgeColorBy:b,colorBy:v,colorScale:Q,nodeStyleFn:ie,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,v,Q,ie,O]),se=i(()=>On(ae,{stroke:W,strokeWidth:$,opacity:B}),[ae,W,$,B]),ce=i(()=>{if(!F)return;const e=S||f;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[F,S,f]),le=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof u?{top:u,bottom:u,left:u,right:u}:u),{customHoverBehavior:ue,customClickBehavior:de}=xn({selection:I,linkedHover:_,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:C,onClick:E,chartType:"SankeyDiagram",chartId:P}),he=_n({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return he?e(Ln,{componentName:"SankeyDiagram",message:he,width:R,height:z}):V||K||e(Qn,{componentName:"SankeyDiagram",width:R,height:z,children:e(Zr,Object.assign({ref:o,chartType:"sankey"},Z.length>0&&{nodes:Z},null!=l&&{edges:U},{size:[R,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,nodeIDAccessor:f,sourceAccessor:h,targetAccessor:g,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:A,nodeWidth:w,nodeStyle:ie,edgeStyle:se,colorBy:v,colorScheme:ne,edgeColorBy:b,edgeOpacity:O,edgeSort:L,nodeLabel:ce,showLabels:F,enableHover:H,tooltipContent:!1===j?()=>null:rn(j)||void 0,customHoverBehavior:_||C||E?ue:void 0,customClickBehavior:C||E?de:void 0},N&&"none"!==N&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories},{className:d,title:Y,description:q,summary:X,accessibleTable:G},null!=t.animate&&{animate:t.animate},D))})});co.displayName="SankeyDiagram";const lo=h(function(t,r){var n;const o=s(null);y(r,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,r,n,i,a;const s=Array.isArray(e)?e:[e],c=null!==(n=null===(r=null===(t=o.current)||void 0===t?void 0:t.getTopology())||void 0===r?void 0:r.nodes)&&void 0!==n?n:[],l=[];for(const e of s){const t=c.find(t=>t.id===e);t&&l.push(Object.assign(Object.assign({},null!==(i=t.data)&&void 0!==i?i:{}),{id:e})),null===(a=o.current)||void 0===a||a.removeNode(e)}return l},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var r;const n=null===(r=o.current)||void 0===r?void 0:r.updateNode(e,t);return n?[Object.assign(Object.assign({},n),{id:e})]:[]}),clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,r,n;return null!==(n=null===(r=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==n?n:[]}}));const a=wn(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:c,edges:l,margin:u,className:d,sourceAccessor:h="source",targetAccessor:g="target",valueAccessor:p="value",nodeIdAccessor:f="id",colorBy:v,colorScheme:m,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:A,nodeLabel:w,edgeOpacity:S=.5,tooltip:O,frameProps:L={},onObservation:j,onClick:D,chartId:C,selection:E,linkedHover:P,loading:I,emptyContent:_,legendInteraction:M,stroke:T,strokeWidth:N,opacity:W}=t,$=a.width,B=a.height,R=a.enableHover,z=null===(n=a.showLabels)||void 0===n||n,H=a.title,F=a.description,Y=a.summary,q=a.accessibleTable,X=ro(I,$,B),G=X?null:to(l,$,B,_),V=l||[],K=i(()=>io(c,V,h,g),[c,V,h,g]),U=bn(K,v,m),Z=i(()=>{if(!v)return[];const e=new Set;for(const t of K){const r="function"==typeof v?v(t):t[v];null!=r&&e.add(r+"")}return Array.from(e)},[K,v]),Q=kn(M,v,Z),J=vn(),ee=i(()=>new Map,[]),te=i(()=>{if(Array.isArray(m))return m;if(J&&J.length>0)return J;const e=$r[m];return Array.isArray(e)?e:Br},[m,J]),re=K.length>0,ne=i(()=>{if(re)return(e,t)=>{var r,n;const o={stroke:"black",strokeWidth:1};if(v)o.fill=Fr(e.data||e,v,U);else{const i=Array.isArray(m)?m:$r[m]||Br,a=Array.isArray(i)?i:Br,s=null!==(n=null!==(r=e.index)&&void 0!==r?r:t)&&void 0!==n?n:0;o.fill=a[s%a.length]}return o}},[re,v,U,m]),oe=i(()=>ne?On(ne,{stroke:T,strokeWidth:N,opacity:W}):void 0,[ne,T,N,W]),ie=i(()=>{if(re)return so({edgeColorBy:b,colorBy:v,colorScale:U,nodeStyleFn:oe||(e=>({fill:mn(0,J,m)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[re,b,v,U,oe,S,J,m,ee]),ae=i(()=>ie?On(ie,{stroke:T,strokeWidth:N,opacity:W}):void 0,[ie,T,N,W]),se=i(()=>{if(!z)return;const e=w||f;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[z,w,f]),ce=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof u?{top:u,bottom:u,left:u,right:u}:u),{customHoverBehavior:le,customClickBehavior:ue}=xn({selection:E,linkedHover:P,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:j,onClick:D,chartType:"ChordDiagram",chartId:C}),de=_n({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return de?e(Ln,{componentName:"ChordDiagram",message:de,width:$,height:B}):X||G||e(Qn,{componentName:"ChordDiagram",width:$,height:B,children:e(Zr,Object.assign({ref:o,chartType:"chord"},K.length>0&&{nodes:K},null!=l&&{edges:V},{size:[$,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,nodeIDAccessor:f,sourceAccessor:h,targetAccessor:g,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:A,nodeStyle:oe,edgeStyle:ae,colorBy:v,colorScheme:te,edgeColorBy:b,edgeOpacity:S,nodeLabel:se,showLabels:z,enableHover:R,tooltipContent:!1===O?()=>null:rn(O)||void 0,customHoverBehavior:P||j||D?le:void 0,customClickBehavior:j||D?ue:void 0},M&&"none"!==M&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:d,title:H,description:F,summary:Y,accessibleTable:q},null!=t.animate&&{animate:t.animate},L))})});function uo(t){var r;const n=wn(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:a,className:s,layout:c="tree",orientation:l="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:y,colorScheme:g,colorByDepth:p=!1,edgeStyle:f="curve",nodeLabel:v,nodeSize:m=5,tooltip:b,frameProps:x={},onObservation:k,onClick:A,chartId:w,selection:S,linkedHover:O,loading:L,legendInteraction:j,stroke:D,strokeWidth:C,opacity:E}=t,P=n.width,I=n.height,_=n.enableHover,M=null===(r=n.showLabels)||void 0===r||r,T=n.title,N=n.description,W=n.summary,$=n.accessibleTable,B=ro(L,P,I),R=i(()=>oo(null!=o?o:null,u),[o,u]),z=bn(R,p?void 0:y,g),H=i(()=>{if(!y||p)return[];const e=new Set;for(const t of R){const r="function"==typeof y?y(t):t[y];null!=r&&e.add(r+"")}return Array.from(e)},[R,y,p]),F=kn(j,p?void 0:y,H),Y=vn(),q=i(()=>new Map,[]),X=i(()=>{if(Array.isArray(g))return g;if(Y&&Y.length>0)return Y;const e=$r[g];return Array.isArray(e)?e:Br},[g,Y]),G=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?zr[(e.depth||0)%zr.length]:y?Fr(e.data||e,y,z):mn(0,Y,g),t},[y,p,z,Y,g,q]),V=i(()=>On(G,{stroke:D,strokeWidth:C,opacity:E}),[G,D,C,E]),K=i(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),U=i(()=>On(K,{stroke:D,strokeWidth:C,opacity:E}),[K,D,C,E]),Z=i(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return ao(d)},[c,d]),Q=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof a?{top:a,bottom:a,left:a,right:a}:a),{customHoverBehavior:J,customClickBehavior:ee}=xn({selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"TreeDiagram",chartId:w}),te=In({componentName:"TreeDiagram",data:o});return te?e(Ln,{componentName:"TreeDiagram",message:te,width:P,height:I}):B||e(Qn,{componentName:"TreeDiagram",width:P,height:I,children:e(Zr,Object.assign({chartType:c},null!=o&&{data:o},{size:[P,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:Z,treeOrientation:l,edgeType:f,nodeStyle:V,edgeStyle:U,colorBy:y,colorScheme:X,colorByDepth:p,nodeSize:m,nodeLabel:M?v||h:void 0,showLabels:M,enableHover:_,tooltipContent:!1===b?()=>null:rn(b)||void 0,customHoverBehavior:O||k||A?J:void 0,customClickBehavior:k||A?ee:void 0},j&&"none"!==j&&{legendHoverBehavior:F.onLegendHover,legendClickBehavior:F.onLegendClick,legendHighlightedCategory:F.highlightedCategory,legendIsolatedCategories:F.isolatedCategories},{className:s,title:T,description:N,summary:W,accessibleTable:$},null!=t.animate&&{animate:t.animate},x))})}function ho(t){var r;const n=wn(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:a,className:s,childrenAccessor:l="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:y,colorByDepth:g=!1,labelMode:p="leaf",nodeLabel:f,padding:v=4,paddingTop:m,tooltip:b,frameProps:x={},selection:k,linkedHover:A,onObservation:w,onClick:S,chartId:O,loading:L,legendInteraction:j,stroke:D,strokeWidth:C,opacity:E}=t,P=n.width,I=n.height,_=n.enableHover,M=null===(r=n.showLabels)||void 0===r||r,T=n.title,N=n.description,W=n.summary,$=n.accessibleTable,B=ro(L,P,I),{activeSelectionHook:R,customHoverBehavior:z,customClickBehavior:H}=xn({selection:k,linkedHover:A,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:w,onClick:S,chartType:"Treemap",chartId:O}),F=function(e){const t=qt(e=>e.theme.colors.selectionOpacity);return i(()=>{var r,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}(k),Y=c(e=>{if(!e)return z(null);const t=e.data||e;z({data:(null==t?void 0:t.data)||t})},[z]),q=i(()=>oo(null!=o?o:null,l),[o,l]),X=bn(q,g?void 0:h,y),G=i(()=>{if(!h||g)return[];const e=new Set;for(const t of q){const r="function"==typeof h?h(t):t[h];null!=r&&e.add(r+"")}return Array.from(e)},[q,h,g]),V=kn(j,g?void 0:h,G),K=vn(),U=i(()=>new Map,[]),Z=i(()=>{if(Array.isArray(y))return y;if(K&&K.length>0)return K;const e=$r[y];return Array.isArray(e)?e:Br},[y,K]),Q=i(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=g?zr[(e.depth||0)%zr.length]:h?Fr(e.data||e,h,X):mn(0,K,y),t},[h,g,X,K,y,U]),J=i(()=>On(Q,{stroke:D,strokeWidth:C,opacity:E}),[Q,D,C,E]),ee=i(()=>R?e=>{var t;const r=Object.assign({},J(e));if(R.isActive)if(R.predicate(e.data||e))(null==F?void 0:F.selectedStyle)&&Object.assign(r,F.selectedStyle);else{const e=null!==(t=null==F?void 0:F.unselectedOpacity)&&void 0!==t?t:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==F?void 0:F.unselectedStyle)&&Object.assign(r,F.unselectedStyle)}return r}:J,[J,R,F]),te=i(()=>ao(u),[u]),re=void 0!==m?m:!M||"parent"!==p&&"all"!==p?void 0:18,ne=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof a?{top:a,bottom:a,left:a,right:a}:a),oe=In({componentName:"Treemap",data:o});return oe?e(Ln,{componentName:"Treemap",message:oe,width:P,height:I}):B||e(Qn,{componentName:"Treemap",width:P,height:I,children:e(Zr,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[P,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:te,padding:v,paddingTop:re,nodeStyle:ee,colorBy:h,colorScheme:Z,colorByDepth:g,nodeLabel:M?f||d:void 0,showLabels:M,labelMode:p,enableHover:_,tooltipContent:!1===b?()=>null:rn(b)||void 0},(A||w||S)&&{customHoverBehavior:Y},(w||S)&&{customClickBehavior:H},j&&"none"!==j&&{legendHoverBehavior:V.onLegendHover,legendClickBehavior:V.onLegendClick,legendHighlightedCategory:V.highlightedCategory,legendIsolatedCategories:V.isolatedCategories},{className:s,title:T,description:N,summary:W,accessibleTable:$},null!=t.animate&&{animate:t.animate},x))})}function yo(t){var r;const n=wn(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:a,className:s,childrenAccessor:c="children",valueAccessor:l="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:y=!1,nodeLabel:g,circleOpacity:p=.7,padding:f=4,tooltip:v,frameProps:m={},onObservation:b,onClick:x,chartId:k,selection:A,linkedHover:w,loading:S,legendInteraction:O,stroke:L,strokeWidth:j,opacity:D}=t,C=n.width,E=n.height,P=n.enableHover,I=null===(r=n.showLabels)||void 0===r||r,_=n.title,M=n.description,T=n.summary,N=n.accessibleTable,W=ro(S,C,E),$=i(()=>oo(null!=o?o:null,c),[o,c]),B=bn($,y?void 0:d,h),R=i(()=>{if(!d||y)return[];const e=new Set;for(const t of $){const r="function"==typeof d?d(t):t[d];null!=r&&e.add(r+"")}return Array.from(e)},[$,d,y]),z=kn(O,y?void 0:d,R),H=vn(),F=i(()=>new Map,[]),Y=i(()=>{if(Array.isArray(h))return h;if(H&&H.length>0)return H;const e=$r[h];return Array.isArray(e)?e:Br},[h,H]),q=i(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=y?zr[(e.depth||0)%zr.length]:d?Fr(e.data||e,d,B):mn(0,H,h),t},[d,y,B,p,H,h,F]),X=i(()=>On(q,{stroke:L,strokeWidth:j,opacity:D}),[q,L,j,D]),G=i(()=>ao(l),[l]),V=Object.assign(Object.assign({},n.marginDefaults),"number"==typeof a?{top:a,bottom:a,left:a,right:a}:a),{customHoverBehavior:K,customClickBehavior:U}=xn({selection:A,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),Z=In({componentName:"CirclePack",data:o});return Z?e(Ln,{componentName:"CirclePack",message:Z,width:C,height:E}):W||e(Qn,{componentName:"CirclePack",width:C,height:E,children:e(Zr,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[C,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:G,padding:f,nodeStyle:X,colorBy:d,colorScheme:Y,colorByDepth:y,nodeLabel:I?g||u:void 0,showLabels:I,enableHover:P,tooltipContent:!1===v?()=>null:rn(v)||void 0,customHoverBehavior:w||b||x?K:void 0,customClickBehavior:b||x?U:void 0},O&&"none"!==O&&{legendHoverBehavior:z.onLegendHover,legendClickBehavior:z.onLegendClick,legendHighlightedCategory:z.highlightedCategory,legendIsolatedCategories:z.isolatedCategories},{className:s,title:_,description:M,summary:T,accessibleTable:N},null!=t.animate&&{animate:t.animate},m))})}lo.displayName="ChordDiagram",uo.displayName="TreeDiagram",ho.displayName="Treemap",yo.displayName="CirclePack";const go=zr;function po(t){const r=wn(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:o,className:a,childrenAccessor:s="children",nodeIdAccessor:c="name",colorBy:l,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:y=2.95,speed:g=.25,revolution:p,revolutionStyle:f,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:A,foregroundGraphics:w,annotations:S,frameProps:O={},onObservation:L,onClick:j,chartId:D,selection:C,linkedHover:E,loading:P,stroke:I,strokeWidth:_,opacity:M}=t,T=r.width,N=r.height,W=r.enableHover,$=r.title,B=r.description,R=r.summary,z=r.accessibleTable,H=ro(P,T,N),F=bn(i(()=>oo(n,s),[n,s]),d?void 0:l,u),Y=vn(),q=i(()=>new Map,[]),X=i(()=>{if(Array.isArray(u))return u;if(Y&&Y.length>0)return Y;const e=$r[u];return Array.isArray(e)?e:Br},[u,Y]),G=i(()=>{if(Array.isArray(u))return u;const e=$r[u];return Array.isArray(e)?e:Br},[u]),V=i(()=>e=>{var t;const r={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return r.fill=d?n?G[0]:go[(e.depth||0)%go.length]:l?Fr(e.data||e,l,F):mn(0,Y,u),r.opacity=n?1:.85,r},[l,d,F,G,Y,u,q]),K=i(()=>On(V,{stroke:I,strokeWidth:_,opacity:M}),[V,I,_,M]),U=i(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Z=Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof o?{top:o,bottom:o,left:o,right:o}:o),{customHoverBehavior:Q,customClickBehavior:J}=xn({selection:C,linkedHover:E,fallbackFields:l?["string"==typeof l?l:""]:[],unwrapData:!0,onObservation:L,onClick:j,chartType:"OrbitDiagram",chartId:D}),ee=i(()=>{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=i(()=>{if(J)return e=>{J(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[J]),re=In({componentName:"OrbitDiagram",data:n});return re?e(Ln,{componentName:"OrbitDiagram",message:re,width:T,height:N}):H||e(Qn,{componentName:"OrbitDiagram",width:T,height:N,children:e(Zr,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[T,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,nodeIDAccessor:c,childrenAccessor:s,nodeStyle:K,edgeStyle:U,colorBy:l,colorScheme:X,colorByDepth:d,nodeSize:b,nodeLabel:x?c:void 0,showLabels:x,enableHover:!k&&W,tooltipContent:k?void 0:!1===A?()=>null:rn(A)||void 0,customHoverBehavior:E||L||j?ee:void 0,customClickBehavior:L||j?te:void 0,foregroundGraphics:w,annotations:S,className:a,title:$,description:B,summary:R,orbitMode:h,orbitSize:y,orbitSpeed:g,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:z},null!=t.animate&&{animate:t.animate},O))})}po.displayName="OrbitDiagram";export{lo as ChordDiagram,yo as CirclePack,no as ForceDirectedGraph,po as OrbitDiagram,co as SankeyDiagram,Zr as StreamNetworkFrame,uo as TreeDiagram,ho as Treemap};
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{useRef as o,useMemo as i,useContext as a,useCallback as l,useSyncExternalStore as s,createContext as c,useState as u,useEffect as d,useLayoutEffect as h,forwardRef as f,useImperativeHandle as g,useId as y}from"react";import{interpolateNumber as p}from"d3-interpolate";import{min as v,groups as m,max as b,sum as x,mean as k,group as w}from"d3-array";import{forceLink as A,forceSimulation as S,forceManyBody as L,forceCenter as D,forceX as _,forceY as E}from"d3-force";import{scaleLinear as P,scaleOrdinal as M}from"d3-scale";import{ribbon as I,chord as O}from"d3-chord";import{arc as C,pie as T}from"d3-shape";import{hierarchy as N,partition as W,pack as j,treemap as R,treemapBinary as $,cluster as B,tree as z}from"d3-hierarchy";function H(e,t,r,n){return Object.assign({data:e,x:t,y:r,__semioticHoverData:!0},n)}const F={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Y={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};function X(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function G(e,t,r){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(r)}`}function q(e){const t=e.map(X),r=t.length-1;return e=>{if(0>=e){const[e,r,n]=t[0];return G(e,r,n)}if(e>=1){const[e,n,o]=t[r];return G(e,n,o)}const n=e*r,o=Math.floor(n),i=n-o,[a,l,s]=t[o],[c,u,d]=t[o+1];return G(Math.round(a+(c-a)*i),Math.round(l+(u-l)*i),Math.round(s+(d-s)*i))}}const V=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K=q(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=q(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),U=q(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Q=q(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),J=q(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);q(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const ee=q(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),te=q(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);q(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),q(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),q(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),q(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),q(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),q(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),q(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),q(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),q(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),q(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),q(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);class re{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 r=this.particles[t];return r.active=!0,r.t=0,r.offset=Math.random()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}step(e,t,r,n){var o;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const l=r[a.edgeIndex];if(!l||!l.bezier){a.active=!1,this._freeIndices.push(i);continue}const s=n&&null!==(o=n[a.edgeIndex])&&void 0!==o?o:1;a.t+=e*t*s*(l.bezier.circular?.3:1),1>a.t?ne(l.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(i))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].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 r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}}function ne(e,t,r,n){if(e.circular&&e.segments)return void function(e,t,r,n,o){const i=e.length,a=t*i,l=Math.min(Math.floor(a),i-1),s=a-l,[c,u,d,h]=e[l];oe(c,u,d,h,s,o);const f=h.x-c.x,g=h.y-c.y,y=Math.sqrt(f*f+g*g);if(y>.001){const e=f/y;o.x+=-g/y*r*n*2,o.y+=e*r*n*2}}(e.segments,t,r,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[o,i,a,l]=e.points;oe(o,i,a,l,t,n);const s=l.x-o.x,c=l.y-o.y,u=Math.sqrt(s*s+c*c);if(u>.001){const t=s/u;n.x+=-c/u*r*e.halfWidth*2,n.y+=t*r*e.halfWidth*2}}function oe(e,t,r,n,o,i){const a=1-o,l=a*a,s=l*a,c=o*o,u=c*o;i.x=s*e.x+3*l*o*t.x+3*a*c*r.x+u*n.x,i.y=s*e.y+3*l*o*t.y+3*a*c*r.y+u*n.y}function ie(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function ae(e,t){var r,n=[],o=[],i=[],a={},l=[];function s(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&s(t)})}function c(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;l[e].length>t;t++)(n=l[e][t])===r?(u(r,o),d=!0):i[n]||(d=c(n));if(d)s(e);else for(t=0;l[e].length>t;t++){var h=a[n=l[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,t){var r=[].concat(t).concat(e);n.push(r)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),l=Array(t),s=0;t>s;++s)r[s]=-1,n[s]=0,o[s]=!1,i[s]=0,a[s]=-1,l[s]=[];var c,u=0,d=[],h=[];function f(t){var s=[t],c=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>i[t]){for(var g=i[t];f.length>g;++g){var y=f[g];if(0>r[y]){r[y]=n[y]=u,o[y]=!0,u+=1,s.push(y),c.push(y);break}o[y]&&(n[t]=0|Math.min(n[t],n[y])),0>a[y]||l[t].push(a[y])}i[t]=g}else{if(n[t]===r[t]){var p=[],v=[],m=0;for(g=s.length-1;g>=0;--g){var b=s[g];if(o[b]=!1,p.push(b),v.push(l[b]),m+=l[b].length,a[b]=d.length,b===t){s.length=g;break}}d.push(p);var x=Array(m);for(g=0;v.length>g;g++)for(var k=0;v[g].length>k;k++)x[--m]=v[g][k];h.push(x)}c.pop()}}}for(s=0;t>s;++s)0>r[s]&&f(s);for(s=0;h.length>s;s++){var g=h[s];if(0!==g.length){g.sort(function(e,t){return e-t}),c=[g[0]];for(var y=1;g.length>y;y++)g[y]!==g[y-1]&&c.push(g[y]);h[s]=c}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var l=0;o[a].length>l;l++)i>o[a][l]&&(i=o[a][l],r=a);var s=o[r];if(!s)return!1;var c=e.map(function(e,t){return-1===s.indexOf(t)?[]:e.filter(function(e){return-1!==s.indexOf(e)})});return{leastVertex:i,adjList:c}}r=0;for(var h=e.length;h>r;){var f=d(r);if(r=f.leastVertex,l=f.adjList){for(var g=0;l.length>g;g++)for(var y=0;l[g].length>y;y++){var p=l[g][y];i[+p]=!1,a[p]={}}c(r),r+=1}else r=h}return n}function le(e){return e.y0-e.y1>0?"up":"down"}function se(e,t){return t(e.source)==t(e.target)}function ce(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function ue(e){return e.target.x0-e.source.x1}function de(e,t){var r=fe(e),n=ue(t)/Math.tan(r);return"up"==le(e)?e.y1-n:e.y1+n}function he(e,t){var r=fe(e),n=ue(t)/Math.tan(r);return"up"==le(e)?e.y1+n:e.y1-n}function fe(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ge(e,t){return t(e)}function ye(e){return ve(e.source)}function pe(e){return ve(e.target)}function ve(e){return(e.y0+e.y1)/2}function me(e){return e.virtual?0:e.value}function be(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!se(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!se(e,t)?n+1:n}),r+n}function xe(e){return e.target.depth}function ke(e,t){return e.sourceLinks.length?e.depth:t-1}function we(e,t){return e.y0-t.y0}function Ae(e,t){return t.y0-e.y0}function Se(e,t){return e.y1-t.y1}function Le(e,t){return t.y1-e.y1}function De(e,t){return Ee(e.source,t.source)||e.index-t.index}function _e(e,t){return Ee(e.target,t.target)||e.index-t.index}function Ee(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Pe(e,t){return Me(e)==Me(t)?"bottom"==e.circularLinkType?Ae(e,t):we(e,t):Me(t)-Me(e)}function Me(e){return e.target.column-e.source.column}function Ie(e,t){return Oe(e)==Oe(t)}function Oe(e){return e.y0-e.y1>0?"up":"down"}function Ce(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var l=v(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var s=i.links.filter(function(e){return e.circular});return s.sort(function(e,t){return t.value-e.value}),s.forEach(function(e,t){e._circularStub=t>=4}),Te(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),Te(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.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,se(e,t)&&ce(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+o+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-o-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,s=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==s});c.sort("bottom"==e.circularLinkType?Ae:we);var u=0;c.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==s})).sort("bottom"==e.circularLinkType?Le:Se),u=0,c.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=l-o-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,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function Te(e,t,r){e.sort(Pe);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(se(e,t)&&ce(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var l=n[a];if(l!==e&&l.circularPathData&&void 0!==l.circularPathData.verticalBuffer&&Ne(e,l)){var s=l.circularPathData.verticalBuffer+(l._circularWidth||l.width)/2+r;i=s>i?s:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Ne(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function We(e){return function(){return e}}function je(e){return e.index}function Re(e){return e.nodes}function $e(e){return e.links}function Be(e,t,r){var n=m(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(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var l=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=ve(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=ve(e.target)*t,n+=t}}),n>0?o/n:NaN);l.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=l.get(e),n=l.get(t),o=r.bc,i=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(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?be(t,r)-be(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.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==be(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function ze(e,t,r,n,o,i){var a=m(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 l=1,s=i;s>0;--s)c(l*=.99,r),u();function c(t,r){var n=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var l;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&be(o,r)>0){var s=k(o.sourceLinks,pe),c=k(o.targetLinks,ye),u=s&&c?(s+c)/2:s||c;if(u){var d=(u-ve(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(l=o.y1-o.y0)/2,o.y1=e.y1/2+l/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(l=o.y1-o.y0)/2,o.y1=e.y1/2+l/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)l=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+l;else{var h=k(o.sourceLinks,pe),f=k(o.targetLinks,ye),g=((h&&f?(h+f)/2:h||f)-ve(o))*t;o.y0+=g,o.y1+=g}})})}function u(){a.forEach(function(r){var i,a,l,s=e.y0,c=r.length;for(r.sort(t||Ee),l=0;c>l;++l)(a=s-(i=r[l]).y0)>0&&(i.y0+=a,i.y1+=a),s=i.y1+n;if((a=s-n-e.y1)>0)for(s=i.y0-=a,i.y1-=a,l=c-2;l>=0;--l)(a=(i=r[l]).y1+o-s)>0&&(i.y0-=a,i.y1-=a),s=i.y0})}}function He(e){e.nodes.forEach(function(e){e.sourceLinks.sort(_e),e.targetLinks.sort(De)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=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=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function Fe(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,l=je,s=ke,c=void 0,u=32,d=2,h=Re,f=$e;function g(){var g={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return w(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=ie(r,n)),"object"!=typeof o&&(o=e.target=ie(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,l),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,l=i.target.index;n[a]||(n[a]=[]),n[l]||(n[l]=[]),-1===n[a].indexOf(l)&&n[a].push(l)}var s=ae(n);s.sort(function(e,t){return e.length-t.length});var c={};for(o=0;s.length>o;o++){var u=s[o].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[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=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,c),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){ge(e,t)!=ge(o.source,t)&&ge(e,t)!=ge(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),se(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,l),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(x(e.sourceLinks,me),x(e.targetLinks,me)),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,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-1:1});var a=0,l=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==l?a:a+1,l=t(e)==l?l:t(e),e.column=a})}for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,c,s);var f=i;if(null!==a){var g=m(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=b(g,function(e){return e.length});y>1&&(f=Math.max(1,(n-t)*a/(y-1)))}(function(e,t,r){var n=m(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 o=v(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/x(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=b(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,f,o),Be(h,c,l),ze(h,c,l,f,f,u),He(h),Ce(h,l,d,10,8),Be(h,c,l),ze(h,c,l,f,f,u),He(h),Ce(h,l,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return ge(r.source,t)==ge(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ie(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=de(t,e);return e.y1-r}if(t.target.column>e.target.column)return de(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,l),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return ge(r.target,t)==ge(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ie(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=he(t,e);return e.y0-r}if(t.source.column>e.source.column)return he(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,l),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){var i=v(t,function(e){return e.y0}),a=b(t,function(e){return e.y1}),l=(e.y1-e.y0)/(a-i);function s(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>l?(t.forEach(function(e){e.y0=s(e.y0),e.y1=s(e.y1)}),r.forEach(function(e){e.y0=s(e.y0),e.y1=s(e.y1),e.width=e.width*l})):t.forEach(function(e){var t=e.y1-e.y0,r=s(e.y0)-e.y0;e.y0=s(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),Ce(h,l,d,10,8)}(g),g}return g.update=function(e){return He(e),Ce(e,l,d,10,8),e},g.nodeWidth=function(e){return arguments.length?(o=+e,g):o},g.nodePadding=function(e){return arguments.length?(i=+e,g):i},g.nodePaddingRatio=function(e){return arguments.length?(a=+e,g):a},g.nodes=function(e){return arguments.length?(h="function"==typeof e?e:We(e),g):h},g.links=function(e){return arguments.length?(f="function"==typeof e?e:We(e),g):f},g.nodeId=function(e){return arguments.length?(l="function"==typeof e?e:We(e),g):l},g.nodeAlign=function(e){return arguments.length?(s="function"==typeof e?e:We(e),g):s},g.nodeSort=function(e){return arguments.length?(c=e,g):c},g.iterations=function(e){return arguments.length?(u=+e,g):u},g.circularLinkGap=function(e){return arguments.length?(d=+e,g):d},g.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],g):[[e,t],[r,n]]},g.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],g):[r-e,n-t]},g}const Ye=e=>{let t,r,n,o,i,a,l,s,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,l=p(i,a),s=l(.5),c=l(.5),`M${t},${i}C${t},${s} ${r},${c} ${r},${a}L${n},${a}C${n},${c} ${o},${s} ${o},${i}Z`):(t=e.source.x1,r=e.target.x0,l=p(t,r),n=l(.5),o=l(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,s=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${n},${i} ${o},${a} ${r},${a}L${r},${s}C${o},${s} ${n},${c} ${t},${c}Z`)};function Xe(e){var t;const r=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,o=e.circularPathData;if(!o)return null;if("down"===e.direction)return null;if(e._circularStub){const t=o.sourceX,n=o.sourceY,i=o.targetX,a=o.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const l=Math.max(15,Math.min(40,.33*(o.rightFullExtent-t))),s=Math.max(15,Math.min(40,.33*(i-o.leftFullExtent)));return`M${t},${n-r}L${t+l},${n-r}L${t+l},${n+r}L${t},${n+r}ZM${i},${a-r}L${i-s},${a-r}L${i-s},${a+r}L${i},${a+r}Z`}const i=o.sourceX,a=o.sourceY,l=o.targetX,s=o.targetY,c=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,f=Math.max(4,Math.min(n,15));return`M${i},${a-h*r}L${c},${a-h*r}L${c+n},${a-h*r+h*f}L${c+n},${d+h*n-h*f}L${c+n-f},${d+h*n}L${u-n+f},${d+h*n}L${u-n},${d+h*n-h*f}L${u-n},${s-h*r+h*f}L${u-n+f},${s-h*r}L${l},${s-h*r}L${l},${s+h*r}L${u+n},${s+h*r}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${a+h*r}L${i},${a+h*r}Z`}const Ge=new Set,qe=new WeakMap;function Ve(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let r=qe.get(e);if(r){const e=r.get(t);if(e)return e}else r=new Map,qe.set(e,r);const n=new Proxy(e,{get(e,r,n){if("string"==typeof r&&!(r in e)&&e.data&&r in e.data){const e=`${t}:${r}`;Ge.has(e)||(Ge.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,r,n)}});return r.set(t,n),n}const Ke={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(xe))-1:0},justify:ke};function Ze(e){return"string"==typeof e?e:e.id}const Ue={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i,a,l,s,c,u;if(0===e.length)return;const d="vertical"===r.orientation?"down":"right",h=r.nodeAlign||"justify",f=null!==(o=r.nodeWidth)&&void 0!==o?o:15,g=null!==(i=r.nodePaddingRatio)&&void 0!==i?i:.05,y=null!==(a=r.iterations)&&void 0!==a?a:100,p=e.map(e=>Object.assign({},e)),v=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 m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Fe().extent(m).links(v).nodes(p).nodeAlign(Ke[h]||ke).nodeId(e=>e.id).nodeWidth(f).iterations(y);b.nodePaddingRatio&&b.nodePaddingRatio(g),b();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of p)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(null!==(s=null!==(l=n._circularWidth)&&void 0!==l?l:n.width)&&void 0!==s?s:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-r,u=n[0],d=n[1];if(i>0&&a>0&&(0>e||0>r||t>u||o>d)){const t=Math.min(u/i,d/a),n=-e*t+(u-i*t)/2,o=-r*t+(d-a*t)/2;for(const e of p)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of v)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of p){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const 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 v){const t=Ze(e.source),r=Ze(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${r}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u: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=d;const o=x.get(t),i=x.get(r);o&&(n.source=o),i&&(n.target=i)}}},buildScene(e,t,r,n){var o,i,a,l,s,c;const u="vertical"===r.orientation?"down":"right",d=r.nodeStyle,h=r.edgeStyle,f=null!==(o=r.edgeOpacity)&&void 0!==o?o:.5,g=r.edgeColorBy||"source",y=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:V,p=new Map;e.forEach((e,t)=>{p.set(e.id,y[t%y.length])});const v=[],m=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=d?d(Ve(t,"nodeStyle")):{},o={fill:n.fill||p.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof o.fill?o.fill:null)||p.get(t.id)||"#4d430c"),v.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:o,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:o,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 o=(null===(i=r.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=r.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";o="function"==typeof g?g(e)||o:"target"===g?x.get(n.id)||p.get(n.id)||o:x.get(t.id)||p.get(t.id)||o;const u=h?h(Ve(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),i=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=u.fill||o;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+n},${t.sourceY-r}L${t.sourceX+n},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:a,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:f,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-i},${t.targetY-r}L${t.targetX-i},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:f,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-i,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?Xe(e):Ye(e),!d)continue;const y={fill:u.fill||o,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:f,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};m.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:y,datum:e})}if(!1!==r.showLabels){const t=(w=r.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const r of e){const e=r.x1-r.x0,o=r.y1-r.y0;if(0>=e||0>=o)continue;const i=t?t(r):r.id;if(!i)continue;let a,l,s;"down"===u?(a=r.y0+(r.y1-r.y0)/2,l=r.x1+14,s="start"):(n[0]/2>r.x0+e/2?(a=r.x0-6,s="end"):(a=r.x1+6,s="start"),l=r.y0+o/2),b.push({x:a,y:l,text:i+"",anchor:"down"===u?"middle":s,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},Qe={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){var o,i;if(0===e.length)return;const a=null!==(o=r.forceStrength)&&void 0!==o?o:.1,l=n[0]/2,s=n[1]/2,c=r.__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),r=null==c?void 0:c.get(t.id);e?u++:r?(t.x=r.x,t.y=r.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of d){const n=Je(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=et(e.id),i=o%360*(Math.PI/180),a=10+o%20;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=et(e.id),r=t%360*(Math.PI/180),n=15+t%30;e.x=l+n*Math.cos(r),e.y=s+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5),o=r*t;n.x=l+e*Math.cos(o),n.y=s+e*Math.sin(o)}}}const f=null!==(i=r.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=0===r.iterations?0:h?40:f,y=tt(r.nodeSize,r.nodeSizeRange,e),p=e=>y(e);if(g>0){const r=A().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),n=S().force("charge",L().strength(e=>-25*p(e))).force("center",D(l,s).strength(.8)).force("x",_(l).strength(.15)).force("y",E(s).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}));n.force("link",r),n.force("link").links(e)}h?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;g>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(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 v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){var o,i,a,l,s,c,u;const d=r.nodeStyle,h=r.edgeStyle,f=tt(r.nodeSize,r.nodeSizeRange,e),g=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:V,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const p=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(Ve(t,"nodeSize")),n=d?d(Ve(t,"nodeStyle")):{},l={fill:n.fill||y.get(t.id)||(null===(o=r.themeSemantic)||void 0===o?void 0:o.primary)||"#007bff",stroke:n.stroke||(null===(i=r.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=n.strokeWidth)&&void 0!==a?a:2,opacity:n.opacity};p.push({type:"circle",cx:t.x,cy:t.y,r:e,style:l,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 o=h?h(Ve(e,"edgeStyle")):{},i={stroke:o.stroke||(null===(l=r.themeSemantic)||void 0===l?void 0:l.border)||(null===(s=r.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",strokeWidth:null!==(c=o.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=o.opacity)&&void 0!==u?u:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:i,datum:e})}if(!1!==r.showLabels){const t=(x=r.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=f(Ve(r,"nodeSize"));m.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:v,labels:m}}};function Je(e,t,r){const n=[];for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,i="string"==typeof o.target?o.target:o.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=r.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function et(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function tt(e,t,r){var n,o;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=r.map(t=>{var r;return null===(r=t.data)||void 0===r?void 0:r[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const l=null!==(n=v(a))&&void 0!==n?n:0,s=null!==(o=b(a))&&void 0!==o?o:1;if(l===s)return()=>(i[0]+i[1])/2;const c=P().domain([l,s]).range(i).clamp(!0);return t=>{var r;const n=null===(r=t.data)||void 0===r?void 0:r[e];return null==n||"number"!=typeof n?i[0]:c(n)}}const rt=V,nt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=r,l=Math.min(n[0],n[1])/2,s=l-i,c=n[0]/2,u=n[1]/2,d=(h=r.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const g=e.length,y=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,r=f.get("string"==typeof e.source?e.source:e.source.id),n=f.get(t);if(void 0===r||void 0===n)continue;const o=d(e);y[r][n]=o}const p=O().padAngle(o);a&&p.sortGroups(a);const v=p(y),m=v.groups,b=C().innerRadius(s).outerRadius(l);for(const t of m){const r=e[t.index],n=b.centroid({innerRadius:s,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle});r.x=n[0]+c,r.y=n[1]+u,r.__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,r=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);r&&(e.source=r),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 v){const r=e[t.source.index].id,n=e[t.target.index].id,o=k.get(`${r}\0${n}`)||k.get(`${n}\0${r}`);o&&(o.__chordData=t)}},buildScene(e,t,r,n){var o,i,a,l;const{groupWidth:s=20,edgeOpacity:c=.5}=r,u=Math.min(n[0],n[1])/2,d=u-s,h=n[0]/2,f=n[1]/2,g=r.nodeStyle,y=r.edgeStyle,p=r.edgeColorBy||"source",v=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:rt,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=I().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.__arcData;if(!n)continue;let i;i=g?g(Ve(r,"nodeStyle")).fill||m.get(r.id)||v[t%v.length]:m.get(r.id)||v[t%v.length];const a=g?g(Ve(r,"nodeStyle")):{},l={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(o=a.strokeWidth)&&void 0!==o?o:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:f,innerR:d,outerR:u,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:l,datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=b(t);if(!n)continue;const o=ot(n,h,f);let s=(null===(i=r.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=r.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(y)s=y(Ve(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===p&&r?s=m.get(r.id)||s:t&&(s=m.get(t.id)||s)}const u=y?y(Ve(e,"edgeStyle")):{},d={fill:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:o,style:d,datum:e})}if(!1!==r.showLabels){const t=(A=r.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,n=u+12;for(const r of e){const e=r.__arcData;if(!e)continue;const o=t?t(r):r.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;w.push({x:h+Math.cos(a)*n,y:f+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function ot(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}const it=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function at(e){const[t,r,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*r+.114*n>150?"#222":"#fff"}function lt(e,t,r){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-"+r}function st(e){return e?"function"==typeof e?e:t=>{var r;return(null===(r=t.data)||void 0===r?void 0:r[e])||t[e]||t.id}:null}function ct(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:it}function ut(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 dt(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}const ht={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){var o;const i=r.__hierarchyRoot;if(!i)return;const a=r.chartType,l=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(r.childrenAccessor),s=r.hierarchySum,c="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,u=N(i,l);u.sum(c),u.sort((e,t)=>{var r,n;return(null!==(r=t.value)&&void 0!==r?r:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[d,h]=n;switch(a){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=z();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=B();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(u,r,d,h);break;case"treemap":!function(e,t,r,n){var o,i;const a=null!==(o=t.padding)&&void 0!==o?o:4,l=null!==(i=t.paddingTop)&&void 0!==i?i:0,s=R().size([r,n]).tile($).padding(a);l>0&&s.paddingTop(l),s(e)}(u,r,d,h);break;case"circlepack":!function(e,t,r,n){var o;const i=null!==(o=t.padding)&&void 0!==o?o:4;j().size([r,n]).padding(i)(e)}(u,r,d,h);break;case"partition":!function(e,t,r,n){var o;W().size([r,n]).padding(null!==(o=t.padding)&&void 0!==o?o:1)(e)}(u,r,d,h)}const f=u.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;f.length>t;t++){const n=f[t],i={id:lt(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=n.value)&&void 0!==o?o:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===a||"cluster"===a?ft(i,n,r):"treemap"===a||"partition"===a?gt(i,n):"circlepack"===a&&yt(i,n),i.__hierarchyNode=n,e.push(i),g.set(n,i)}if("tree"===a||"cluster"===a)for(const e of f)if(e.parent){const r=g.get(e.parent),n=g.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){var a,l,s,c,u,d,h,f;const g=[],y=[],p=[],v=r.treeOrientation||"vertical",m="radial"===v,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=r.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;m&&(e+=b,n+=x);const i=o(Ve(t,"nodeStyle"));let s=i.fill||ut(r);if(r.colorByDepth&&void 0!==t.depth){const e=ct(r);s=e[t.depth%e.length]}const c={fill:s,stroke:i.stroke||(null===(a=r.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(l=i.strokeWidth)&&void 0!==l?l:1,opacity:i.opacity};g.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!==(s=r.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,a=t.y,l=n.x,s=n.y;m&&(o+=b,a+=x,l+=b,s+=x);const f=dt(o,a,l,s,v),g=i(Ve(e,"edgeStyle")),p={fill:"none",stroke:g.stroke||(null===(c=r.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=r.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=g.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=g.opacity)&&void 0!==h?h:A};y.push({type:"curved",pathD:f,style:p,datum:e})}if(!1!==r.showLabels){const t=st(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,l=r.y;if(m&&(a+=b,l+=x),m){const e=a-b,t=l-x,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=l+t/r*10,i=0>e?"end":"start"):(n=a,o=l-12,i="middle")}else"horizontal"===v?((null===(f=r.data)||void 0===f?void 0:f.children)&&0!==r.data.children.length?(n=a-k-6,i="end"):(n=a+k+6,i="start"),o=l):(n=a,o=l+k+14,i="middle");p.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:y,labels:p}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){var o,i,a,l,s;const c=[],u=[];for(const r of e){const e=r.x1-r.x0,a=r.y1-r.y0;if(0>=e||0>=a)continue;const l=n(Ve(r,"nodeStyle"));let s=l.fill||ut(t);if(t.colorByDepth&&void 0!==r.depth){const e=ct(t);s=e[r.depth%e.length]}const u={fill:s,stroke:l.stroke||(null===(o=t.themeSemantic)||void 0===o?void 0:o.surface)||"#fff",strokeWidth:null!==(i=l.strokeWidth)&&void 0!==i?i:1,opacity:l.opacity};c.push({type:"rect",x:r.x0,y:r.y0,w:e,h:a,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=st(t.nodeLabel),o=t.labelMode||"leaf",i="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(!i){if("leaf"===o&&!h)continue;if("parent"===o&&h)continue}const f=r?r(c):c.id;if(!f)continue;if((h?30:40)>e||(h?16:14)>d)continue;let g=n(Ve(c,"nodeStyle")).fill||ut(t);if(t.colorByDepth&&void 0!==c.depth){const e=ct(t);g=e[c.depth%e.length]}const y="string"==typeof g?at(g):null!==(s=null===(l=t.themeSemantic)||void 0===l?void 0:l.text)&&void 0!==s?s:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:f+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:f+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,r,0,o);case"circlepack":return function(e,t,r,n){var o,i,a,l,s,c,u,d,h,f;const g=[],y=[];for(const r of e){const e=null!==(o=r.__radius)&&void 0!==o?o:5;if(0>=e)continue;const s=n(Ve(r,"nodeStyle"));let c=s.fill||ut(t);if(t.colorByDepth&&void 0!==r.depth){const e=ct(t);c=e[r.depth%e.length]}const u={fill:c,stroke:s.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=s.strokeWidth)&&void 0!==a?a:1,opacity:null!==(l=s.opacity)&&void 0!==l?l:.7};g.push({type:"circle",cx:r.x,cy:r.y,r:e,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=st(t.nodeLabel);for(const o of e){const e=null!==(s=o.__radius)&&void 0!==s?s:5,i=r?r(o):o.id;if(!i)continue;if(15>e)continue;const a=!((null===(c=o.data)||void 0===c?void 0:c.children)&&o.data.children.length>0);let l=n(Ve(o,"nodeStyle")).fill||ut(t);if(t.colorByDepth&&void 0!==o.depth){const e=ct(t);l=e[o.depth%e.length]}if(a){const r="string"==typeof l?at(l):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";y.push({x:o.x,y:o.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:r})}else y.push({x:o.x,y:o.y-e+14,text:i+"",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===(f=t.themeSemantic)||void 0===f?void 0:f.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:g,sceneEdges:[],labels:y}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function ft(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-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 gt(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 yt(e,t){var r;const n=null!==(r=t.r)&&void 0!==r?r: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 pt(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const vt={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){var i,a;const l=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var r;return(null!==(r=e[t])&&void 0!==r?r:"")+""}}(r.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),u=null!==(i=r.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=r.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,f="number"==typeof d?()=>d:d,g=pt(r);g.metaMap.clear(),n.length=0,o.length=0;const y=new Map;function p(e){var t;const r=null!==(t=y.get(e))&&void 0!==t?t:0;return y.set(e,r+1),0===r?e:`${e}__${r}`}const v=t[0]/2,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=p(s(e));n.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),g.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,i,a,u,d,y){const v=l(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const A=(m+1)/b,S={id:r,depth:d,data:t,parentId:r},L=y?u/h(S)*A:u*A,D=T().value(e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.length)?4:1}).sort(null),_=D(k),E=f(S);for(let t=0;k.length>t;t++){const l=(_[t].startAngle+_[t].endAngle)/2,c=k[t],u=p(s(c)),h=i+L*Math.sin(l),f=a+L*Math.cos(l)*E;n.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:d,data:c}),g.metaMap.set(u,{ring:L,angle:l,depth:d,parentId:r,eccentricity:E}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(c,u,h,f,L,d+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){var o,i,a,l,s,c,u;const d=r.nodeStyle,h=r.nodeSize,f="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,g=[],y=[],p=[];if(!1!==r.orbitShowRings){const t=pt(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const l=o/i*Math.PI*2,s=(o+1)/i*Math.PI*2;y.push({type:"line",x1:e+r*Math.sin(l),y1:t+r*Math.cos(l)*n,x2:e+r*Math.sin(s),y2:t+r*Math.cos(s)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=f(Ve(t,"nodeSize")),n=d?d(Ve(t,"nodeStyle")):{},c={fill:n.fill||(null===(o=r.themeSemantic)||void 0===o?void 0:o.primary)||"#6366f1",stroke:n.stroke||(null===(i=r.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=n.strokeWidth)&&void 0!==a?a:1,opacity:null!==(l=n.opacity)&&void 0!==l?l:0===(null!==(s=t.depth)&&void 0!==s?s:0)?1:.85};g.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 v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),r="object"==typeof e.target?e.target:v.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&y.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=f(Ve(r,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(r):t&&null!==(u=null===(c=r.data)||void 0===c?void 0:c[t])&&void 0!==u?u:r.id;p.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:g,sceneEdges:y,labels:p}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){var r,n;const o=pt(t),i=null!==(r=t.orbitSpeed)&&void 0!==r?r:.25,a=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 r=null!==(t=e.depth)&&void 0!==t?t:0;return(r%2==0?1:-1)/(r+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),l=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,s=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=c.get(e.parentId);if(!r)continue;const n=e.angle+l*s*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(n),t.y=r.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,r),!0)},mt={sankey:Ue,force:Qe,chord:nt,tree:ht,cluster:ht,treemap:ht,circlepack:ht,partition:ht,orbit:vt};function bt(e){return mt[e]}const xt={category10:V,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:K,reds:Z,greens:U,oranges:Q,purples:J,viridis:ee,plasma:te},kt=V,wt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],At=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],St=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 Lt(e,t,r){if("function"==typeof t){const n=t(e);return r&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||St.has(t)}(n)?r(n):n}const n=(null==e?void 0:e[t])+"";return r?r(n):kt[Math.abs(function(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return Math.abs(t)}(n))%kt.length]}function Dt(e,t,r="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),o=n.every(e=>!isNaN(Number(e)));if(Array.isArray(r))return M().domain(n).range(r).unknown("#999");const i=xt[r]||xt.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of n){const r=Number(t);r>e&&(e=r)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:kt;return M().domain(n).range(e).unknown("#999")}}function _t(e){return 0===e.length?()=>"#4e79a7":t=>{var r;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(r=e[Math.abs(n)%e.length])&&void 0!==r?r:"#4e79a7"}}function Et(e,t,r){return e+(t-e)*r}function Pt(e,t,r){var n,o,i;if(1>=r)return 1;const a=null!==(n=e.minOpacity)&&void 0!==n?n:.1,l=r-1-t;switch(e.type){case"linear":return a+(1-l/(r-1))*(1-a);case"exponential":{const t=null!==(o=e.halfLife)&&void 0!==o?o:r/2;return a+Math.pow(.5,l/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*r)>l?1:a;default:return 1}}class Mt{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({},F),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new re(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({},F),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new re(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,r){const{nodeIDAccessor:n="id",sourceAccessor:o="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,l="function"==typeof n?n:e=>e[n],s="function"==typeof o?o:e=>e[o],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._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=l(t)+"";this.nodes.set(e,Object.assign(Object.assign({},It(e)),{data:t}))}for(let e=0;t.length>e;e++){const r=t[e],n=s(r)+"",o=c(r)+"",i=Number(u(r))||1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},It(n)),{data:r})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},It(o)),{data:r}));const a=`${n}\0${o}\0${e}`;this.edges.set(a,{source:n,target:o,value:i,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:a})}this.runLayout(r)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,It(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,It(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const l=this.edgeKey(t,r),s=this.edges.get(l);let c=!1;return s?(s.value+=n,this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(l,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.newEdge,i=!0),o||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,r,n,o,i,a,l,s;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=bt(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 l of u)if(void 0!==l._prevX0){const s=(null!==(t=l._prevX1)&&void 0!==t?t:0)-(null!==(r=l._prevX0)&&void 0!==r?r:0),c=(null!==(n=l._prevY1)&&void 0!==n?n:0)-(null!==(o=l._prevY0)&&void 0!==o?o:0);e.set(l.id,{x:(null!==(i=l._prevX0)&&void 0!==i?i:0)+s/2,y:(null!==(a=l._prevY0)&&void 0!==a?a:0)+c/2})}else 0===l.x&&0===l.y||e.set(l.id,{x:l.x,y:l.y});if(this._lastPositionSnapshot)for(const[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);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],r=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=r,this.edges.set(r,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.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 f=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),g=null!==(s=null===(l=this.config.transition)||void 0===l?void 0:l.duration)&&void 0!==s?s:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&g>0){const t=e[0]/2,r=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(const e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g}}else f&&g>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g});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,r,n,o,i,a;const l=Array.from(this.nodes.values()),s=Array.from(this.edges.values());if(this.config.customNetworkLayout){const c=function(e,t,r){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=xt[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:r}(this.config.colorScheme,this.config.themeCategorical,V),u={nodes:l,edges:s,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:_t(c),config:null!==(r=this.config.layoutConfig)&&void 0!==r?r:{}};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!==(n=d.sceneNodes)&&void 0!==n?n:[],this.sceneEdges=null!==(o=d.sceneEdges)&&void 0!==o?o:[],this.labels=null!==(i=d.labels)&&void 0!==i?i:[],void(this.customLayoutOverlays=null!==(a=d.overlays)&&void 0!==a?a:null)}this.customLayoutOverlays=null;const c=bt(this.config.chartType);if(!c)return;const{sceneNodes:u,sceneEdges:d,labels:h}=c.buildScene(l,s,this.config,e);this.sceneNodes=u,this.sceneEdges=d,this.labels=h}get isAnimating(){const e=bt(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=bt(this.config.chartType);if(!(null==r?void 0:r.tick))return!1;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());return r.tick(n,o,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=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),r=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Et(e._prevX0,e._targetX0,r),e.x1=Et(e._prevX1,e._targetX1,r),e.y0=Et(e._prevY0,e._targetY0,r),e.y1=Et(e._prevY1,e._targetY1,r));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=Et(e._prevY0,e._targetY0,r),e.y1=Et(e._prevY1,e._targetY1,r),e.sankeyWidth=Et(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const r=null==e?void 0:e.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.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 r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.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,r="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&r&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,r))}buildStandardBezier(e,t,r){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const o=t.x1,i=r.x0,a=p(o,i);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:n}}const o=t.x1,i=r.x0,a=p(o,i);return{circular:!1,points:[{x:o,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(!r)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,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,r,n,o,i;const a=this.config.pulse;if(!a)return;const l=null!==(t=a.duration)&&void 0!==t?t:500,s=null!==(r=a.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",c=null!==(n=a.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const n=this.nodeTimestamps.get(r);if(!n)continue;const o=e-n;l>o&&(t._pulseIntensity=1-o/l,t._pulseColor=s,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const r=t.datum;if(!r)continue;const n="object"==typeof r.source?null===(o=r.source)||void 0===o?void 0:o.id:r.source,a="object"==typeof r.target?null===(i=r.target)||void 0===i?void 0:i.id:r.target;if(!n||!a)continue;const c=this.edgeTimestamps.get(`${n}\0${a}`);if(!c)continue;const u=e-c;l>u&&(t._pulseIntensity=1-u/l,t._pulseColor=s)}}applyDecay(){var e,t;const r=this.config.decay;if(!r)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 o=this._decaySortedNodes,i=new Map;for(let e=0;o.length>e;e++)i.set(o[e][0],e);for(const o of this.sceneNodes){const a=o.id;if(!a)continue;const l=i.get(a);if(void 0===l)continue;const s=Pt(r,l,n),c=null!==(t=null===(e=o.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;o.style=Object.assign(Object.assign({},o.style),{opacity:c*s})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const r=e-this.lastTopologyChangeTime;if(r>=2e3)return;const n=1-r/2e3;for(const e of this.sceneNodes){const r=e.id;r&&this.addedNodes.has(r)&&(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,r;const n=this.config.thresholds;if(!n)return;const o=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(r=n.criticalColor)&&void 0!==r?r:"#ef4444",a=!1!==n.pulse;for(const t of this.sceneNodes){const r=t.id;if(!r)continue;const l=this.nodes.get(r);if(!l)continue;const s=n.metric(l);let c=null;void 0===n.critical||n.critical>s?void 0===n.warning||n.warning>s||(c=o):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const r=e.metric(t);if(void 0!==e.warning&&r>=e.warning||void 0!==e.critical&&r>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const r="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>r-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var r;const n=this.nodes.get(e);if(!n)return null;const o=n.data?Object.assign({},n.data):{};return n.data=t(null!==(r=n.data)&&void 0!==r?r:{}),this.layoutVersion++,o}updateEdge(e,t,r){var n;const o=this.config.valueAccessor,i="function"==typeof o?o:o?e=>e[o]:e=>e.value,a=[];for(const[,o]of this.edges)if(("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t){a.push(o.data?Object.assign({},o.data):{}),o.data=r(null!==(n=o.data)&&void 0!==n?n:{});const e=i(o.data);null!=e&&(o.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,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)!==e&&("string"==typeof r.target?r.target:r.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const r=[];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,o]of this.edges)o.data&&n(o.data)===e&&r.push(t)}else for(const[n,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t&&r.push(n);for(const e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0&&this.layoutVersion++,r.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 It(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 Ot(...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 Ct(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Tt(e,t,r,n,o=30){let i=null,a=o,l=1/0;for(const t of e){const e=Nt(t,r,n,o);if(e)if("rect"===t.type){const r=t.w*t.h;l>r&&(i=e,l=r)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=Bt(e,r,n);t&&a>t.distance&&(i=t,a=t.distance)}return i}function Nt(e,t,r,n=30){switch(e.type){case"circle":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i),l=function(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}(e.r,n);return a>l?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"rect":return function(e,t,r){const n=function(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=Ct(Math.atan2(o,n)),l=Ct(e.startAngle),s=Ct(e.endAngle);if(l>s?a>=l||s>=a:a>=l&&s>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);default:return null}}let Wt=null,jt=null;function Rt(){return jt||(Wt=document.createElement("canvas"),Wt.width=1,Wt.height=1,jt=Wt.getContext("2d")),jt}function $t(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 Bt(e,t,r){switch(e.type){case"bezier":return function(e,t,r){var n,o;if(!e.pathD)return null;const i=$t(e),a=Rt();if(!i||!a)return null;try{if(a.isPointInPath(i,t,r)){const i="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.source)?e.datum.source:null,a="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:r,distance:0}}const l=a.lineWidth;a.lineWidth=10;const s=a.isPointInStroke(i,t,r);if(a.lineWidth=l,s)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const l=e.x1+a*n,s=e.y1+a*o,c=Math.sqrt(Math.pow(t-l,2)+Math.pow(r-s,2));return c>5?null:{type:"edge",datum:e.datum,x:l,y:s,distance:c}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;const n=$t(e),o=Rt();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch(e){}return null}(e,t,r);default:return null}}function zt(e,t,r){const{group:n,indexInGroup:o}=t,i=r.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>o?i[o+1]._flatIndex:t.flatIndex;case"ArrowLeft":return o>0?i[o-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=r.groups.indexOf(n);return r.groups.length-1>e?Ht(r,r.groups[e+1],i[o]):t.flatIndex}case"ArrowUp":{const e=r.groups.indexOf(n);return e>0?Ht(r,r.groups[e-1],i[o]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*r.flat.length)),r.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*r.flat.length)),0);case"Home":return 0;case"End":return r.flat.length-1;case"Escape":return-1;default:return null}}function Ht(e,t,r){const n=e.byGroup.get(t);let o=0,i=Math.abs(n[0].x-r.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-r.x);i>t&&(i=t,o=e)}return n[o]._flatIndex}function Ft(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}const Yt="var(--semiotic-focus, #005fcc)";function Xt({active:t,hoverPoint:r,margin:n,size:o,shape:i="circle",width:a,height:l}){if(!t||!r)return null;const s=r.x+n.left,c=r.y+n.top;let u;if("rect"===i&&null!=a&&null!=l){const t=Math.max(a,4),r=Math.max(l,4);u=e("rect",{x:s-t/2-3,y:c-r/2-3,width:t+6,height:r+6,rx:3,fill:"none",stroke:Yt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===i?{cx:s,cy:c,r:12,fill:"none",stroke:Yt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:Yt,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Gt({x:t,y:r,containerWidth:o,containerHeight:i,margin:a,children:l,className:s="stream-frame-tooltip",zIndex:c=1}){const u=n.useRef(null),[d,h]=n.useState(null);n.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,s,o,i]);let f;return f=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-r?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>r?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:s,style:{position:"absolute",left:a.left+t,top:a.top+r,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"},children:l})}function qt(t){let r=null;const n=()=>(r||(r=c(null)),r),u=Vt(t);return[function({children:r,initialState:a}){const l=o(a),s=i(()=>Vt(t,l.current),[]),c=n();return e(c.Provider,{value:s,children:r})},e=>{var t;const r=n(),i=null!==(t=a(r))&&void 0!==t?t:u,c=o(e);c.current=e;const d=l(()=>c.current(i.getState()),[i]),h=l(()=>c.current(i.getState()),[i]);return s(i.subscribe,d,h)}]}function Vt(e,t){const r=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),r.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return r.addEventListener("update",e),()=>r.removeEventListener("update",e)}}}function Kt(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 Zt(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:Ut})})),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 Ut=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Qt={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}},Jt={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}},er={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ut,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 tr(e,t){if("light"===t)return Qt;if("dark"===t)return Jt;if("high-contrast"===t)return er;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?Jt:Qt;return Zt(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 Zt(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[rr,nr]=qt(e=>({theme:Qt,setTheme(t){e(e=>({theme:tr(e.theme,t)}))}}));const or=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ir=new WeakMap;let ar=0,lr=!1,sr=null,cr=null,ur=null;function dr(e,t){var r,n;if(!t)return t;const o=or.exec(t);if(!o)return t;const i=e.canvas;if(!i)return(null===(r=o[2])||void 0===r?void 0:r.trim())||t;!function(){if(lr)return;if("undefined"==typeof window||"undefined"==typeof document)return;lr=!0;const e=()=>{ar++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(sr=new MutationObserver(e),sr.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{cr=window.matchMedia("(prefers-color-scheme: dark)"),ur=e,"function"==typeof cr.addEventListener?cr.addEventListener("change",ur):"function"==typeof cr.addListener&&cr.addListener(ur)}catch(e){}}();let a=ir.get(i);a&&a.version===ar||(a={version:ar,map:new Map},ir.set(i,a));const l=a.map.get(t);if(void 0!==l)return l;const s=getComputedStyle(i).getPropertyValue(o[1]).trim()||(null===(n=o[2])||void 0===n?void 0:n.trim())||t;return a.map.set(t,s),s}const hr="undefined"==typeof window?d:h;function fr(e,t,r){return"function"==typeof e?e({size:t,margin:r}):e}function gr(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),r=o(t);r.current=t;const[a,s]=function(e,t,r){const n=o(null),[i,a]=u(null);return d(()=>{if(!t&&!r)return;const e=n.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:r}=t.contentRect;a(t=>t&&t.w===e&&t.h===r?t:{w:e,h:r})}});return o.observe(e),()=>o.disconnect()},[t,r]),[n,[t&&i?i.w:e[0],r&&i?i.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=i(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=s[0]-c.left-c.right,f=s[1]-c.top-c.bottom,g=fr(e.foregroundGraphics,s,c),y=fr(e.backgroundGraphics,s,c),p=nr(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var r,n;if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&(null===(r=window.matchMedia)||void 0===r?void 0:r.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:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+n.useId(),x=o(0),k=o(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=o(()=>{}),S=o(()=>{}),L=o(null),D=o(0),_=l(()=>{D.current=0;const e=L.current;L.current=null,e&&A.current(e)},[]),E=l(e=>{L.current={clientX:e.clientX,clientY:e.clientY},0===D.current&&(D.current=requestAnimationFrame(_))},[_]),P=l(()=>{L.current=null,0!==D.current&&(cancelAnimationFrame(D.current),D.current=0),S.current()},[]);d(()=>()=>{L.current=null,0!==D.current&&(cancelAnimationFrame(D.current),D.current=0)},[]);const M=e.themeDirtyRef;return hr(()=>{M&&(ar++,M.current=!0,w())},[p,w,M]),{reducedMotion:t,reducedMotionRef:r,responsiveRef:a,size:s,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:y,currentTheme:p,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:E,onPointerLeave:P}}const yr={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function pr(e,t,r,n){let o;return o="function"==typeof r?r(e):(0,yr[r])(n(e,t)),o}function vr(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function mr(e,t,r){return r&&r.size>0?r.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const br=(r,n,o,i,a,l,s,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=r,y=[];let p=0;const v=!(!n&&!o),m="isolate"===d||void 0===d&&null!=a;return g.forEach((r,d)=>{const b=pr(r,d,h,f),x=mr(r,i,a),k=a&&a.size>0&&a.has(r.label);y.push(t("g",{transform:`translate(0,${p})`,onClick:n?()=>n(r):void 0,onMouseEnter:o?()=>o(r):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?c===l&&d===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=i&&r.label===i||void 0,"aria-label":r.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(r)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const r=(d+("ArrowDown"===e.key?1:-1)+g.length)%g.length;u(c,r);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[r];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{u(c,d),o&&o(r);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*r.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(vr,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label})]},"legend-item-"+d)),p+=22}),y};function xr({config:r,orientation:o="vertical",width:i=100}){const{colorFn:a,domain:l,label:s,format:c}=r,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+n.useId();if("horizontal"===o){const r=12,n=Math.min(i,200),o=Math.max(0,(i-n)/2),c=[];for(let t=0;64>=t;t++){const r=t/64;c.push(e("stop",{offset:100*r+"%",stopColor:a(l[0]+r*(l[1]-l[0]))},t))}return t("g",{"aria-label":s||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),s&&e("text",{x:o+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e("rect",{x:o,y:0,width:n,height:r,fill:`url(#${d})`,rx:2}),e("text",{x:o,y:r+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])}),e("text",{x:o+n,y:r+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])})]})}const h=[];for(let t=0;64>=t;t++){const r=t/64;h.push(e("stop",{offset:100*r+"%",stopColor:a(l[1]-r*(l[1]-l[0]))},t))}return t("g",{"aria-label":s||"Gradient legend",children:[s&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(l[0])})]})}function kr(r){const{legendGroups:o,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:l,isolatedCategories:s,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical"}=r,[g,y]=n.useState(0),[p,v]=n.useState(0),m=n.useCallback((e,t)=>{y(e),v(t)},[]),b="vertical"===f?(({legendGroups:t,width:r,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,f)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:r,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:br(t,n,o,i,a,l,s,f,c,u)},"legend-group-"+f)),d+=22*t.items.length+8}),h})({legendGroups:o||[],width:d,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:l,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:r,height:n,width:o,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:l,isolatedCategories:s,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let f=0;const g=[];r.forEach((r,n)=>{let y=0;r.label&&(y+=16);const p=((r,n,o,i,a,l,s,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:y}=r,p=[];let v=0,m=0;const b=!(!n&&!o),x="isolate"===d||void 0===d&&null!=a;y.forEach((r,d)=>{const k=pr(r,d,f,g),w=mr(r,i,a),A=a&&a.size>0&&a.has(r.label),S=26+7*r.label.length;h&&h>0&&v>0&&v+S>h&&(m++,v=0),p.push(t("g",{transform:`translate(${v},${22*m})`,onClick:n?()=>n(r):void 0,onMouseEnter:o?()=>o(r):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:b?c===l&&d===s?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?A||!1:void 0,"aria-current":b&&!x&&null!=i&&r.label===i||void 0,"aria-label":r.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(r)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const r=(d+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,r);const n=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[r];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{u(c,d),o&&o(r);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*r.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&e(vr,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label})]},"legend-item-"+d)),v+=S});let k=0,w=0;for(const e of y){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const A=m+1;return{items:p,offset:k,totalRows:A,totalHeight:22*A}})(r,i,a,l,s,c,u,n,d,h,o);y+=p.offset+5,g.push(Object.assign(Object.assign({label:r.label},p),{offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight})),f+=y+12});let y=f>o?0:Math.max(0,(o-f)/2);const p=[];return g.forEach((t,o)=>{const i=r[o];i.label&&(p.push(e("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+o)),y+=16),p.push(e("g",{className:"legend-item",transform:`translate(${y},0)`,children:t.items},"legend-group-"+o)),y+=t.offset+5,r[o+1]&&p.push(e("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(t.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),e("g",{children:p})})({legendGroups:o||[],title:u,height:h,width:d,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:l,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:c}),x=!(!i&&!a);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function wr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ar(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Sr(t){const{legend:r,totalWidth:n,totalHeight:o,margin:i,legendPosition:a="right",title:l,legendHoverBehavior:s,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!r)return null;const f="top"===a||"bottom"===a;let g,y;return"left"===a?(g=4,y=i.top):"top"===a?(g=0,y=l?32:8):"bottom"===a?(g=0,y=o-i.bottom+50):(g=n-i.right+10,y=i.top),e("g",{transform:`translate(${g}, ${y})`,children:Ar(r)?e(xr,{config:r.gradient,orientation:f?"horizontal":"vertical",width:f?n:100}):wr(r)?e(kr,{legendGroups:r.legendGroups,title:"",width:f?n:100,orientation:f?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):r})}function Lr(o){const{width:i,height:a,totalWidth:l,totalHeight:s,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p,legendPosition:v="right",foregroundGraphics:m,sceneNodes:b,annotations:x,svgAnnotationRules:k}=o;return t(r,{children:[t("svg",{role:"img",width:l,height:s,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,r)=>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-"+r)),x&&x.filter(e=>"widget"!==e.type).map((t,r)=>{if(k){const o=k(t,r,{width:i,height:a,sceneNodes:b});if(o)return e(n.Fragment,{children:o},"annotation-"+r)}return null}),m]}),d&&"string"==typeof d?e("text",{x:l/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor",children:d}):d?e("foreignObject",{x:0,y:0,width:l,height:c.top,children:d}):null,Sr({legend:h,totalWidth:l,totalHeight:s,margin:c,legendPosition:v,title:d,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p})]}),null==x?void 0:x.filter(e=>"widget"===e.type&&e.nodeId&&b).map((t,r)=>{var n,o,i,a,l,s,u,d,h;const f=b.find(e=>{var r,n,o,i,a;return e.id===t.nodeId||(null===(r=e.datum)||void 0===r?void 0:r.id)===t.nodeId||(null===(o=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===o?void 0:o.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!f)return null;const g=c.left+(null!==(n=f.cx)&&void 0!==n?n:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(o=f.x)&&void 0!==o?o:0),y=c.top+(null!==(i=f.cy)&&void 0!==i?i:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(a=f.y)&&void 0!==a?a:0),p=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(s=t.dy)&&void 0!==s?s:-16,m=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d: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:g+p-m/2,top:y+v-x/2,width:m,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5},children:k},"widget-"+r)})]})}Lr.displayName="NetworkSVGOverlay";const Dr={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function _r(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Er="undefined"==typeof window||"undefined"==typeof document,Pr="undefined"!=typeof window?h:d,Mr=()=>()=>{},Ir=()=>!1,Or=()=>!0;function Cr(e,t){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Tr(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(!Object.is(e[r],t[r]))return!1;return!0}function Nr(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 Wr=n.createContext(null),jr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Rr(e,t,r){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?r+", empty":`${r}, ${n.join(", ")}`}const $r=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Br={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},zr={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Hr={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Fr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Yr={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Xr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Gr={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function qr({nodes:r,edges:o,chartType:i,tableId:a,chartTitle:l}){var s,c,u,d,h,f,g,y,p,v,m,b,x,k;const[w,A]=n.useState(!1),S=n.useContext(Wr),L=null!==(s=null==S?void 0:S.visible)&&void 0!==s&&s,D=w||L,_=l?"Data summary for "+l:a?`Data summary for ${i} ${a}`:"Data summary for "+i,E=n.useRef(null),P=n.useCallback(()=>{w||L||A(!0)},[w,L]),M=n.useCallback(e=>{var t;L||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[L]);if(!r||0===r.length)return a?e("span",{id:a,tabIndex:-1,style:jr}):null;if(!D)return e("div",{id:a,tabIndex:-1,onFocus:P,style:jr,role:"region","aria-label":_,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",r.length," nodes, ",o.length," edges)"]})});const I=Array.isArray(r)?r:[],O=Array.isArray(o)?o:[],C=new Map,T=new Map,N=new Map,W=new Map;for(const e of O){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,r="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,n="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=r&&""!==r){const e=r+"";T.set(e,(null!==(h=T.get(e))&&void 0!==h?h:0)+1),W.set(e,(null!==(f=W.get(e))&&void 0!==f?f:0)+o)}if(null!=n&&""!==n){const e=n+"";C.set(e,(null!==(g=C.get(e))&&void 0!==g?g:0)+1),N.set(e,(null!==(y=N.get(e))&&void 0!==y?y:0)+o)}}const j=[];for(let e=0;I.length>e;e++){const t=I[e];if(!t||"object"!=typeof t)continue;const r=null!==(v=null===(p=t.datum)||void 0===p?void 0:p.id)&&void 0!==v?v:t.id,n=null!=r?r+"":"node-"+e,o=null!==(m=C.get(n))&&void 0!==m?m:0,i=null!==(b=T.get(n))&&void 0!==b?b:0,a=null!==(x=N.get(n))&&void 0!==x?x:0,l=null!==(k=W.get(n))&&void 0!==k?k:0;j.push({id:n,degree:o+i,inDeg:o,outDeg:i,wDegree:a+l,wInDeg:a,wOutDeg:l})}j.sort((e,t)=>t.degree-e.degree);let R=0,$=0;if(j.length>0){let e=0;for(const t of j)e+=t.degree,t.degree>$&&($=t.degree);R=e/j.length}const B=O.some(e=>{var t;const r=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==r?void 0:r.value)&&Number.isFinite(r.value)}),z=[`${j.length} nodes, ${O.length} edges.`];j.length>0&&z.push(`Mean degree: ${$r(R)}, max degree: ${$}.`);const H=j.slice(0,5);return t("div",{ref:E,id:a,tabIndex:-1,onBlur:M,style:Br,role:"region","aria-label":_,children:[e("button",{type:"button",onClick:()=>{L&&S&&S.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Hr,children:"×"}),e("div",{role:"note",style:zr,children:z.join(" ")}),t("table",{role:"table","aria-label":"Node degree summary for "+i,style:Fr,children:[t("caption",{style:Gr,children:["Top ",H.length," of ",j.length," nodes by degree"]}),e("thead",{children:t("tr",{children:[e("th",{style:Yr,children:"id"}),e("th",{style:Yr,children:"degree"}),e("th",{style:Yr,children:"in"}),e("th",{style:Yr,children:"out"}),B&&e("th",{style:Yr,children:"w. degree"}),B&&e("th",{style:Yr,children:"w. in"}),B&&e("th",{style:Yr,children:"w. out"})]})}),e("tbody",{children:H.map((r,n)=>t("tr",{children:[e("td",{style:Xr,children:r.id}),e("td",{style:Xr,children:r.degree}),e("td",{style:Xr,children:r.inDeg}),e("td",{style:Xr,children:r.outDeg}),B&&e("td",{style:Xr,children:$r(r.wDegree)}),B&&e("td",{style:Xr,children:$r(r.wInDeg)}),B&&e("td",{style:Xr,children:$r(r.wOutDeg)})]},n))})]})]})}function Vr({summary:t}){return t?e("div",{role:"note",style:jr,children:t}):null}function Kr({tableId:t}){return e("a",{href:"#"+t,style:jr,onClick:e=>{e.preventDefault();const r=document.getElementById(t);r&&requestAnimationFrame(()=>r.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,jr)},children:"Skip to data table"})}function Zr({hoverPoint:t}){let r="";if(t){const e=t.data||t;r="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:jr,children:r})}const Ur=Object.freeze([]);function Qr(e){if(!e)return Ur;let t=!1;for(let r=0;e.length>r;r++){const n=e[r];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const r=[];for(const t of e)null!=t&&"object"==typeof t&&r.push(t);return r}function Jr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function en(e,t,r=.3){Jr(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function tn(e,t,r=.6){var n,o,i,a,l;if(!Jr(t))return;const s=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+s*t._pulseIntensity,u=null!==(i=null!==(o=t.cx)&&void 0!==o?o:t.x)&&void 0!==i?i:0,d=null!==(l=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*r,e.stroke()}function rn(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function nn(e,t){var r,n,o,i,a,l;if(!t.pathD)return;e.save();const s=rn(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const o=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,l="string"==typeof t.style.fill?t.style.fill:"#999",s=dr(e,l)||l;o.addColorStop(0,1===a.from?s:"transparent"),o.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=i}else e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(i=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==i?i:.5;e.fill(s)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=dr(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(l=t.style.opacity)&&void 0!==l?l:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(s)),e.restore()}function on(e,t){var r,n;e.save();const o=t.style.stroke||"#999";e.strokeStyle=dr(e,o)||o,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r: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 an(e,t){var r,n,o,i;if(!t.pathD)return;e.save();const a=rn(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==n?n:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=dr(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i: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 ln(e,t){var r,n;if(!t.pathD)return;e.save();const o=rn(t),i=t.style.stroke||"#999";e.strokeStyle=dr(e,i)||i,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(o)),e.restore()}const sn={top:20,right:80,bottom:20,left:80},cn={top:40,right:40,bottom:40,left:40},un=new Set(["chord","force","circlepack","orbit"]),dn=[800,600],hn={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 fn({data:r}){var n,o,i,a,l,s;if("edge"===r.nodeOrEdge){const e=r.data;return e?t("div",{className:"semiotic-tooltip",style:hn,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=r.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const r=[];let l=u;for(;l;){const e=null!==(a=null!==(o=null===(n=l.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(i=l.data)||void 0===i?void 0:i.id)&&void 0!==a?a:c.id;null!=e&&r.unshift(e+""),l=l.parent}r.length>1&&r.shift();const s=r.length-1;return t("div",{className:"semiotic-tooltip",style:hn,children:[e("div",{children:r.map((r,n)=>t("span",{children:[n>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===s?e("strong",{children:r}):e("span",{style:{opacity:.7},children:r})]},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 d=((null===(l=c.sourceLinks)||void 0===l?void 0:l.length)||0)+((null===(s=c.targetLinks)||void 0===s?void 0:s.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:hn,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()})`]})]})}const gn=f(function(r,n){var a,c,h,f,y,p,v,m,b,x,k,w,A,S,L,D,_,E;const{chartType:P,nodes:M,edges:I,data:O,initialEdges:T,nodeIDAccessor:N="id",sourceAccessor:W="source",targetAccessor:j="target",valueAccessor:R="value",edgeIdAccessor:$,childrenAccessor:B,hierarchySum:z,orientation:X="horizontal",nodeAlign:G="justify",nodePaddingRatio:q=.05,nodeWidth:V=15,iterations:K=300,forceStrength:Z=.1,padAngle:U=.01,groupWidth:Q=20,sortGroups:J,edgeSort:ee,treeOrientation:te="vertical",edgeType:re="curve",padding:ne,paddingTop:oe,tensionConfig:ie,showParticles:ae=!1,particleStyle:le,nodeStyle:se,edgeStyle:ce,colorBy:ue,colorScheme:de="category10",edgeColorBy:he="source",edgeOpacity:fe=.5,colorByDepth:ge=!1,nodeSize:ye=8,nodeSizeRange:pe=[5,20],nodeLabel:ve,showLabels:me=!0,labelMode:be,size:xe=dn,responsiveWidth:ke,responsiveHeight:we,margin:Ae,className:Se,background:Le,enableHover:De=!0,tooltipContent:_e,customHoverBehavior:Ee,customClickBehavior:Pe,onObservation:Me,chartId:Ie,onTopologyChange:Oe,annotations:Ce,svgAnnotationRules:Te,legend:Ne,legendPosition:We,legendHoverBehavior:je,legendClickBehavior:Re,legendHighlightedCategory:$e,legendIsolatedCategories:Be,title:ze,foregroundGraphics:He,backgroundGraphics:Fe,decay:Ye,pulse:Xe,transition:Ge,animate:qe,staleness:Ve,thresholds:Ke,accessibleTable:Ze=!0,description:Ue,summary:Qe,orbitMode:Je,orbitSize:et,orbitSpeed:tt,orbitRevolution:rt,orbitRevolutionStyle:nt,orbitEccentricity:ot,orbitShowRings:it,orbitAnimated:at,customNetworkLayout:lt,layoutConfig:st}=r,ct=un.has(P)?cn:sn,ut=o(!0),dt=gr({sizeProp:xe,responsiveWidth:ke,responsiveHeight:we,userMargin:Ae,marginDefault:ct,foregroundGraphics:He,backgroundGraphics:Fe,animate:qe,transitionProp:Ge,themeDirtyRef:ut}),{reducedMotionRef:ht,responsiveRef:ft,size:gt,margin:yt,adjustedWidth:pt,adjustedHeight:vt,resolvedForeground:mt,resolvedBackground:bt,transition:xt,introEnabled:wt,tableId:At,rafRef:St,renderFnRef:Lt,scheduleRender:Dt,currentTheme:_t}=dt,Et=function(){const[e,t]=u(!1);return Pr(()=>{t(!0)},[]),e}(),Pt=function(){const e=s(Mr,Ir,Or);return o(e).current}(),It=i(()=>Qr(M),[M]),Ct=i(()=>Array.isArray(I)?Qr(I):I,[I]),Nt=i(()=>Object.assign(Object.assign({},F),ie),[ie]),Wt=i(()=>Object.assign(Object.assign({},Y),le),[le]),jt=i(()=>{var e;return{chartType:P,nodeIDAccessor:N,sourceAccessor:W,targetAccessor:j,valueAccessor:R,edgeIdAccessor:$,childrenAccessor:B,hierarchySum:z,orientation:X,nodeAlign:G,nodePaddingRatio:q,nodeWidth:V,iterations:K,forceStrength:Z,padAngle:U,groupWidth:Q,sortGroups:J,edgeSort:ee,treeOrientation:te,edgeType:re,padding:ne,paddingTop:oe,tensionConfig:Nt,showParticles:ae,particleStyle:Wt,nodeStyle:se,edgeStyle:ce,nodeLabel:ve,showLabels:me,labelMode:be,colorBy:ue,colorScheme:de,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:Kt(_t),edgeColorBy:he,edgeOpacity:fe,colorByDepth:ge,nodeSize:ye,nodeSizeRange:pe,decay:Ye,pulse:Xe,transition:xt,introAnimation:wt,staleness:Ve,thresholds:Ke,orbitMode:Je,orbitSize:et,orbitSpeed:tt,orbitRevolution:rt,orbitRevolutionStyle:nt,orbitEccentricity:ot,orbitShowRings:it,orbitAnimated:at,customNetworkLayout:lt,layoutConfig:st}},[P,N,W,j,R,B,z,X,G,q,V,K,Z,U,Q,J,ee,te,re,ne,oe,Nt,ae,Wt,se,ce,ve,me,be,ue,de,he,fe,ge,ye,pe,Ye,Xe,null==xt?void 0:xt.duration,null==xt?void 0:xt.easing,wt,Ve,Ke,Je,et,tt,rt,nt,ot,it,at,_t,lt,st]),Rt=function(e){const t=o(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Tr(e,t);if(!Nr(e)||!Nr(t))return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const r=e[n],o=t[n];if(!Object.is(r,o))if(Array.isArray(r)&&Array.isArray(o)){if(!Tr(r,o))return!1}else{if(!Nr(r)||!Nr(o))return!1;if(!Cr(r,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(jt),$t=o(null),Bt=o(0),Ht=o(0),Yt=o(!1),qt=o(null);qt.current||(qt.current=new Mt(Rt));const[Vt,Zt]=u(null),[Ut,Qt]=u(0),[Jt,er]=u(0),[tr,rr]=u(!1),[nr,or]=u(null),ir=o(null),ar=o(new Map),lr=o(0),sr=l(e=>{if("function"==typeof ue)return ue(e)+"";if("string"==typeof ue&&e.data){const t=e.data[ue];if(void 0!==t){if(!ar.current.has(t+"")){const e=Array.isArray(de)?de:kt;ar.current.set(t+"",e[lr.current++%e.length])}return ar.current.get(t+"")}}if(ar.current.has(e.id))return ar.current.get(e.id);const t=Array.isArray(de)?de:kt,r=ue?t[lr.current++%t.length]:t[0];return ar.current.set(e.id,r),r},[ue,de]),cr=(null===(a=null==_t?void 0:_t.colors)||void 0===a?void 0:a.border)||(null===(c=null==_t?void 0:_t.colors)||void 0===c?void 0:c.secondary)||(null===(h=null==_t?void 0:_t.colors)||void 0===h?void 0:h.primary)||"#999",ur=l(e=>{if("function"==typeof he)return he(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===he&&r?sr(r):t?sr(t):cr},[he,sr,cr]),hr=l(e=>{if(!(null==le?void 0:le.colorBy))return ur(e);const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;return"target"===Wt.colorBy&&r?sr(r):t?sr(t):cr},[null==le?void 0:le.colorBy,Wt.colorBy,sr,ur,cr]),fr="sankey"===P&&ae||!!Xe||null!==(y=null===(f=qt.current)||void 0===f?void 0:f.isAnimating)&&void 0!==y&&y;d(()=>{var e;null===(e=qt.current)||void 0===e||e.updateConfig(Rt),ut.current=!0,Dt()},[Rt,Dt]);const yr=l(()=>{var e,t;or(null!==(t=null===(e=qt.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]);d(()=>{var e;const t=qt.current;if(t){t.buildScene([pt,vt]),yr();for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&ar.current.set(r.id,r.style.fill);ut.current=!0,Dt()}},[_t,pt,vt,Dt,yr]);const pr=l(()=>{var e;const t=qt.current;if(!t)return;t.runLayout([pt,vt]),t.buildScene([pt,vt]),yr(),ut.current=!0;for(const r of t.sceneNodes)r.id&&"string"==typeof(null===(e=r.style)||void 0===e?void 0:e.fill)&&ar.current.set(r.id,r.style.fill);const r=Array.isArray(de)?de:kt,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];ar.current.has(t.id)||ar.current.set(t.id,r[e%r.length])}if(lr.current=n.length,Qt(t.layoutVersion),Oe){const{nodes:e,edges:r}=t.getLayoutData();Oe(e,r)}},[pt,vt,Oe,de,yr]),vr=l(e=>{if(null==e||"object"!=typeof e)return;const t=qt.current;t&&(t.ingestEdge(e)&&pr(),Dt())},[pr,Dt]),mr=l(e=>{const t=qt.current;if(!t)return;let r=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(r=!0);r&&pr(),Dt()},[pr,Dt]),br=l(()=>{var e;null===(e=qt.current)||void 0===e||e.clear(),ar.current.clear(),lr.current=0,Qt(0),Zt(null),ir.current=null,ut.current=!0,Dt()},[Dt]),xr=l(()=>{const e=qt.current;e&&(e.tension+=999,pr(),Dt())},[pr,Dt]);g(n,()=>({push:vr,pushMany:mr,removeNode:e=>{var t,r,n;const o=null!==(r=null===(t=qt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==r&&r;if(o){const t=(null===(n=ir.current)||void 0===n?void 0:n.data)?"function"==typeof N?N(ir.current.data):ir.current.data[N]:void 0;ir.current&&"node"===ir.current.nodeOrEdge&&t===e&&(ir.current=null,Zt(null)),ar.current.delete(e),pr(),ut.current=!0,Dt()}return o},removeEdge:(e,t)=>{var r,n;const o=null!==(n=null===(r=qt.current)||void 0===r?void 0:r.removeEdge(e,t))&&void 0!==n&&n;if(o){if(ir.current&&"edge"===ir.current.nodeOrEdge){const r=ir.current.data;let n;n=void 0!==t?("object"==typeof(null==r?void 0:r.source)?r.source.id:null==r?void 0:r.source)===e&&("object"==typeof(null==r?void 0:r.target)?r.target.id:null==r?void 0:r.target)===t:!$||!r||("function"==typeof $?$:e=>null==e?void 0:e[$])(r)===e,n&&(ir.current=null,Zt(null))}pr(),ut.current=!0,Dt()}return o},updateNode:(e,t)=>{var r,n;const o=null!==(n=null===(r=qt.current)||void 0===r?void 0:r.updateNode(e,t))&&void 0!==n?n:null;return o&&(ut.current=!0,Dt()),o},updateEdge:(e,t,r)=>{var n,o;const i=null!==(o=null===(n=qt.current)||void 0===n?void 0:n.updateEdge(e,t,r))&&void 0!==o?o:[];return i.length>0&&(pr(),ut.current=!0,Dt()),i},clear:br,getTopology:()=>{var e,t;return null!==(t=null===(e=qt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=qt.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:xr,getTension:()=>{var e,t;return null!==(t=null===(e=qt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[vr,mr,br,xr,pr,Dt]);const kr=["tree","cluster","treemap","circlepack","partition","orbit"].includes(P),wr=kr?O||(Array.isArray(I)?void 0:I):void 0;d(()=>{var e;const t=qt.current;if(t)if(kr&&wr)t.ingestHierarchy(wr,[pt,vt]),t.buildScene([pt,vt]),yr(),ut.current=!0,Dt();else{const r=It,n=Array.isArray(Ct)?Ct:[];if(0===r.length&&0===n.length)return;t.ingestBounded(r,n,[pt,vt]),t.buildScene([pt,vt]),yr();for(const r of t.sceneNodes)r.id&&(null===(e=r.style)||void 0===e?void 0:e.fill)&&ar.current.set(r.id,r.style.fill+"");const o=Array.isArray(de)?de:kt,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];ar.current.has(t.id)||ar.current.set(t.id,o[e%o.length])}lr.current=i.length,ut.current=!0,Dt()}},[It,Ct,O,wr,kr,pt,vt,Rt,Dt,de,yr]),d(()=>{T&&T.length>0&&mr(T)},[]);const Ar=l(e=>{if(Ee&&Ee(e),Me){const t=Date.now();Me(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ie}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ie})}},[Ee,Me,Ie]),Sr=l(e=>{if(Pe&&Pe(e),Me){const t=Date.now();Me(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Ie}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Ie})}},[Pe,Me,Ie]),{hoverHandlerRef:Wr,hoverLeaveRef:jr,onPointerMove:$r,onPointerLeave:Br}=dt;Wr.current=e=>{if(!De)return;const t=$t.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-yt.left,o=e.clientY-r.top-yt.top;if(0>n||n>pt||0>o||o>vt)return void(ir.current&&(ir.current=null,Zt(null),Ar&&(Ar(null),ut.current=!0),Dt()));const i=qt.current;if(!i)return;const a=Tt(i.sceneNodes,i.sceneEdges,n,o);if(!a)return void(ir.current&&(ir.current=null,Zt(null),Ar&&(Ar(null),ut.current=!0),Dt()));const l=H(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});ir.current=l,Zt(l),Ar&&(Ar(l),ut.current=!0),Dt()},jr.current=()=>{ir.current&&(ir.current=null,Zt(null),Ar&&(Ar(null),ut.current=!0),Dt())};const zr=o(()=>{});zr.current=e=>{if(!Pe&&!Me)return;const t=$t.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-yt.left,o=e.clientY-r.top-yt.top;if(0>n||n>pt||0>o||o>vt)return;const i=qt.current;if(!i)return;const a=Tt(i.sceneNodes,i.sceneEdges,n,o);Sr(a?H(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const Hr=l(e=>zr.current(e),[]),Fr=o(-1),Yr=o(null),Xr=o(-1),Gr=l(e=>{var t;const r=qt.current;if(!r)return;const n=function(e){var t,r,n,o,i,a;const l=[];for(const s of e)"circle"===s.type&&null!=s.cx?l.push({x:s.cx,y:s.cy,datum:s.datum,shape:"circle",group:null!==(r=null===(t=s.datum)||void 0===t?void 0:t.id)&&void 0!==r?r:"_default"}):"rect"===s.type&&null!=s.x?l.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=null===(n=s.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:"_default"}):"arc"===s.type&&null!=s.cx&&l.push({x:s.cx,y:s.cy,datum:s.datum,shape:"circle",group:null!==(a=null===(i=s.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return l.sort((e,t)=>e.x-t.x||e.y-t.y),l}(r.sceneNodes);if(0===n.length)return;const o=function(e){var t,r;const n=new Map;for(const r of e){const e=null!==(t=r.group)&&void 0!==t?t:"_default";let o=n.get(e);o||(o=[],n.set(e,o)),o.push(r)}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 o=Array.from(n.keys()).sort((e,t)=>{const r=n.get(e),o=n.get(t);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),i=Array.from(n.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(r=i[e].datum)||void 0===r?void 0:r.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:o,byGroup:n,idToIdx:a}}(n),i=Fr.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Fr.current=0,Xr.current=-1;const t=o.flat[0];Yr.current={shape:t.shape,w:t.w,h:t.h};const r=H(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return ir.current=r,Zt(r),Ar&&(Ar(r),ut.current=!0),void Dt()}const a=function(e,t){var r,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[o];return{flatIndex:o,group:null!==(r=i.group)&&void 0!==r?r:"_default",indexInGroup:null!==(n=i._groupIndex)&&void 0!==n?n:0}}(o,i),l=function(e,t,r,n,o){var i,a,l;const s=r.flat[t.flatIndex];if(!s)return zt(e,t,r);const c=null===(i=s.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(a=function(e,t,r){let n=null,o=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const l=a.x-t.x,s=a.y-t.y;let c=!1;switch(r){case"right":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"left":c=0>l&&Math.abs(l)>=Math.abs(s);break;case"down":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"up":c=0>s&&Math.abs(s)>=Math.abs(l)}if(!c)continue;const u=l*l+s*s;o>u&&(o=u,n=i)}return n}(r,s,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return n!==t.flatIndex&&(o.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var r;const n=e+"",o=[];for(const e of t){const t=null!==(r=e.datum)&&void 0!==r?r:e,i=Ft(t.source),a=Ft(t.target),l=null!=i,s=null!=a;l&&i+""===n&&s?o.push(a+""):s&&a+""===n&&l&&o.push(i+"")}return o}(c,n);if(0===e.length)return t.flatIndex;const i=null!==(l=r.idToIdx.get(e[(o.current+1)%e.length]))&&void 0!==l?l:-1;return 0>i?t.flatIndex:(o.current=-1,i)}default:{const n=zt(e,t,r);return null!==n&&n!==t.flatIndex&&(o.current=-1),n}}}(e.key,a,o,null!==(t=r.sceneEdges)&&void 0!==t?t:[],Xr);if(null===l)return;if(e.preventDefault(),0>l)return Fr.current=-1,Yr.current=null,Xr.current=-1,ir.current=null,Zt(null),Ar&&(Ar(null),ut.current=!0),void Dt();Fr.current=l;const s=o.flat[l];Yr.current={shape:s.shape,w:s.w,h:s.h};const c={data:s.datum||{},x:s.x,y:s.y,__semioticHoverData:!0,nodeOrEdge:"node"};ir.current=c,Zt(c),Ar&&(Ar(c),ut.current=!0),Dt()},[Ar,Dt]),Ur=l(e=>{Fr.current=-1,Yr.current=null,$r(e)},[$r]);Lt.current=()=>{var e,t,r,n,o,i,a;St.current=0;const l=$t.current;if(!l)return;const s=l.getContext("2d");if(!s)return;const c=qt.current;if(!c)return;const u=performance.now(),d=Bt.current?Math.min((u-Bt.current)/1e3,.1):.016;Bt.current=u;const h=c.advanceTransition(ht.current?u+1e6:u),f=!ht.current&&h,g=!ht.current&&c.tickAnimation([pt,vt],d);(h||ut.current||g)&&c.buildScene([pt,vt]);const y="undefined"!=typeof window&&window.devicePixelRatio||1;if(!function(e,t,r,n){const o=e.getContext("2d");if(!o)return null;const i=t[0]*n,a=t[1]*n,l=t[0]+"px",s=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==s&&(e.style.height=s),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(n,0,0,n,0,0),o.translate(r.left,r.top),o}(l,gt,yt,y))return;if(s.clearRect(-yt.left,-yt.top,gt[0],gt[1]),Le){const e=dr(s,Le);e&&(s.fillStyle=e,s.fillRect(0,0,pt,vt))}Ye&&c.applyDecay(),Xe&&c.applyPulse(u),Ke&&c.applyThresholds(u),c.applyTopologyDiff(u);const p=null!==(e=null==Ve?void 0:Ve.threshold)&&void 0!==e?e:5e3,v=Ve&&c.lastIngestTime>0&&u-c.lastIngestTime>p;if(v&&(s.globalAlpha=null!==(t=null==Ve?void 0:Ve.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const r of t)switch(r.type){case"bezier":nn(e,r);break;case"line":on(e,r);break;case"ribbon":an(e,r);break;case"curved":ln(e,r)}}(s,c.sceneEdges),function(e,t){var r,n,o;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=dr(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.strokeRect(t.x,t.y,t.w,t.h)),en(e,t),e.restore())}}(s,c.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=dr(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),tn(e,t),e.restore())}}(s,c.sceneNodes),function(e,t){var r,n,o;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&dr(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(r=t.style.opacity)&&void 0!==r?r:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=dr(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(o=t.style.opacity)&&void 0!==o?o:1,e.stroke()),e.restore()}}(s,c.sceneNodes),ae&&c.particlePool&&!v){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,r,n){var o,i;const a=null!==(o=n.spawnRate)&&void 0!==o?o:Y.spawnRate,l=null!==(i=n.maxPerEdge)&&void 0!==i?i:Y.maxPerEdge;for(let n=0;t.length>n;n++){const o=t[n];if(!o.bezier)continue;if(e.countForEdge(n)>=l)continue;const i=o.value*a*r*(o.bezier.circular?.3:1),s=Math.floor(i),c=i-s;let u=s;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<l;t++)e.spawn(n)}}(c.particlePool,e,d,Wt);const t=.5*(null!==(r=Wt.speedMultiplier)&&void 0!==r?r:1);let n;if(Wt.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(d,t,e,n),function(e,t,r,n,o){var i,a;const l=null!==(i=n.radius)&&void 0!==i?i:Y.radius,s=null!==(a=n.opacity)&&void 0!==a?a:Y.opacity;e.globalAlpha=s;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const s=r[a.edgeIndex];if(s){if("function"==typeof n.color){const t="object"==typeof s.source?s.source:null;e.fillStyle=t?n.color(s,t):dr(e,"var(--semiotic-secondary, #666)")}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:o(s);e.beginPath(),e.arc(a.x,a.y,l,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(s,c.particlePool,e,Wt,hr)}}v&&(s.globalAlpha=1);const m=ut.current;if(ut.current=!1,m||f||g){const e=$t.current;e&&e.setAttribute("aria-label",Rr(null!==(o=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==o?o:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}const b=m||f||g||Yt.current;b&&u-Ht.current>=33?(er(e=>e+1),Ht.current=u,Yt.current=!1):Yt.current=!!b,(fr||f||null!=c.transition||g||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Yt.current)&&(St.current=requestAnimationFrame(()=>Lt.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:r,storeRef:n,dirtyRef:i,renderFnRef:a,cleanup:l}=e;Pr(()=>{var e,o;t&&r&&(null===(o=null===(e=n.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===o||o.call(e)),i.current=!0,a.current()},[t,r]);const s=o(l);s.current=l,d(()=>()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.call(s)},[])}({hydrated:Et,wasHydratingFromSSR:Pt,storeRef:qt,dirtyRef:ut,renderFnRef:Lt}),d(()=>{ut.current=!0,Dt()},[P,pt,vt,Le,Dt]),function(e,t,r,n,o,i){d(()=>{if(!e)return;const a=setInterval(()=>{var a;const l=t.current;if(!l||0===l.lastIngestTime)return;const s="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(a=e.threshold)&&void 0!==a?a:5e3,u=s-l.lastIngestTime>c;u!==o&&(i(u),r.current=!0,n())},1e3);return()=>clearInterval(a)},[e,o,n])}(Ve,qt,ut,Dt,tr,rr);const Jr=De&&Vt?e(Gt,{x:Vt.x,y:Vt.y,containerWidth:pt,containerHeight:vt,margin:yt,className:"stream-network-tooltip",zIndex:2,children:_e?_e(Vt):e(fn,{data:Vt})}):null;if(Er||!Et&&Pt){const r=qt.current;if(r){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(P),t=e?O||(Array.isArray(I)?void 0:I):void 0;if(e&&t)r.ingestHierarchy(t,[pt,vt]),r.buildScene([pt,vt]);else{const e=It,t=Array.isArray(Ct)?Ct:[];(e.length>0||t.length>0)&&(r.ingestBounded(e,t,[pt,vt]),r.buildScene([pt,vt]))}}const n=null!==(p=null==r?void 0:r.sceneNodes)&&void 0!==p?p:[],o=null!==(v=null==r?void 0:r.sceneEdges)&&void 0!==v?v:[],i=null!==(m=null==r?void 0:r.labels)&&void 0!==m?m:[];return t("div",{ref:ft,className:"stream-network-frame"+(Se?" "+Se:""),role:"img","aria-label":Ue||("string"==typeof ze?ze:"Network chart"),style:{position:"relative",width:ke?"100%":gt[0],height:we?"100%":gt[1]},children:[e(Vr,{summary:Qe}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:gt[0],height:gt[1],style:{position:"absolute",left:0,top:0},children:[bt&&e("g",{transform:`translate(${yt.left},${yt.top})`,children:bt}),t("g",{transform:`translate(${yt.left},${yt.top})`,children:[Le&&e("rect",{x:0,y:0,width:pt,height:vt,fill:Le}),o.map((t,r)=>function(t,r){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-"+r);case"bezier":{const n=t;return e("path",{d:n.pathD,fill:_r(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+r)}case"ribbon":{const n=t;return e("path",{d:n.pathD,fill:_r(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+r)}case"curved":{const n=t;return e("path",{d:n.pathD,fill:_r(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+r)}default:return null}}(t,r)).filter(Boolean),n.map((t,r)=>function(t,r){switch(t.type){case"circle":{const n=t;return e("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:_r(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+r)}case"rect":{const n=t;return e("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:_r(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+r)}case"arc":{const n=t,o=C().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Dr)||"";return e("path",{d:o,transform:`translate(${n.cx},${n.cy})`,fill:_r(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+r)}default:return null}}(t,r)).filter(Boolean),i.map((t,r)=>function(t,r){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-"+r)}(t,r)).filter(Boolean)]})]}),e(Lr,{width:pt,height:vt,totalWidth:gt[0],totalHeight:gt[1],margin:yt,labels:i,sceneNodes:n,title:ze,legend:Ne,legendPosition:We,legendHoverBehavior:je,legendClickBehavior:Re,legendHighlightedCategory:$e,legendIsolatedCategories:Be,foregroundGraphics:Ot(mt,null===(b=qt.current)||void 0===b?void 0:b.customLayoutOverlays),annotations:Ce,svgAnnotationRules:Te,annotationFrame:0})]})}const rn=qt.current;return t("div",{ref:ft,className:"stream-network-frame"+(Se?" "+Se:""),role:"group","aria-label":Ue||("string"==typeof ze?ze:"Network chart"),tabIndex:0,style:{position:"relative",width:ke?"100%":gt[0],height:we?"100%":gt[1],overflow:"visible"},onKeyDown:Gr,children:[Ze&&e(Kr,{tableId:At}),Ze&&e(qr,{nodes:null!==(x=null==rn?void 0:rn.sceneNodes)&&void 0!==x?x:[],edges:null!==(k=null==rn?void 0:rn.sceneEdges)&&void 0!==k?k:[],chartType:"Network chart",tableId:At,chartTitle:"string"==typeof ze?ze:void 0}),e(Vr,{summary:Qe}),t("div",{role:"img","aria-label":Ue||("string"==typeof ze?ze:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:De?Ur:void 0,onMouseLeave:De?Br:void 0,onClick:Pe||Me?Hr:void 0,children:[bt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${yt.left},${yt.top})`,children:bt})}),e("canvas",{ref:$t,"aria-label":Rr(null!==(A=null===(w=null==rn?void 0:rn.sceneNodes)||void 0===w?void 0:w.length)&&void 0!==A?A:0,null!==(L=null===(S=null==rn?void 0:rn.sceneEdges)||void 0===S?void 0:S.length)&&void 0!==L?L:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Zr,{hoverPoint:Vt}),e(Lr,{width:pt,height:vt,totalWidth:gt[0],totalHeight:gt[1],margin:yt,labels:(null==rn?void 0:rn.labels)||[],sceneNodes:null==rn?void 0:rn.sceneNodes,title:ze,legend:Ne,legendPosition:We,legendHoverBehavior:je,legendClickBehavior:Re,legendHighlightedCategory:$e,legendIsolatedCategories:Be,foregroundGraphics:Ot(mt,nr),annotations:Ce,svgAnnotationRules:Te,annotationFrame:Jt}),e(Xt,{active:Fr.current>=0,hoverPoint:Vt,margin:yt,size:gt,shape:null===(D=Yr.current)||void 0===D?void 0:D.shape,width:null===(_=Yr.current)||void 0===_?void 0:_.w,height:null===(E=Yr.current)||void 0===E?void 0:E.h}),Jr,(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:tr?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"}),children:tr?"STALE":"LIVE"})]})]})});function yn(e,t){const{variant:r,frameRef:n,overrides:o,deps:i}=t;g(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var r;return null===(r=e.current)||void 0===r?void 0:r.push(t)},pushMany:t=>{var r;return null===(r=e.current)||void 0===r?void 0:r.pushMany(t)},remove:t=>{var r,n;return null!==(n=null===(r=e.current)||void 0===r?void 0:r.remove(t))&&void 0!==n?n:[]},update:(t,r)=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.update(t,r))&&void 0!==o?o:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,r;return null!==(r=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==r?r:[]},getScales:()=>{var t,r;return null!==(r=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==r?r:null}}}if("network"===e){const e=t;return{push:t=>{var r;return null===(r=e.current)||void 0===r?void 0:r.push(t)},pushMany:t=>{var r;return null===(r=e.current)||void 0===r?void 0:r.pushMany(t)},remove:t=>{var r,n,o,i,a;const l=Array.isArray(t)?t:[t],s=null!==(o=null===(n=null===(r=e.current)||void 0===r?void 0:r.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const t of l){const r=s.find(e=>e.id===t);r&&c.push(Object.assign(Object.assign({},null!==(i=r.data)&&void 0!==i?i:{}),{id:t})),null===(a=e.current)||void 0===a||a.removeNode(t)}return c},update:(t,r)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const o=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,r);return o?[Object.assign(Object.assign({},o),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,r,n,o;return null!==(o=null===(n=null===(r=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===r?void 0:r.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}}const r=t;return{push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,i;const a=null!==(o=null===(n=r.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of a)null===(i=r.current)||void 0===i||i.push(t(e));return a},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(r,n);return Object.assign(Object.assign({},e),o)},null!=i?i:[])}gn.displayName="StreamNetworkFrame";const pn={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 vn(e,t){return"function"==typeof t?t(e):e[t]}function mn(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 bn(r={}){const{fields:n,title:o,format:i,style:a={},className:l=""}=r;return r=>{if(!r||"object"!=typeof r)return null;let s;const c=[];if(o){const e=vn(r,o);s=mn(e,i)}if(n&&n.length>0)n.forEach(e=>{let t,n,o;"string"==typeof e?(t=e,n=e,o=i):(t=e.label,n=e.accessor||e.key||"",o=e.format||i);const a=vn(r,n);c.push({label:t,value:mn(a,o)})});else if(!o){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==r[t]){s=mn(r[t],i);break}if(!s){const e=Object.keys(r).filter(e=>!e.startsWith("_"));e.length>0&&(s=mn(r[e[0]],i))}}const u=Object.assign(Object.assign({},pn),a);return t("div",{className:("semiotic-tooltip "+l).trim(),style:u,children:[s&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:s}),c.map((e,r)=>t("div",{style:{marginTop:0===r&&s?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},r))]})}}function xn(t){if(!0!==t){if("function"==typeof t){const r=t;return t=>{var n;const o=!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,i=r(o);return null==i?null:e("div",{className:"semiotic-tooltip",style:pn,children:i})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?bn(t):bn())}}const kn=c(null);function wn(e){const t=[];for(const[r,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[r]));else{const[e,o]=n.range;t.push(t=>{const n=t[r];return n>=e&&o>=n})}return e=>t.every(t=>t(e))}function An(e,t){let r=e.get(t);return r||(r={name:t,resolution:"union",clauses:new Map},e.set(t,r)),r}const[Sn,Ln]=qt(e=>({selections:new Map,setClause(t,r){e(e=>{const n=new Map(e.selections),o=An(n,t),i=new Map(o.clauses);return i.set(r.clientId,r),n.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:n}})},clearClause(t,r){e(e=>{const n=e.selections.get(t);if(!n)return{};const o=new Map(e.selections),i=new Map(n.clauses);return i.delete(r),o.set(t,Object.assign(Object.assign({},n),{clauses:i})),{selections:o}})},setResolution(t,r){e(e=>{const n=new Map(e.selections),o=An(n,t);return n.set(t,Object.assign(Object.assign({},o),{resolution:r})),{selections:n}})},clearSelection(t){e(e=>{const r=new Map(e.selections),n=r.get(t);return n&&r.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:r}})}})),[Dn,_n]=qt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const r=e.observations;return r.push(t),r.length>e.maxObservations&&r.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let En={positions:new Map};const Pn=new Set;function Mn(){for(const e of Pn)e()}function In(e,t){const r=En.positions.get(e);if(null==r?void 0:r.locked)return;if(!r||r.sourceId!==t)return;const n=new Map(En.positions);n.delete(e),En={positions:n},Mn()}function On(e){const t=y(),r=e.clientId||t,{name:n}=e,o=Ln(e=>e.selections.get(n)),a=Ln(e=>e.setClause),s=Ln(e=>e.clearClause),c=i(()=>!!o&&o.clauses.size>0,[o]);return{predicate:i(()=>o&&0!==o.clauses.size?function(e,t){const r=[];for(const[n,o]of e.clauses)"crossfilter"===e.resolution&&n===t||r.push(wn(o));return 0===r.length?()=>!0:"intersect"===e.resolution?e=>r.every(t=>t(e)):e=>r.some(t=>t(e))}(o,r):()=>!0,[o,r]),isActive:c,selectPoints:l(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"point",values:new Set(n)};a(n,{clientId:r,type:"point",fields:t})},[r,n,a]),selectInterval:l(e=>{const t={};for(const[r,n]of Object.entries(e))t[r]={type:"interval",range:n};a(n,{clientId:r,type:"interval",fields:t})},[r,n,a]),clear:l(()=>{s(n,r)},[s,n,r]),clientId:r}}const Cn=c(!1),Tn=c(null),Nn="undefined"==typeof window?d:h;function Wn(e,t,r){var n;const o=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[r];if(null==o)return null;const i=Number(o);return Number.isFinite(i)?i:null}function jn(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 Rn(){var e;const t=nr(e=>e.theme),r=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return r&&r.length>0?r:void 0}function $n(e,t,r,n,o){let i;if(Array.isArray(r))i=r;else if(t&&t.length>0)i=t;else if("string"==typeof r){const e=xt[r];Array.isArray(e)&&(i=e)}return i&&0!==i.length?i[0]:"#007bff"}function Bn(e,t,r){const n=a(kn),o=Rn();return i(()=>{var i;if(!t)return;const a=null!==(i=null!=r?r:o&&o.length>0?o:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));if(n&&Object.keys(n).length>0){const e=Dt(r.map(e=>({_cat:e})),"_cat",a);return t=>n[t]||e(t)}return Dt(r.map(e=>({_cat:e})),"_cat",a)}if(n&&Object.keys(n).length>0){const r=Dt(e,t,a);return e=>n[e]||r(e)}return Dt(e,t,a)}if(n&&Object.keys(n).length>0){const e=Dt([{_:"a"}],"_",a);return t=>n[t]||e(t)}},[e,t,r,n,o])}function zn({selection:e,linkedHover:t,fallbackFields:r=[],unwrapData:n=!1,onObservation:o,chartType:a,chartId:s,onClick:c,hoverHighlight:h,colorByField:f}){const g=y(),p=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,r),v=On({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const t=e.name||"hover",{fields:r}=e,{predicate:n,isActive:o,selectPoints:i,clear:a}=On({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const n of r){const r=e[n];void 0!==r&&(t[n]=[r])}Object.keys(t).length>0&&i(t)},[r,i,a,t]),predicate:n,isActive:o}}({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||r||[]}),b=_n(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=u(null),A=f||r[0],S=i(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:r=>{var n;return("string"==typeof r[t]?r[t]:(null!==(n=r[t])&&void 0!==n?n:"")+"")===e}}},[h,k,A]),L=l(e=>{var r,n;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==p?void 0:p.mode)&&p.xField){const r=Wn(e,t,p.xField);null!=r&&function(e,t,r){const n=En.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===r||(En={positions:new Map(En.positions).set(e,{xValue:t,sourceId:r})},Mn())}(p.name||"hover",r,g)}"x-position"!==(null==p?void 0:p.mode)&&m.onHover(t)}else"x-position"===(null==p?void 0:p.mode)&&In(p.name||"hover",g),"x-position"!==(null==p?void 0:p.mode)&&m.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const r=null==t?void 0:t[A];w(null!=r?r+"":null)}else w(null);if(o||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){const i=jn(e),a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(r=e.x)&&void 0!==r?r:0,y:null!==(n=e.y)&&void 0!==n?n:0});o&&o(a),b&&b(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});o&&o(e),b&&b(e)}}},[t,m,p,g,o,a,s,b,h,A]),D=l(e=>{var t,r,n,i;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const r=Wn(e,t,p.xField);null!=r&&function(e,t,r){const n=En.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(En.positions);return t.delete(e),En={positions:t},Mn(),!1}En={positions:new Map(En.positions).set(e,{xValue:t,sourceId:r,locked:!0})},Mn()}(p.name||"hover",r,g)}if(e&&c){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),c(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(r=e.y)&&void 0!==r?r:0})}if(o||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){const r=jn(e),a=Object.assign(Object.assign({},t),{type:"click",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});o&&o(a),b&&b(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});o&&o(e),b&&b(e)}}},[c,o,b,a,s,p,g]);return d(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const e=p.name||"hover";return()=>{!function(e,t){const r=En.positions.get(e);if(!(null==r?void 0:r.locked))return;if(t&&r.sourceId!==t)return;const n=new Map(En.positions);n.delete(e),En={positions:n},Mn()}(e,g),In(e,g)}},[null==p?void 0:p.mode,null==p?void 0:p.name,g]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:L,customClickBehavior:D,crosshairSourceId:g}}function Hn({data:e,colorBy:t,colorScale:r,showLegend:n,legendPosition:l="right",userMargin:s,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=a(Cn),h=null!==a(Tn),f=void 0!==n?n:!d&&!!t,g=!!t&&(f||h),p=i(()=>{if(!g)return[];if(void 0!==u)return u;const r=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&r.add(e+"")}return Array.from(r)},[u,t,e,g]);!function(e){const t=a(Tn),r=y(),n=function(e){const t=new Set,r=[];for(const n of e)t.has(n)||(t.add(n),r.push(n));return r}(e),i=o([]);(function(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(e[r]!==t[r])return!1;return!0})(i.current,n)||(i.current=n);const l=i.current;Nn(()=>{if(t)return()=>t.unregisterCategories(r)},[t,r]),Nn(()=>{t&&t.registerCategories(r,l)},[t,r,l])}(h&&t?p:[]);const v=i(()=>{if(!f||!t)return;const n=function({data:e,colorBy:t,colorScale:r,getColor:n,strokeColor:o,strokeWidth:i,categories:a}){const l=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),l=a?n(a,t,r):r?r(o):wt[i%wt.length];return{label:o+"",color:l}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",r={fill:t,stroke:t};return void 0!==o&&(r.stroke=o),void 0!==i&&(r.strokeWidth=i),r},type:"fill",items:l,label:""}]}}({data:e,colorBy:t,colorScale:r,getColor:Lt,categories:p}),o=n.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==o?n:void 0},[f,t,e,r,p]),m=i(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},c),e);return v&&("right"===l&&110>t.right?t.right=110:"left"===l&&110>t.left?t.left=110:"top"===l&&50>t.top?t.top=50:"bottom"===l&&80>t.bottom&&(t.bottom=80)),t},[c,s,v,l]);return{legend:v,margin:m,legendPosition:l}}function Fn(e,t,r){const[n,o]=u(null),[a,s]=u(new Set),c=l(t=>{"highlight"===e&&o(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===r.length?new Set:n})},[e,r.length]),h=i(()=>{if(!e||"none"===e||!t)return null;const r="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(r?e[r]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const n=r?e[r]:"function"==typeof t?t(e):null;return a.has(n)}}:null},[e,t,n,a]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}n.createContext(void 0);const Yn={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 Xn(e,t,r){var n,o,i,a,l,s,c;const u=Yn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==r?void 0:r.width)?u.width:r.width,height:null!==(o=t.height)&&void 0!==o?o:e&&"primary"!==e||!(null==r?void 0:r.height)?u.height:r.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s: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:Gn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Gn(e,t,r){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===r?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function qn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),r)}:(...e)=>Object.assign({},r)}function Vn({componentName:r,message:n,diagnosticHint:o,width:i,height:a}){return e("div",{role:"alert",style:{width:i,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:r}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&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:o})]})})}class Kn extends n.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var r,n;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,r=this.state.error;return"function"==typeof t?t(r):void 0!==t?t:e(Vn,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Zn({componentName:t,width:r,height:n,children:o}){return e(Kn,{fallback:o=>e(Vn,{componentName:t,message:o.message,width:r,height:n}),children:o})}"undefined"!=typeof process&&process;const Un={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"},Qn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Jn(t,r,n,o){return!1===o||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Un),{width:r,height:n}),children:o||"No data available"}):null}function eo(t,r,n){if(!t)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(i+a)-a))/2);return e("div",{style:{width:r,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(t,n)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Qn),{position:"absolute",top:l+n*(i+a),left:Math.floor(.1*r),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2})},n))})}function to(e,t){const r=e.length,n=t.length,o=Array(n+1);for(let e=0;n>=e;e++)o[e]=e;for(let i=1;r>=i;i++){let r=o[0];o[0]=i;for(let a=1;n>=a;a++){const n=o[a];o[a]=e[i-1]===t[a-1]?r:1+Math.min(r,o[a],o[a-1]),r=n}}return o[n]}function ro(e,t){var r;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(r=function(e,t,r=3){let n,o=r+1;for(const r of t){const t=to(e.toLowerCase(),r.toLowerCase());o>t&&(o=t,n=r)}return o>r?void 0:n}(e,t,3))&&void 0!==r?r:null)}function no({componentName:e,data:t,dataLabel:r="data"}){return null==t?`${e}: No ${r} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${r} 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 oo({componentName:e,nodes:t,edges:r,nodesRequired:n=!1,edgesRequired:o=!0,accessors:i}){if(null==t&&null==r)return null;if(o&&(!r||!Array.isArray(r)||0===r.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(i&&t&&t.length>0){const r=(a=t,a.length>3?[a[0],a[Math.floor(a.length/2)],a[a.length-1]]:a).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in r)){const r=ro(o,t),i=r?` Try ${n}="${r}".`:"";return`${e}: ${n} "${o}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}var a;return null}const io=f(function(t,r){var n;const a=o(null);yn(r,{variant:"network",frameRef:a});const l=Xn(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:s,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:f,sourceAccessor:g="source",targetAccessor:y="target",nodeLabel:p,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:L=.1,tooltip:D,frameProps:_={},onObservation:E,onClick:P,chartId:M,selection:I,linkedHover:O,loading:C,emptyContent:T,legendInteraction:N,legendPosition:W,stroke:j,strokeWidth:R,opacity:$}=t,B=null!==(n=null!=h?h:f)&&void 0!==n?n:"id",{width:z,height:H,enableHover:F,showLegend:Y,showLabels:X=!1,title:G,description:q,summary:V,accessibleTable:K}=l,Z=i(()=>Qr(s),[s]),U=i(()=>Qr(c),[c]),Q=eo(C,z,H),J=Q?null:Jn(void 0===s?void 0:Z,z,H,T),ee=Bn(Z,v,m),te=i(()=>{if(!v)return[];const e=new Set;for(const t of Z){const r="function"==typeof v?v(t):t[v];null!=r&&e.add(r+"")}return Array.from(e)},[Z,v]),re=Fn(N,v,te),ne=Rn(),oe=i(()=>new Map,[]),ie=i(()=>{if(Array.isArray(m))return m;if(ne&&ne.length>0)return ne;const e=xt[m];return Array.isArray(e)?e:kt},[m,ne]),ae=i(()=>e=>{const t={};return t.fill=v?Lt(e.data||e,v,ee):$n(0,ne,m),"number"==typeof b&&(t.r=b),t},[v,ee,b,ne,m,oe]),le=i(()=>qn(ae,{stroke:j,strokeWidth:R,opacity:$}),[ae,j,R,$]),se=i(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ce=i(()=>qn(se,{stroke:j,strokeWidth:R,opacity:$}),[se,j,R,$]),ue=i(()=>{if(X&&p)return"function"==typeof p?p:e=>{var t,r,n;return null!==(n=null!==(r=null===(t=e.data)||void 0===t?void 0:t[p])&&void 0!==r?r:e[p])&&void 0!==n?n:e.id}},[X,p]),{legend:de,margin:he,legendPosition:fe}=Hn({data:Z,colorBy:v,colorScale:ee,showLegend:Y,legendPosition:W,userMargin:u,defaults:l.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:ye}=zn({selection:I,linkedHover:O,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!0,onObservation:E,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),pe=oo({componentName:"ForceDirectedGraph",nodes:s,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:B}});return pe?e(Vn,{componentName:"ForceDirectedGraph",message:pe,width:z,height:H}):Q||J||e(Zn,{componentName:"ForceDirectedGraph",width:z,height:H,children:e(gn,Object.assign({ref:a,chartType:"force"},null!=s&&{nodes:Z},null!=c&&{edges:U},{size:[z,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:he,nodeIDAccessor:B,sourceAccessor:g,targetAccessor:y,iterations:S,forceStrength:L,nodeStyle:le,edgeStyle:ce,colorBy:v,colorScheme:ie,nodeSize:b,nodeSizeRange:x,nodeLabel:ue,showLabels:X,enableHover:F,tooltipContent:!1===D?()=>null:xn(D)||void 0,customHoverBehavior:O||E||P?ge:void 0,customClickBehavior:E||P?ye:void 0,legend:de,legendPosition:fe},N&&"none"!==N&&{legendHoverBehavior:re.onLegendHover,legendClickBehavior:re.onLegendClick,legendHighlightedCategory:re.highlightedCategory,legendIsolatedCategories:re.isolatedCategories},{className:d,title:G,description:q,summary:V,accessibleTable:K},null!=t.animate&&{animate:t.animate},_))})});function ao(e,t){if(!e)return[];const r=[],n=e=>{r.push(e);const o="function"==typeof t?t(e):e[t];o&&Array.isArray(o)&&o.forEach(n)};return n(e),r}function lo(e,t,r,n){if(e&&e.length>0)return e;const o=new Set;return t.forEach(e=>{const t="function"==typeof r?r(e):e[r],i="function"==typeof n?n(e):e[n];o.add(t),o.add(i)}),Array.from(o).map(e=>({id:e}))}function so(e){return"function"==typeof e?e:t=>t[e]||1}function co({edgeColorBy:e,colorBy:t,colorScale:r,nodeStyleFn:n,edgeOpacity:o,baseStyle:i={}}){return a=>{const l=Object.assign({fillOpacity:o},i);if("function"==typeof e)l.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?l.fill=Lt(e.data||e,t,r):e&&(l.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?l.fill=Lt(e.data||e,t,r):e&&(l.fill=n(e,e.index).fill)}else"gradient"===e&&(l.fill="#999",l.fillOpacity=.7*o);return l}}io.displayName="ForceDirectedGraph";const uo=f(function(t,r){const n=o(null);yn(r,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,r,o;return null!==(o=null===(r=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==o?o:[]}}});const a=Xn(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:l,edges:s,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:f="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p,edgeColorBy:v="source",orientation:m="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:L,frameProps:D={},onObservation:_,onClick:E,chartId:P,selection:M,linkedHover:I,loading:O,emptyContent:C,legendInteraction:T,stroke:N,strokeWidth:W,opacity:j}=t,{width:R,height:$,enableHover:B,showLabels:z=!0,title:H,description:F,summary:Y,accessibleTable:X}=a,G=i(()=>Qr(s),[s]),q=i(()=>Qr(l),[l]),V=eo(O,R,$),K=V?null:Jn(void 0===s?void 0:G,R,$,C),Z=i(()=>lo(q,G,d,h),[q,G,d,h]),U=Bn(Z,y,p),Q=i(()=>{if(!y)return[];const e=new Set;for(const t of Z){const r="function"==typeof y?y(t):t[y];null!=r&&e.add(r+"")}return Array.from(e)},[Z,y]),J=Fn(T,y,Q),ee=Rn(),te=i(()=>new Map,[]),re=i(()=>{if(Array.isArray(p))return p;if(ee&&ee.length>0)return ee;const e=xt[p];return Array.isArray(e)?e:kt},[p,ee]),ne=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=y?Lt(e.data||e,y,U):$n(0,ee,p),t},[y,U,ee,p,te]),oe=i(()=>qn(ne,{stroke:N,strokeWidth:W,opacity:j}),[ne,N,W,j]),ie=i(()=>co({edgeColorBy:v,colorBy:y,colorScale:U,nodeStyleFn:oe,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[v,y,U,oe,A]),ae=i(()=>qn(ie,{stroke:N,strokeWidth:W,opacity:j}),[ie,N,W,j]),le=i(()=>{if(!z)return;const e=w||g;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[z,w,g]),se=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:ce,customClickBehavior:ue}=zn({selection:M,linkedHover:I,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:_,onClick:E,chartType:"SankeyDiagram",chartId:P}),de=oo({componentName:"SankeyDiagram",edges:s,edgesRequired:!0});return de?e(Vn,{componentName:"SankeyDiagram",message:de,width:R,height:$}):V||K||e(Zn,{componentName:"SankeyDiagram",width:R,height:$,children:e(gn,Object.assign({ref:n,chartType:"sankey"},Z.length>0&&{nodes:Z},null!=s&&{edges:G},{size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,nodeIDAccessor:g,sourceAccessor:d,targetAccessor:h,valueAccessor:f,orientation:m,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:oe,edgeStyle:ae,colorBy:y,colorScheme:re,edgeColorBy:v,edgeOpacity:A,edgeSort:S,nodeLabel:le,showLabels:z,enableHover:B,tooltipContent:!1===L?()=>null:xn(L)||void 0,customHoverBehavior:I||_||E?ce:void 0,customClickBehavior:_||E?ue:void 0},T&&"none"!==T&&{legendHoverBehavior:J.onLegendHover,legendClickBehavior:J.onLegendClick,legendHighlightedCategory:J.highlightedCategory,legendIsolatedCategories:J.isolatedCategories},{className:u,title:H,description:F,summary:Y,accessibleTable:X},null!=t.animate&&{animate:t.animate},D))})});uo.displayName="SankeyDiagram";const ho=f(function(t,r){const n=o(null);yn(r,{variant:"network",frameRef:n,overrides:{getData:()=>{var e,t,r,o;return null!==(o=null===(r=null===(t=null===(e=n.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===r?void 0:r.map(e=>e.data))&&void 0!==o?o:[]}}});const a=Xn(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:l,edges:s,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:f="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p,edgeColorBy:v="source",padAngle:m=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:L,onClick:D,chartId:_,selection:E,linkedHover:P,loading:M,emptyContent:I,legendInteraction:O,stroke:C,strokeWidth:T,opacity:N}=t,{width:W,height:j,enableHover:R,showLabels:$=!0,title:B,description:z,summary:H,accessibleTable:F}=a,Y=i(()=>Qr(s),[s]),X=i(()=>Qr(l),[l]),G=eo(M,W,j),q=G?null:Jn(void 0===s?void 0:Y,W,j,I),V=i(()=>lo(X,Y,d,h),[X,Y,d,h]),K=Bn(V,y,p),Z=i(()=>{if(!y)return[];const e=new Set;for(const t of V){const r="function"==typeof y?y(t):t[y];null!=r&&e.add(r+"")}return Array.from(e)},[V,y]),U=Fn(O,y,Z),Q=Rn(),J=i(()=>new Map,[]),ee=i(()=>{if(Array.isArray(p))return p;if(Q&&Q.length>0)return Q;const e=xt[p];return Array.isArray(e)?e:kt},[p,Q]),te=V.length>0,re=i(()=>{if(te)return(e,t)=>{var r,n;const o={stroke:"black",strokeWidth:1};if(y)o.fill=Lt(e.data||e,y,K);else{const i=Array.isArray(p)?p:xt[p]||kt,a=Array.isArray(i)?i:kt,l=null!==(n=null!==(r=e.index)&&void 0!==r?r:t)&&void 0!==n?n:0;o.fill=a[l%a.length]}return o}},[te,y,K,p]),ne=i(()=>re?qn(re,{stroke:C,strokeWidth:T,opacity:N}):void 0,[re,C,T,N]),oe=i(()=>{if(te)return co({edgeColorBy:v,colorBy:y,colorScale:K,nodeStyleFn:ne||(e=>({fill:$n(0,Q,p)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[te,v,y,K,ne,w,Q,p,J]),ie=i(()=>oe?qn(oe,{stroke:C,strokeWidth:T,opacity:N}):void 0,[oe,C,T,N]),ae=i(()=>{if(!$)return;const e=k||g;return"function"==typeof e?e:t=>{var r,n,o;return null!==(o=null!==(n=null===(r=t.data)||void 0===r?void 0:r[e])&&void 0!==n?n:t[e])&&void 0!==o?o:t.id}},[$,k,g]),le=Object.assign(Object.assign({},a.marginDefaults),"number"==typeof c?{top:c,bottom:c,left:c,right:c}:c),{customHoverBehavior:se,customClickBehavior:ce}=zn({selection:E,linkedHover:P,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:L,onClick:D,chartType:"ChordDiagram",chartId:_}),ue=oo({componentName:"ChordDiagram",edges:s,edgesRequired:!0});return ue?e(Vn,{componentName:"ChordDiagram",message:ue,width:W,height:j}):G||q||e(Zn,{componentName:"ChordDiagram",width:W,height:j,children:e(gn,Object.assign({ref:n,chartType:"chord"},V.length>0&&{nodes:V},null!=s&&{edges:Y},{size:[W,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,nodeIDAccessor:g,sourceAccessor:d,targetAccessor:h,valueAccessor:f,padAngle:m,groupWidth:b,sortGroups:x,nodeStyle:ne,edgeStyle:ie,colorBy:y,colorScheme:ee,edgeColorBy:v,edgeOpacity:w,nodeLabel:ae,showLabels:$,enableHover:R,tooltipContent:!1===A?()=>null:xn(A)||void 0,customHoverBehavior:P||L||D?se:void 0,customClickBehavior:L||D?ce:void 0},O&&"none"!==O&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:u,title:B,description:z,summary:H,accessibleTable:F},null!=t.animate&&{animate:t.animate},S))})});function fo(t){const r=Xn(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:o,className:a,layout:l="tree",orientation:s="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:f,colorByDepth:g=!1,edgeStyle:y="curve",nodeLabel:p,nodeSize:v=5,tooltip:m,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:S,loading:L,legendInteraction:D,stroke:_,strokeWidth:E,opacity:P}=t,{width:M,height:I,enableHover:O,showLabels:C=!0,title:T,description:N,summary:W,accessibleTable:j}=r,R=eo(L,M,I),$=i(()=>ao(null!=n?n:null,c),[n,c]),B=Bn($,g?void 0:h,f),z=i(()=>{if(!h||g)return[];const e=new Set;for(const t of $){const r="function"==typeof h?h(t):t[h];null!=r&&e.add(r+"")}return Array.from(e)},[$,h,g]),H=Fn(D,g?void 0:h,z),F=Rn(),Y=i(()=>new Map,[]),X=i(()=>{if(Array.isArray(f))return f;if(F&&F.length>0)return F;const e=xt[f];return Array.isArray(e)?e:kt},[f,F]),G=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=g?At[(e.depth||0)%At.length]:h?Lt(e.data||e,h,B):$n(0,F,f),t},[h,g,B,F,f,Y]),q=i(()=>qn(G,{stroke:_,strokeWidth:E,opacity:P}),[G,_,E,P]),V=i(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),K=i(()=>qn(V,{stroke:_,strokeWidth:E,opacity:P}),[V,_,E,P]),Z=i(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return so(u)},[l,u]),U=Object.assign(Object.assign({},r.marginDefaults),"number"==typeof o?{top:o,bottom:o,left:o,right:o}:o),{customHoverBehavior:Q,customClickBehavior:J}=zn({selection:A,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w}),ee=no({componentName:"TreeDiagram",data:n});return ee?e(Vn,{componentName:"TreeDiagram",message:ee,width:M,height:I}):R||e(Zn,{componentName:"TreeDiagram",width:M,height:I,children:e(gn,Object.assign({chartType:l},null!=n&&{data:n},{size:[M,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:Z,treeOrientation:s,edgeType:y,nodeStyle:q,edgeStyle:K,colorBy:h,colorScheme:X,colorByDepth:g,nodeSize:v,nodeLabel:C?p||d:void 0,showLabels:C,enableHover:O,tooltipContent:!1===m?()=>null:xn(m)||void 0,customHoverBehavior:S||x||k?Q:void 0,customClickBehavior:x||k?J:void 0},D&&"none"!==D&&{legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:H.isolatedCategories},{className:a,title:T,description:N,summary:W,accessibleTable:j},null!=t.animate&&{animate:t.animate},b))})}function go(t){const r=Xn(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:o,className:a,childrenAccessor:s="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:f=!1,labelMode:g="leaf",nodeLabel:y,padding:p=4,paddingTop:v,tooltip:m,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:L,legendInteraction:D,stroke:_,strokeWidth:E,opacity:P}=t,{width:M,height:I,enableHover:O,showLabels:C=!0,title:T,description:N,summary:W,accessibleTable:j}=r,R=eo(L,M,I),{activeSelectionHook:$,customHoverBehavior:B,customClickBehavior:z}=zn({selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:w,onClick:A,chartType:"Treemap",chartId:S}),H=function(e){const t=nr(e=>e.theme.colors.selectionOpacity);return i(()=>{var r,n;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:t})},[e,t])}(x),F=l(e=>{if(!e)return B(null);const t=e.data||e;B({data:(null==t?void 0:t.data)||t})},[B]),Y=i(()=>ao(null!=n?n:null,s),[n,s]),X=Bn(Y,f?void 0:d,h),G=i(()=>{if(!d||f)return[];const e=new Set;for(const t of Y){const r="function"==typeof d?d(t):t[d];null!=r&&e.add(r+"")}return Array.from(e)},[Y,d,f]),q=Fn(D,f?void 0:d,G),V=Rn(),K=i(()=>new Map,[]),Z=i(()=>{if(Array.isArray(h))return h;if(V&&V.length>0)return V;const e=xt[h];return Array.isArray(e)?e:kt},[h,V]),U=i(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?At[(e.depth||0)%At.length]:d?Lt(e.data||e,d,X):$n(0,V,h),t},[d,f,X,V,h,K]),Q=i(()=>qn(U,{stroke:_,strokeWidth:E,opacity:P}),[U,_,E,P]),J=i(()=>$?e=>{var t;const r=Object.assign({},Q(e));if($.isActive)if($.predicate(e.data||e))(null==H?void 0:H.selectedStyle)&&Object.assign(r,H.selectedStyle);else{const e=null!==(t=null==H?void 0:H.unselectedOpacity)&&void 0!==t?t:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==H?void 0:H.unselectedStyle)&&Object.assign(r,H.unselectedStyle)}return r}:Q,[Q,$,H]),ee=i(()=>so(c),[c]),te=void 0!==v?v:!C||"parent"!==g&&"all"!==g?void 0:18,re=Object.assign(Object.assign({},r.marginDefaults),"number"==typeof o?{top:o,bottom:o,left:o,right:o}:o),ne=no({componentName:"Treemap",data:n});return ne?e(Vn,{componentName:"Treemap",message:ne,width:M,height:I}):R||e(Zn,{componentName:"Treemap",width:M,height:I,children:e(gn,Object.assign({chartType:"treemap"},null!=n&&{data:n},{size:[M,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re,nodeIDAccessor:u,childrenAccessor:s,hierarchySum:ee,padding:p,paddingTop:te,nodeStyle:J,colorBy:d,colorScheme:Z,colorByDepth:f,nodeLabel:C?y||u:void 0,showLabels:C,labelMode:g,enableHover:O,tooltipContent:!1===m?()=>null:xn(m)||void 0},(k||w||A)&&{customHoverBehavior:F},(w||A)&&{customClickBehavior:z},D&&"none"!==D&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories},{className:a,title:T,description:N,summary:W,accessibleTable:j},null!=t.animate&&{animate:t.animate},b))})}function yo(t){const r=Xn(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:o,className:a,childrenAccessor:l="children",valueAccessor:s="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:f,circleOpacity:g=.7,padding:y=4,tooltip:p,frameProps:v={},onObservation:m,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,legendInteraction:S,stroke:L,strokeWidth:D,opacity:_}=t,{width:E,height:P,enableHover:M,showLabels:I=!0,title:O,description:C,summary:T,accessibleTable:N}=r,W=eo(A,E,P),j=i(()=>ao(null!=n?n:null,l),[n,l]),R=Bn(j,h?void 0:u,d),$=i(()=>{if(!u||h)return[];const e=new Set;for(const t of j){const r="function"==typeof u?u(t):t[u];null!=r&&e.add(r+"")}return Array.from(e)},[j,u,h]),B=Fn(S,h?void 0:u,$),z=Rn(),H=i(()=>new Map,[]),F=i(()=>{if(Array.isArray(d))return d;if(z&&z.length>0)return z;const e=xt[d];return Array.isArray(e)?e:kt},[d,z]),Y=i(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:g};return t.fill=h?At[(e.depth||0)%At.length]:u?Lt(e.data||e,u,R):$n(0,z,d),t},[u,h,R,g,z,d,H]),X=i(()=>qn(Y,{stroke:L,strokeWidth:D,opacity:_}),[Y,L,D,_]),G=i(()=>so(s),[s]),q=Object.assign(Object.assign({},r.marginDefaults),"number"==typeof o?{top:o,bottom:o,left:o,right:o}:o),{customHoverBehavior:V,customClickBehavior:K}=zn({selection:k,linkedHover:w,fallbackFields:u?["string"==typeof u?u:""]:[],unwrapData:!0,onObservation:m,onClick:b,chartType:"CirclePack",chartId:x}),Z=no({componentName:"CirclePack",data:n});return Z?e(Vn,{componentName:"CirclePack",message:Z,width:E,height:P}):W||e(Zn,{componentName:"CirclePack",width:E,height:P,children:e(gn,Object.assign({chartType:"circlepack"},null!=n&&{data:n},{size:[E,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q,nodeIDAccessor:c,childrenAccessor:l,hierarchySum:G,padding:y,nodeStyle:X,colorBy:u,colorScheme:F,colorByDepth:h,nodeLabel:I?f||c:void 0,showLabels:I,enableHover:M,tooltipContent:!1===p?()=>null:xn(p)||void 0,customHoverBehavior:w||m||b?V:void 0,customClickBehavior:m||b?K:void 0},S&&"none"!==S&&{legendHoverBehavior:B.onLegendHover,legendClickBehavior:B.onLegendClick,legendHighlightedCategory:B.highlightedCategory,legendIsolatedCategories:B.isolatedCategories},{className:a,title:O,description:C,summary:T,accessibleTable:N},null!=t.animate&&{animate:t.animate},v))})}ho.displayName="ChordDiagram",fo.displayName="TreeDiagram",go.displayName="Treemap",yo.displayName="CirclePack";const po=At;function vo(t){const r=Xn(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:o,className:a,childrenAccessor:l="children",nodeIdAccessor:s="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:f=2.95,speed:g=.25,revolution:y,revolutionStyle:p,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:L={},onObservation:D,onClick:_,chartId:E,selection:P,linkedHover:M,loading:I,stroke:O,strokeWidth:C,opacity:T}=t,{width:N,height:W,enableHover:j,title:R,description:$,summary:B,accessibleTable:z}=r,H=eo(I,N,W),F=Bn(i(()=>ao(n,l),[n,l]),d?void 0:c,u),Y=Rn(),X=i(()=>new Map,[]),G=i(()=>{if(Array.isArray(u))return u;if(Y&&Y.length>0)return Y;const e=xt[u];return Array.isArray(e)?e:kt},[u,Y]),q=i(()=>{if(Array.isArray(u))return u;const e=xt[u];return Array.isArray(e)?e:kt},[u]),V=i(()=>e=>{var t;const r={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return r.fill=d?n?q[0]:po[(e.depth||0)%po.length]:c?Lt(e.data||e,c,F):$n(0,Y,u),r.opacity=n?1:.85,r},[c,d,F,q,Y,u,X]),K=i(()=>qn(V,{stroke:O,strokeWidth:C,opacity:T}),[V,O,C,T]),Z=i(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),U=Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof o?{top:o,bottom:o,left:o,right:o}:o),{customHoverBehavior:Q,customClickBehavior:J}=zn({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:D,onClick:_,chartType:"OrbitDiagram",chartId:E}),ee=i(()=>{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=i(()=>{if(J)return e=>{J(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[J]),re=no({componentName:"OrbitDiagram",data:n});return re?e(Vn,{componentName:"OrbitDiagram",message:re,width:N,height:W}):H||e(Zn,{componentName:"OrbitDiagram",width:N,height:W,children:e(gn,Object.assign({chartType:"orbit"},null!=n&&{data:n},{size:[N,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,nodeIDAccessor:s,childrenAccessor:l,nodeStyle:K,edgeStyle:Z,colorBy:c,colorScheme:G,colorByDepth:d,nodeSize:b,nodeLabel:x?s:void 0,showLabels:x,enableHover:!k&&j,tooltipContent:k?void 0:!1===w?()=>null:xn(w)||void 0,customHoverBehavior:M||D||_?ee:void 0,customClickBehavior:D||_?te:void 0,foregroundGraphics:A,annotations:S,className:a,title:R,description:$,summary:B,orbitMode:h,orbitSize:f,orbitSpeed:g,orbitRevolution:y,orbitRevolutionStyle:p,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:z},null!=t.animate&&{animate:t.animate},L))})}vo.displayName="OrbitDiagram";const mo=f(function(t,r){const{nodes:n,edges:a,layout:l,layoutConfig:s,nodeIDAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",margin:h,className:f,colorScheme:g,frameProps:y={}}=t,{frameRef:p,resolved:v,normalizedMargin:m}=function(e){const t=o(null);return yn(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Xn(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:i(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}({imperativeRef:r,imperativeVariant:"network",margin:h,width:t.width,height:t.height,enableHover:t.enableHover,title:t.title,mode:t.mode}),b=i(()=>Qr(null!=n?n:[]),[n]),x=i(()=>Qr(null!=a?a:[]),[a]),{width:k,height:w,enableHover:A,title:S,description:L,summary:D,accessibleTable:_}=v,E=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=n&&{nodes:b}),null!=a&&{edges:x}),{customNetworkLayout:l,layoutConfig:s,nodeIDAccessor:c,sourceAccessor:u,targetAccessor:d,colorScheme:g,size:[k,w],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:m,className:f,title:S,description:L,summary:D,accessibleTable:_,enableHover:A}),y);return e(Zn,{componentName:"NetworkCustomChart",width:k,height:w,children:e(gn,Object.assign({ref:p},E))})});mo.displayName="NetworkCustomChart";export{ho as ChordDiagram,yo as CirclePack,io as ForceDirectedGraph,mo as NetworkCustomChart,vo as OrbitDiagram,uo as SankeyDiagram,gn as StreamNetworkFrame,fo as TreeDiagram,go as Treemap};
|