semiotic 3.8.7 → 3.8.9

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.
Files changed (227) hide show
  1. package/CLAUDE.md +6 -5
  2. package/README.md +58 -48
  3. package/ai/dist/mcp-server.js +28 -2
  4. package/ai/schema.json +386 -4
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/{chunk-chartContainerDataAudit-JDSVSKGM.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
  8. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
  9. package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
  10. package/dist/chunk-chunk-2X3FJCME.module.min.js +1 -0
  11. package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-2ZHHWZQM.module.min.js} +1 -1
  12. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
  13. package/dist/chunk-chunk-5ZON5NMV.module.min.js +2 -0
  14. package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
  15. package/dist/chunk-chunk-6S3YGYW7.module.min.js +1 -0
  16. package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +2 -0
  17. package/dist/chunk-chunk-A3I4HBD5.module.min.js +1 -0
  18. package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-AFQHURLO.module.min.js} +1 -1
  19. package/dist/chunk-chunk-DDB4TLQG.module.min.js +2 -0
  20. package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-DTH3SUOU.module.min.js} +1 -1
  21. package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
  22. package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-DVCWU7MT.module.min.js} +1 -1
  23. package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
  24. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
  25. package/dist/chunk-chunk-FSIHAW6L.module.min.js +2 -0
  26. package/dist/chunk-chunk-G2RGVEYY.module.min.js +2 -0
  27. package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
  28. package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
  29. package/dist/chunk-chunk-HAJVODLO.module.min.js +2 -0
  30. package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
  31. package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-HIV7AW2V.module.min.js} +1 -1
  32. package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-JZAMMSQQ.module.min.js} +1 -1
  33. package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
  34. package/dist/chunk-chunk-MXMRXSCI.module.min.js +2 -0
  35. package/dist/chunk-chunk-MXVBXFKW.module.min.js +2 -0
  36. package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
  37. package/dist/chunk-chunk-OFAP623Y.module.min.js +2 -0
  38. package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-OHLRAEQZ.module.min.js} +1 -1
  39. package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
  40. package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
  41. package/dist/chunk-chunk-PRNXOCYZ.module.min.js +2 -0
  42. package/dist/chunk-chunk-RLKZVJMQ.module.min.js +2 -0
  43. package/dist/chunk-chunk-SK2TQMG4.module.min.js +2 -0
  44. package/dist/chunk-chunk-SKLYXNYW.module.min.js +2 -0
  45. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
  46. package/dist/chunk-chunk-U4NZCU5T.module.min.js +2 -0
  47. package/dist/chunk-chunk-VKL6DI43.module.min.js +2 -0
  48. package/dist/chunk-chunk-W62673ZE.module.min.js +1 -0
  49. package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
  50. package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-XCC25CZZ.module.min.js} +1 -1
  51. package/dist/chunk-chunk-XECNOUZY.module.min.js +2 -0
  52. package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-XYZDTYAF.module.min.js} +1 -1
  53. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
  54. package/dist/components/Tooltip/Tooltip.d.ts +54 -1
  55. package/dist/components/charts/index.d.ts +2 -2
  56. package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
  57. package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
  58. package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
  59. package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
  60. package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
  61. package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
  62. package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
  63. package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
  64. package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
  65. package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
  66. package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
  67. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
  68. package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
  69. package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
  70. package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
  71. package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
  72. package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
  73. package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
  74. package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
  75. package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
  76. package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
  77. package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
  78. package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
  79. package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
  80. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
  81. package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
  82. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
  83. package/dist/components/charts/network/processSankey/time.d.ts +11 -0
  84. package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
  85. package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
  86. package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
  87. package/dist/components/charts/physics/chainReactionTypes.d.ts +1 -0
  88. package/dist/components/charts/physics/physicsHocUtils.d.ts +1 -1
  89. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  90. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
  91. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  92. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  93. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  94. package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
  95. package/dist/components/charts/shared/formatUtils.d.ts +45 -3
  96. package/dist/components/charts/shared/hatchFill.d.ts +2 -0
  97. package/dist/components/charts/shared/hooks.d.ts +1 -1
  98. package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
  99. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -0
  100. package/dist/components/charts/shared/styleRules.d.ts +5 -1
  101. package/dist/components/charts/shared/types.d.ts +8 -1
  102. package/dist/components/charts/shared/useChartLegend.d.ts +6 -0
  103. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  104. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  105. package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
  106. package/dist/components/data/numericFieldProfiler.d.ts +2 -0
  107. package/dist/components/recipes/layout1d.d.ts +68 -0
  108. package/dist/components/semiotic-network.d.ts +2 -2
  109. package/dist/components/semiotic-recipes-core.d.ts +2 -0
  110. package/dist/components/semiotic-utils-core.d.ts +1 -0
  111. package/dist/components/semiotic.d.ts +6 -3
  112. package/dist/components/server/staticSVGChrome.d.ts +2 -1
  113. package/dist/components/store/createStore.d.ts +2 -0
  114. package/dist/components/stream/GeoTileRenderer.d.ts +1 -0
  115. package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
  116. package/dist/components/stream/PipelineStore.d.ts +5 -0
  117. package/dist/components/stream/accessorUtils.d.ts +21 -0
  118. package/dist/components/stream/canvasSetup.d.ts +15 -4
  119. package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
  120. package/dist/components/stream/geoTypes.d.ts +2 -0
  121. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
  122. package/dist/components/stream/layouts/index.d.ts +1 -1
  123. package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
  124. package/dist/components/stream/networkFramePaint.d.ts +8 -0
  125. package/dist/components/stream/networkTypes.d.ts +4 -0
  126. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
  127. package/dist/components/stream/ordinalTypes.d.ts +2 -0
  128. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  129. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -0
  130. package/dist/components/stream/pipelineConfig.d.ts +2 -0
  131. package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
  132. package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
  133. package/dist/components/stream/pipelineTransitions.d.ts +15 -1
  134. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
  135. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
  136. package/dist/components/stream/symbolPath.d.ts +8 -0
  137. package/dist/components/stream/types.d.ts +10 -1
  138. package/dist/components/stream/useCanvasFrameHost.d.ts +15 -0
  139. package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
  140. package/dist/components/stream/xyFrameAxisTypes.d.ts +9 -0
  141. package/dist/forceLayoutWorker.js +1 -1
  142. package/dist/geo.min.js +1 -1
  143. package/dist/geo.module.min.js +1 -1
  144. package/dist/network.min.js +1 -1
  145. package/dist/network.module.min.js +1 -1
  146. package/dist/ordinal.min.js +1 -1
  147. package/dist/ordinal.module.min.js +1 -1
  148. package/dist/physics.min.js +1 -1
  149. package/dist/physics.module.min.js +1 -1
  150. package/dist/physicsWorker.js +1 -1
  151. package/dist/processSankeyLayoutWorker.js +1 -0
  152. package/dist/realtime.min.js +1 -1
  153. package/dist/realtime.module.min.js +1 -1
  154. package/dist/semiotic-ai-core.min.js +1 -1
  155. package/dist/semiotic-ai-core.module.min.js +1 -1
  156. package/dist/semiotic-ai.min.js +1 -1
  157. package/dist/semiotic-ai.module.min.js +1 -1
  158. package/dist/semiotic-experimental-vacp.min.js +1 -1
  159. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  160. package/dist/semiotic-experimental.min.js +1 -1
  161. package/dist/semiotic-experimental.module.min.js +1 -1
  162. package/dist/semiotic-network.d.ts +2 -2
  163. package/dist/semiotic-realtime-core.min.js +1 -1
  164. package/dist/semiotic-realtime-core.module.min.js +1 -1
  165. package/dist/semiotic-recipes-core.d.ts +2 -0
  166. package/dist/semiotic-recipes-core.min.js +1 -1
  167. package/dist/semiotic-recipes-core.module.min.js +1 -1
  168. package/dist/semiotic-recipes.min.js +1 -1
  169. package/dist/semiotic-recipes.module.min.js +1 -1
  170. package/dist/semiotic-server-edge.min.js +1 -1
  171. package/dist/semiotic-server-edge.module.min.js +1 -1
  172. package/dist/semiotic-server-node.min.js +1 -1
  173. package/dist/semiotic-server-node.module.min.js +1 -1
  174. package/dist/semiotic-themes-core.module.min.js +1 -1
  175. package/dist/semiotic-themes-react.module.min.js +1 -1
  176. package/dist/semiotic-themes.module.min.js +1 -1
  177. package/dist/semiotic-utils-core.d.ts +1 -0
  178. package/dist/semiotic-utils-core.min.js +1 -1
  179. package/dist/semiotic-utils-core.module.min.js +1 -1
  180. package/dist/semiotic-utils-react.module.min.js +1 -1
  181. package/dist/semiotic-utils.min.js +1 -1
  182. package/dist/semiotic-utils.module.min.js +1 -1
  183. package/dist/semiotic-value.min.js +1 -1
  184. package/dist/semiotic-value.module.min.js +1 -1
  185. package/dist/semiotic.d.ts +6 -3
  186. package/dist/semiotic.min.js +1 -1
  187. package/dist/semiotic.module.min.js +1 -1
  188. package/dist/server.min.js +1 -1
  189. package/dist/server.module.min.js +1 -1
  190. package/dist/xy.min.js +1 -1
  191. package/dist/xy.module.min.js +1 -1
  192. package/package.json +4 -3
  193. package/dist/chunk-chunk-2YAZHXL4.module.min.js +0 -2
  194. package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
  195. package/dist/chunk-chunk-7TTBHSAG.module.min.js +0 -2
  196. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +0 -2
  197. package/dist/chunk-chunk-BGHPD3RA.module.min.js +0 -1
  198. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +0 -2
  199. package/dist/chunk-chunk-C7APLVQD.module.min.js +0 -2
  200. package/dist/chunk-chunk-DGWFBOGB.module.min.js +0 -1
  201. package/dist/chunk-chunk-DIVE2DRA.module.min.js +0 -2
  202. package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
  203. package/dist/chunk-chunk-FBUNUIPV.module.min.js +0 -2
  204. package/dist/chunk-chunk-G7QVPZUD.module.min.js +0 -2
  205. package/dist/chunk-chunk-GBPYV4FP.module.min.js +0 -2
  206. package/dist/chunk-chunk-KXAFCCDB.module.min.js +0 -2
  207. package/dist/chunk-chunk-LG7YKJAK.module.min.js +0 -2
  208. package/dist/chunk-chunk-LWITSR2O.module.min.js +0 -2
  209. package/dist/chunk-chunk-MX35T6RX.module.min.js +0 -2
  210. package/dist/chunk-chunk-NJETWX42.module.min.js +0 -2
  211. package/dist/chunk-chunk-NW25WGLS.module.min.js +0 -2
  212. package/dist/chunk-chunk-ONMLEXHR.module.min.js +0 -2
  213. package/dist/chunk-chunk-OY66GCE6.module.min.js +0 -1
  214. package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
  215. package/dist/chunk-chunk-PZFT457G.module.min.js +0 -1
  216. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +0 -1
  217. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +0 -1
  218. package/dist/chunk-chunk-RJRM2E6P.module.min.js +0 -1
  219. package/dist/chunk-chunk-RPL7WYXI.module.min.js +0 -1
  220. package/dist/chunk-chunk-V3OAKG32.module.min.js +0 -1
  221. package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
  222. package/dist/chunk-chunk-WLOIUMWG.module.min.js +0 -2
  223. package/dist/chunk-chunk-XEGXX4F7.module.min.js +0 -1
  224. package/dist/chunk-chunk-XFRBLXYM.module.min.js +0 -1
  225. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +0 -2
  226. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
  227. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{needsDataCanvasPaint as e,paintCanvasBackground as t}from"./chunk-chunk-DTH3SUOU.module.min.js";import{networkSymbolRenderer as r}from"./chunk-chunk-PRNXOCYZ.module.min.js";import{StalenessBadge as n,attachUpdateResultStore as o,buildNavGraph as i,composeOverlays as a,computeDecayOpacity as s,createCustomLayoutFailureDiagnostic as c,extractNetworkNavPoints as l,findHitPointInQuadtree as u,formatVal as d,getHitRadius as h,hitTestRect as f,networkGlyphRenderer as y,nextNetworkIndex as g,normalizeAngle as p,paintSceneWithBackend as m,renderCirclePulse as v,renderRectPulse as x,renderSceneWithBackend as k,resolvePosition as b,useConfigSync as _,useLayoutSelectionSync as S,useStableShallow as w,useStalenessCheck as A,warnCustomLayoutDiagnostics as L}from"./chunk-chunk-DVCWU7MT.module.min.js";import{CustomLayoutSelectionProvider as E,wrapWithCustomLayoutSelection as P}from"./chunk-chunk-5UKL5W76.module.min.js";import{resolveLabelFn as D,resolveNodeRefId as R}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as M}from"./chunk-chunk-XYZDTYAF.module.min.js";import{commonJsWorkerModuleUrl as N}from"./chunk-chunk-SV4XAZ3Q.module.min.js";import{buildResolveColor as T,resolveCustomLayoutPalette as C}from"./chunk-chunk-OHLRAEQZ.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as I,AriaLiveTooltip as W,CanvasFrameBackground as $,DEFAULT_COLORS as z,FlippingTooltip as F,FocusRing as B,NetworkAccessibleDataTable as Y,SceneRevisionDiagnosticsObserver as O,ScreenReaderSummary as X,SkipToTableLink as j,TITLE_BASELINE as H,UpdateResultTracker as q,annotationActivationProps as V,annotationLayout as G,buildHoverData as Q,computeEasing as K,computeNetworkAriaLabel as Z,computeRawProgress as U,createDefaultAnnotationRules as J,createSeededFrameRandom as ee,defaultTooltipStyle as te,emitClickObservations as re,emitHoverObservations as ne,filterSparseArray as oe,getDevicePixelRatio as ie,isAnnotationActivationTarget as ae,isInteractiveKeyboardTarget as se,isServerEnvironment as ce,lerp as le,networkLabelToSVG as ue,networkSceneEdgeToSVG as de,networkSceneNodeToSVG as he,now as fe,observationInputType as ye,paintNetworkFill as ge,paintNetworkStroke as pe,prepareCanvas as me,renderAnnotationPass as ve,renderLegendFromConfig as xe,resolveCSSColor as ke,resolveCanvasFill as be,runSceneBuild as _e,schemeCategory10 as Se,smartTooltipEntries as we,symbolRadius as Ae,useAnnotationActivationOptions as Le,useFrame as Ee,useFrameCanvasHost as Pe,useSceneRevisionDiagnostics as De}from"./chunk-chunk-SK2TQMG4.module.min.js";import{getMinMax as Re}from"./chunk-chunk-2NVFEB7P.module.min.js";import{resolveThemeSemanticColors as Me}from"./chunk-chunk-PMR47KRY.module.min.js";import{glyphHitGeometry as Ne}from"./chunk-chunk-KTWEBFMX.module.min.js";import{renderLoadingState as Te,useHydration as Ce,useWasHydratingFromSSR as Ie}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as We from"react";import{useRef as $e,useState as ze,useEffect as Fe,useMemo as Be,useCallback as Ye,useImperativeHandle as Oe,forwardRef as Xe,memo as je}from"react";var He={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},qe={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Ve=class{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,t=Math.random){const r=this._freeIndices.pop();if(void 0===r)return null;const n=this.particles[r];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,r,n){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const a=r[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?Ge(a.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(o))):(i.active=!1,this._freeIndices.push(o))}}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 Ge(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];Qe(l,u,d,h,c,o);const f=h.x-l.x,y=h.y-l.y,g=Math.sqrt(f*f+y*y);if(g>.001){const e=f/g;o.x+=-y/g*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;Qe(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 Qe(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 Ke(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function Ze(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,r){var o=[].concat(r).concat(e);t?t(o):n.push(o)}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 f(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var f=e[t=l[l.length-1]];if(f.length>i[t]){for(var y=i[t];f.length>y;++y){var g=f[y];if(0>r[g]){r[g]=n[g]=u,o[g]=!0,u+=1,c.push(g),l.push(g);break}o[g]&&(n[t]=0|Math.min(n[t],n[g])),0>a[g]||s[t].push(a[g])}i[t]=y}else{if(n[t]===r[t]){var p=[],m=[],v=0;for(y=c.length-1;y>=0;--y){var x=c[y];if(o[x]=!1,p.push(x),m.push(s[x]),v+=s[x].length,a[x]=d.length,x===t){c.length=y;break}}d.push(p);var k=Array(v);for(y=0;m.length>y;y++)for(var b=0;m[y].length>b;b++)k[--v]=m[y][b];h.push(k)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&f(c);for(c=0;h.length>c;c++){var y=h[c];if(0!==y.length){y.sort(function(e,t){return e-t}),l=[y[0]];for(var g=1;y.length>g;g++)y[g]!==y[g-1]&&l.push(y[g]);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];return!!c&&{leastVertex:i,adjList:e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})})}}r=0;for(var h=e.length;h>r;){var f=d(r);if(r=f.leastVertex,s=f.adjList){for(var y=0;s.length>y;y++)for(var g=0;s[y].length>g;g++){var p=s[y][g];i[+p]=!1,a[p]={}}l(r),r+=1}else r=h}return t?void 0:n}function Ue(e){return e.y0-e.y1>0?"up":"down"}function Je(e,t){return t(e.source)==t(e.target)}function et(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 tt(e){return e.target.x0-e.source.x1}function rt(e,t){var r=ot(e),n=tt(t)/Math.tan(r);return"up"==Ue(e)?e.y1-n:e.y1+n}function nt(e,t){var r=ot(e),n=tt(t)/Math.tan(r);return"up"==Ue(e)?e.y1+n:e.y1-n}function ot(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function it(e,t){return t(e)}function at(e){return ct(e.source)}function st(e){return ct(e.target)}function ct(e){return(e.y0+e.y1)/2}function lt(e){return e.virtual?0:e.value}function ut(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!Je(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Je(e,t)?n+1:n}),r+n}function dt(e){return e.target.depth}function ht(e,t){return e.sourceLinks.length?e.depth:t-1}function ft(e,t){return e.y0-t.y0}function yt(e,t){return t.y0-e.y0}function gt(e,t){return e.y1-t.y1}function pt(e,t){return t.y1-e.y1}function mt(e,t){return xt(e.source,t.source)||e.index-t.index}function vt(e,t){return xt(e.target,t.target)||e.index-t.index}function xt(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function kt(e,t){return bt(e)==bt(t)?"bottom"==e.circularLinkType?yt(e,t):ft(e,t):bt(t)-bt(e)}function bt(e){return e.target.column-e.source.column}function _t(e,t){return St(e)==St(t)}function St(e){return e.y0-e.y1>0?"up":"down"}import{min as wt}from"d3-array";function At(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=wt(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}),Lt(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),Lt(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,Je(e,t)&&et(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?yt:ft);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?pt:gt),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 Lt(e,t,r){e.sort(kt);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(Je(e,t)&&et(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&&Et(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 Et(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as Pt,max as Dt,sum as Rt,mean as Mt,group as Nt,groups as Tt}from"d3-array";function Ct(e){return function(){return e}}function It(e){return e.index}function Wt(e){return e.nodes}function $t(e){return e.links}function zt(e,t,r){var n=Tt(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+=ct(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=ct(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?ut(t,r)-ut(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==ut(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 Ft(e,t,r,n,o,i){var a=Tt(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&&ut(o,r)>0){var c=Mt(o.sourceLinks,st),l=Mt(o.targetLinks,at),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-ct(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=Mt(o.sourceLinks,st),f=Mt(o.targetLinks,at),y=((h&&f?(h+f)/2:h||f)-ct(o))*t;o.y0+=y,o.y1+=y}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||xt),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 Bt(e){e.nodes.forEach(function(e){e.sourceLinks.sort(vt),e.targetLinks.sort(mt)}),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 Yt(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=It,c=ht,l=void 0,u=32,d=2,h=Wt,f=$t;function y(){var y={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 Nt(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=Ke(r,n)),"object"!=typeof o&&(o=e.target=Ke(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=Ze(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){it(e,t)!=it(o.source,t)&&it(e,t)!=it(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),Je(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(Rt(e.sourceLinks,lt),Rt(e.targetLinks,lt)),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 f=i;if(null!==a){var y=Tt(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),g=Dt(y,function(e){return e.length});g>1&&(f=Math.max(1,(n-t)*a/(g-1)))}(function(e,t,r){var n=Tt(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=Pt(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/Rt(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=Dt(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),zt(h,l,s),Ft(h,l,s,f,f,u),Bt(h),At(h,s,d,10,8),zt(h,l,s),Ft(h,l,s,f,f,u),Bt(h),At(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 it(r.source,t)==it(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(!_t(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=rt(t,e);return e.y1-r}if(t.target.column>e.target.column)return rt(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 it(r.target,t)==it(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(!_t(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=nt(t,e);return e.y0-r}if(t.source.column>e.source.column)return nt(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){let n=function(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0};var i=Pt(t,function(e){return e.y0}),a=Dt(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);1>s?(t.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1)}),r.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=n(e.y0)-e.y0;e.y0=n(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),At(h,s,d,10,8)}(y),y}return y.update=function(e){return Bt(e),At(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(o=+e,y):o},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ct(e),y):h},y.links=function(e){return arguments.length?(f="function"==typeof e?e:Ct(e),y):f},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Ct(e),y):s},y.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Ct(e),y):c},y.nodeSort=function(e){return arguments.length?(l=e,y):l},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],y):[[e,t],[r,n]]},y.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],y):[r-e,n-t]},y}import{interpolateNumber as Ot}from"d3-interpolate";import{line as Xt,curveLinearClosed as jt}from"d3-shape";function Ht(e){const{sx:t,sTop:r,sBot:n,tx:o,tTop:i,tBot:a,cp1X:s,cp2X:c}=e,l=(r+n)/2,u=(i+a)/2;return{pathD:[`M${t},${r}`,`C${s},${r} ${c},${i} ${o},${i}`,`L${o},${a}`,`C${c},${a} ${s},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:l},{x:s,y:l},{x:c,y:u},{x:o,y:u}],halfWidth:(n-r)/2}}}var qt=e=>{let t,r,n,o,i,a,s,c,l;if("down"===e.direction)return 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=Ot(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`;const u=e.sankeyWidth/2,d=Ot(e.source.x1,e.target.x0),{pathD:h}=Ht({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function Vt(e){const t=e.sankeyWidth/2,r=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.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*(n.rightFullExtent-r))),c=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${r},${o-t}L${r+s},${o-t}L${r+s},${o+t}L${r},${o+t}ZM${i},${a-t}L${i-c},${a-t}L${i-c},${a+t}L${i},${a+t}Z`}const o=n.sourceX,i=n.sourceY,a=n.targetX,s=n.targetY,c=n.rightFullExtent,l=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(r,15));return`M${o},${i-d*t}L${c},${i-d*t}L${c+r},${i-d*t+d*h}L${c+r},${u+d*r-d*h}L${c+r-h},${u+d*r}L${l-r+h},${u+d*r}L${l-r},${u+d*r-d*h}L${l-r},${s-d*t+d*h}L${l-r+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${l+r},${s+d*t}L${l+r},${u-d*r}L${c-r},${u-d*r}L${c-r},${i+d*t}L${o},${i+d*t}Z`}var Gt=new Set,Qt=new WeakMap;function Kt(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let r=Qt.get(e);if(r){const e=r.get(t);if(e)return e}else r=new Map,Qt.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}`;Gt.has(e)||(Gt.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}var Zt={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(dt))-1:0},justify:ht},Ut={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const o="vertical"===r.orientation?"down":"right",i=r.nodeAlign||"justify",a=r.nodeWidth??15,s=r.nodePaddingRatio??.05,c=r.iterations??100,l=e.map(e=>({...e})),u=t.map(e=>({...e,source:R(e.source),target:R(e.target),value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===o?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const h=Yt().extent(d).links(u).nodes(l).nodeAlign(Zt[i]||ht).nodeId(e=>e.id).nodeWidth(a).iterations(c);h.nodePaddingRatio&&h.nodePaddingRatio(s),h();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of l)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 u){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(n._circularWidth??n.width??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,s=n[0],c=n[1];if(i>0&&a>0&&(0>e||0>r||t>s||o>c)){const t=Math.min(s/i,c/a),n=-e*t+(s-i*t)/2,o=-r*t+(c-a*t)/2;for(const e of l)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 u)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(e.width??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 f=new Map;for(const t of e)f.set(t.id,t);for(const e of l){const t=f.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 y=new Map;for(const e of t)if(e._edgeKey)y.set(e._edgeKey,e);else{const t=R(e.source),r=R(e.target);y.set(`${t}\0${r}`,e)}for(const e of u){const t=R(e.source),r=R(e.target),n=y.get(e._edgeKey?e._edgeKey:`${t}\0${r}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=e.width??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=o;const i=f.get(t),a=f.get(r);i&&(n.source=i),a&&(n.target=a)}}},buildScene(e,t,r,n){const o="vertical"===r.orientation?"down":"right",i=r.nodeStyle,a=r.edgeStyle,s=r.edgeOpacity??.5,c=r.edgeColorBy||"source",l=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Se,u=new Map;e.forEach((e,t)=>{u.set(e.id,l[t%l.length])});const d=[],h=[],f=[],y=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=i?i(Kt(t,"nodeStyle")):{},a={fill:n.fill||u.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};y.set(t.id,("string"==typeof a.fill?a.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===o?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:a,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:a,datum:t,id:t.id,label:t.id})}const g=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of g){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";o="function"==typeof c?c(e)||o:"target"===c?y.get(n.id)||u.get(n.id)||o:y.get(t.id)||u.get(t.id)||o;const i=a?a(Kt(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))),a=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=i.fill||o;h.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:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-a},${t.targetY-r}L${t.targetX-a},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-a,x1:t.targetX}});continue}let l;(l=e.circular&&e.circularPathData?Vt(e):qt(e),l)&&h.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:{fill:i.fill||o,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel);for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const a=t?t(r):r.id;if(!a)continue;let s,c,l;"down"===o?(s=r.y0+(r.y1-r.y0)/2,c=r.x1+14,l="start"):(n[0]/2>r.x0+e/2?(s=r.x0-6,l="end"):(s=r.x1+6,l="start"),c=r.y0+i/2),f.push({x:s,y:c,text:a+"",anchor:"down"===o?"middle":l,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}};import{forceSimulation as Jt,forceCenter as er,forceX as tr,forceY as rr,forceLink as nr,forceManyBody as or,forceCollide as ir}from"d3-force";import{scaleLinear as ar}from"d3-scale";var sr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const o=r.forceStrength??.1,i=n[0]/2,a=n[1]/2,s=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),c=Math.min(.5,.06+1.8*(1-s)),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=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=cr(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=lr(e.id),i=o%360*(Math.PI/180),a=(10+o%20)*s;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=lr(e.id),r=t%360*(Math.PI/180),n=(15+t%30)*s;e.x=i+n*Math.cos(r),e.y=a+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)*s,o=r*t;n.x=i+e*Math.cos(o),n.y=a+e*Math.sin(o)}}}const f=r.__skipForceSimulation||0===r.iterations?0:h?40:r.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),y=ur(r.nodeSize,r.nodeSizeRange,e),g=e=>y(e);if(f>0){const l=new Map,u=new Map;for(const t of e)l.set(t.id,0),u.set(t.id,t);for(const e of t){const t=R(e.source),r=R(e.target);l.set(t,(l.get(t)??0)+1),l.set(r,(l.get(r)??0)+1)}const d=nr().strength(e=>{const t=e.weight,r=R(e.source),n=R(e.target),i=Math.max(1,Math.min(l.get(r)??1,l.get(n)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*o/(.1*i))}).distance(e=>{const t="string"==typeof e.source?u.get(e.source):e.source,r="string"==typeof e.target?u.get(e.target):e.target,n=(t?g(t):0)+(r?g(r):0)+Math.max(6,12*s);return Math.max(16,40*s,n)}).id(e=>e.id),y=Jt();if(void 0===r.random&&void 0===r.seed||y.randomSource(r.random??ee(r.seed)),y.force("charge",or().strength(e=>{const t=l.get(e.id)??0;return-15*s*g(e)*Math.sqrt(t+1)})).force("collide",ir(e=>g(e)+3*s).strength(.9).iterations(2)).force("center",er(i,a).strength(.8)).force("x",tr(i).strength(c)).force("y",rr(a).strength(c)).force("bounds",function(e,t,r=2,n=.6){let o=[];const i=i=>{const a=n*Math.max(i,.2);for(const n of o){const o=n.x??e[0]/2,i=n.y??e[1]/2,s=n.vx??0,c=n.vy??0,l=t(n)+r,u=Math.min(e[0]/2,l),d=Math.max(e[0]/2,e[0]-l),h=Math.min(e[1]/2,l),f=Math.max(e[1]/2,e[1]-l),y=o+s,g=i+c;u>y?n.vx=s+(u-y)*a:y>d&&(n.vx=s+(d-y)*a),h>g?n.vy=c+(h-g)*a:g>f&&(n.vy=c+(f-g)*a)}};return i.initialize=e=>{o=e},i}(n,g)),y.nodes(e),t.length>0){const e=t.map(e=>({...e,source:R(e.source),target:R(e.target)}));d.links(e),y.force("link",d)}h?y.alpha(.3):.1>y.alpha()&&y.alpha(1),y.stop();for(let e=0;f>e;++e)y.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(t),r=f>0?2:0,o=Math.min(n[0]/2,e+r),i=Math.min(n[1]/2,e+r);t.x=Math.max(o,Math.min(n[0]-o,t.x)),t.y=Math.max(i,Math.min(n[1]-i,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=p.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=p.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){const o=r.nodeStyle,i=r.edgeStyle,a=ur(r.nodeSize,r.nodeSizeRange,e),s=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Se,c=new Map;e.forEach((e,t)=>{c.set(e.id,s[t%s.length])});const l=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Kt(t,"nodeSize")),n=o?o(Kt(t,"nodeStyle")):{},i={fill:n.fill||c.get(t.id)||r.themeSemantic?.primary||"#007bff",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};l.push({type:"circle",cx:t.x,cy:t.y,r:e,style:i,datum:t,id:t.id,label:t.id})}const h=new Map;for(const t of e)h.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:h.get(e.source),n="object"==typeof e.target?e.target:h.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=i?i(Kt(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:o.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.6},datum:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel);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=a(Kt(r,"nodeSize"));d.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:l,sceneEdges:u,labels:d}}};function cr(e,t,r){const n=[];for(const o of t){const t=R(o.source),i=R(o.target);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 lr(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 ur(e,t,r){if(r.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],o=[];for(const t of r){const r=t.data?.[e];"number"==typeof r&&o.push(r)}if(0===o.length)return()=>n[0];const[i,a]=Re(o);if(i===a)return()=>(n[0]+n[1])/2;const s=ar().domain([i,a]).range(n).clamp(!0);return t=>{const r=t.data?.[e];return null==r||"number"!=typeof r?n[0]:s(r)}}import{chord as dr,ribbon as hr}from"d3-chord";import{arc as fr}from"d3-shape";var yr=Se,gr={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=>e[h]??1:e=>e.value??1;var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const y=e.length,g=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t=R(e.source),r=R(e.target),n=f.get(t),o=f.get(r);if(void 0===n||void 0===o)continue;const i=d(e);g[n][o]=i}const p=dr().padAngle(o);a&&p.sortGroups(a);const m=p(g),v=m.groups,x=fr().innerRadius(c).outerRadius(s);for(const t of v){const r=e[t.index],n=x.centroid({innerRadius:c,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});r.x=n[0]+l,r.y=n[1]+u,r.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const k=new Map;for(const t of e)k.set(t.id,t);for(const e of t){const t=R(e.source),r=R(e.target),n=k.get(t),o=k.get(r);n&&(e.source=n),o&&(e.target=o)}const b=new Map;for(const e of t){const t=R(e.source),r=R(e.target);b.set(`${t}\0${r}`,e)}for(const t of m){const r=e[t.source.index].id,n=e[t.target.index].id,o=b.get(`${r}\0${n}`)||b.get(`${n}\0${r}`);o&&(o.__chordData=t)}},buildScene(e,t,r,n){const{groupWidth:o=20,edgeOpacity:i=.5}=r,a=Math.min(n[0],n[1])/2,s=a-o,c=n[0]/2,l=n[1]/2,u=r.nodeStyle,d=r.edgeStyle,h=r.edgeColorBy||"source",f=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:yr,y=new Map;e.forEach((e,t)=>{y.set(e.id,f[t%f.length])});const g=hr().radius(s),p=[],m=[],v=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.__arcData;if(!n)continue;let o;o=u?u(Kt(r,"nodeStyle")).fill||y.get(r.id)||f[t%f.length]:y.get(r.id)||f[t%f.length];const i=u?u(Kt(r,"nodeStyle")):{};p.push({type:"arc",cx:c,cy:l,innerR:s,outerR:a,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:o,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=g(t);if(!n)continue;const o=pr(n,c,l);let a=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";if(d)a=d(Kt(e,"edgeStyle")).fill||a;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===h&&r?a=y.get(r.id)||a:t&&(a=y.get(t.id)||a)}const s=d?d(Kt(e,"edgeStyle")):{};m.push({type:"ribbon",pathD:o,style:{fill:a,fillOpacity:s.fillOpacity??i,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel),n=a+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;v.push({x:c+Math.cos(a)*n,y:l+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:p,sceneEdges:m,labels:v}}};function pr(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(" ")}import{hierarchy as mr,tree as vr,cluster as xr,treemap as kr,pack as br,partition as _r,treemapBinary as Sr}from"d3-hierarchy";var wr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ar(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 Lr(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 Er(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function Pr(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:wr}function Dr(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Rr(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}`}}var Mr={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;if(!o)return;const i=r.chartType,a=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,l=mr(o,a);l.sum(c),l.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=vr();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=xr();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"treemap":!function(e,t,r,n){const o=t.padding??4,i=t.paddingTop??0,a=kr().size([r,n]).tile(Sr).padding(o);i>0&&a.paddingTop(i),a(e)}(l,r,u,d);break;case"circlepack":!function(e,t,r,n){const o=t.padding??4;br().size([r,n]).padding(o)(e)}(l,r,u,d);break;case"partition":!function(e,t,r,n){_r().size([r,n]).padding(t.padding??1)(e)}(l,r,u,d)}const h=l.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const n=h[t],o={id:Lr(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:n.value??0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?Nr(o,n,r):"treemap"===i||"partition"===i?Tr(o,n):"circlepack"===i&&Cr(o,n),o.__hierarchyNode=n,e.push(o),f.set(n,o)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const r=f.get(e.parent),n=f.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){const a=[],s=[],c=[],l=r.treeOrientation||"vertical",u="radial"===l,d=n[0]/2,h=n[1]/2,f="number"==typeof(y=r.nodeSize)?y:5;var y;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=o(Kt(t,"nodeStyle"));let s=i.fill||Dr(r);if(r.colorByDepth&&void 0!==t.depth){const e=Pr(r);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:n,r:f,style:{fill:s,stroke:i.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const g=r.edgeOpacity??.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,c=n.x,f=n.y;u&&(o+=d,a+=h,c+=d,f+=h);const y=Rr(o,a,c,f,l),p=i(Kt(e,"edgeStyle"));s.push({type:"curved",pathD:y,style:{fill:"none",stroke:p.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:p.strokeWidth??1.5,opacity:p.opacity??g},datum:e})}if(!1!==r.showLabels){const t=Er(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(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,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"===l?(r.data?.children&&0!==r.data.children.length?(n=a-f-6,i="end"):(n=a+f+6,i="start"),o=s):(n=a,o=s+f+14,i="middle");c.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:c}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const a=n(Kt(r,"nodeStyle"));let s=a.fill||Dr(t);if(t.colorByDepth&&void 0!==r.depth){const e=Pr(t);s=e[r.depth%e.length]}o.push({type:"rect",x:r.x0,y:r.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity,fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Er(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,c=s.y1-s.y0;if(0>=e||0>=c)continue;const l=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===o&&!l)continue;if("parent"===o&&l)continue}const u=r?r(s):s.id;if(!u)continue;if((l?30:40)>e||(l?16:14)>c)continue;let d=n(Kt(s,"nodeStyle")).fill||Dr(t);if(t.colorByDepth&&void 0!==s.depth){const e=Pr(t);d=e[s.depth%e.length]}const h="string"==typeof d?Ar(d):t.themeSemantic?.text??"#000";i.push(l?{x:s.x0+e/2,y:s.y0+c/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:h}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);case"circlepack":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.__radius??5;if(0>=e)continue;const i=n(Kt(r,"nodeStyle"));let a=i.fill||Dr(t);if(t.colorByDepth&&void 0!==r.depth){const e=Pr(t);a=e[r.depth%e.length]}o.push({type:"circle",cx:r.x,cy:r.y,r:e,style:{fill:a,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Er(t.nodeLabel);for(const o of e){const e=o.__radius??5,a=r?r(o):o.id;if(!a)continue;if(15>e)continue;const s=!(o.data?.children&&o.data.children.length>0);let c=n(Kt(o,"nodeStyle")).fill||Dr(t);if(t.colorByDepth&&void 0!==o.depth){const e=Pr(t);c=e[o.depth%e.length]}if(s){const r="string"==typeof c?Ar(c):t.themeSemantic?.text??"#000";i.push({x:o.x,y:o.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:r})}else i.push({x:o.x,y:o.y-e+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Nr(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 Tr(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 Cr(e,t){const r=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-r,e.x1=t.x+r,e.y0=t.y-r,e.y1=t.y+r,e.width=2*r,e.height=2*r,e.__radius=r}import{pie as Ir}from"d3-shape";function Wr(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var $r={sankey:Ut,force:sr,chord:gr,tree:Mr,cluster:Mr,treemap:Mr,circlepack:Mr,partition:Mr,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(r.nodeIDAccessor),s=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),c=r.orbitSize??2.95,l=r.orbitEccentricity??1,u="number"==typeof c?()=>c:c,d="number"==typeof l?()=>l:l,h=Wr(r);h.metaMap.clear(),n.length=0,o.length=0;const f=new Map;function y(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const g=t[0]/2,p=t[1]/2,m=Math.min(t[0],t[1])/2*.85,v=y(a(e));n.push({id:v,x:g,y:p,x0:g,x1:g,y0:p,y1:p,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(v,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,c,l,f,g,p){const m=i(t);if(!m?.length)return;const v=m.length;let x=0,k=0,b=0;for(;v>k;)k+=s[Math.min(b,s.length-1)],b++,x++;let _=0;for(let v=0;x>v;v++){const k=s[Math.min(v,s.length-1)],b=m.slice(_,_+k);if(!b.length)break;const S=(v+1)/x,w={id:r,depth:g,data:t,parentId:r},A=p?f/u(w)*S:f*S,L=Ir().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(b),E=d(w);for(let t=0;b.length>t;t++){const i=(L[t].startAngle+L[t].endAngle)/2,s=b[t],u=y(a(s)),d=c+A*Math.sin(i),f=l+A*Math.cos(i)*E;n.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:g,data:s}),h.metaMap.set(u,{ring:A,angle:i,depth:g,parentId:r,eccentricity:E}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(s,u,d,f,A,g+1,!0)}_+=k}}(e,v,g,p,m,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){const o=r.nodeStyle,i=r.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],c=[],l=[];if(!1!==r.orbitShowRings){const t=Wr(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,l=(o+1)/i*Math.PI*2;c.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(l),y2:t+r*Math.cos(l)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Kt(t,"nodeSize")),n=o?o(Kt(t,"nodeStyle")):{};s.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||r.themeSemantic?.primary||"#6366f1",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),r="object"==typeof e.target?e.target:u.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&c.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=a(Kt(r,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(r):t?r.data?.[t]??r.id:r.id;l.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:c,labels:l}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){const r=Wr(t),n=t.orbitSpeed??.25,o=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,a=n*(Math.PI/6),s=new Map;for(const t of e)s.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=s.get(e.parentId);if(!n)continue;const c=e.angle+i*a*o({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(c),t.y=n.y+e.ring*Math.cos(c)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,r),!0)}};function zr(e){return $r[e]}import{quadtree as Fr}from"d3-quadtree";function Br(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 Yr(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Or(e))return!1;return!0}return Or(t.points)}function Or(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}import{interpolateNumber as Xr}from"d3-interpolate";var jr="rgba(34, 197, 94, 0.7)",Hr=2e3,qr=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vr=["scene-style","data-paint","accessibility","evidence"],Gr=(e,t)=>({retainedData:e,invalidations:t}),Qr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Zr=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ur=["scene-style","data-paint","accessibility","evidence"],Jr=["scene-geometry","data-paint","overlay","accessibility","evidence"],en=[],tn={chartType:Gr("rebuild",Qr),nodeIDAccessor:Gr("rebuild",Qr),sourceAccessor:Gr("rebuild",Qr),targetAccessor:Gr("rebuild",Qr),valueAccessor:Gr("rebuild",Qr),edgeIdAccessor:Gr("rebuild",Qr),childrenAccessor:Gr("rebuild",Qr),hierarchySum:Gr("rebuild",Qr),orientation:Gr("preserve",Kr),nodeAlign:Gr("preserve",Kr),nodePaddingRatio:Gr("preserve",Kr),nodeWidth:Gr("preserve",Kr),edgeSort:Gr("preserve",Kr),iterations:Gr("preserve",Kr),forceStrength:Gr("preserve",Kr),padAngle:Gr("preserve",Kr),groupWidth:Gr("preserve",Kr),sortGroups:Gr("preserve",Kr),treeOrientation:Gr("preserve",Kr),edgeType:Gr("preserve",Kr),padding:Gr("preserve",Kr),paddingTop:Gr("preserve",Kr),orbitMode:Gr("preserve",Kr),orbitSize:Gr("preserve",Kr),orbitSpeed:Gr("preserve",Kr),orbitRevolution:Gr("preserve",Kr),orbitRevolutionStyle:Gr("preserve",Kr),orbitEccentricity:Gr("preserve",Kr),orbitShowRings:Gr("preserve",Kr),orbitAnimated:Gr("preserve",Kr),customNetworkLayout:Gr("preserve",Kr),layoutConfig:Gr("preserve",Kr),nodeSize:Gr("preserve",Zr),nodeSizeRange:Gr("preserve",Zr),colorByDepth:Gr("preserve",Zr),nodeLabel:Gr("preserve",Jr),showLabels:Gr("preserve",Jr),labelMode:Gr("preserve",Jr),nodeStyle:Gr("preserve",Ur),edgeStyle:Gr("preserve",Ur),colorBy:Gr("preserve",Ur),colorScheme:Gr("preserve",Ur),themeCategorical:Gr("preserve",Ur),themeSemantic:Gr("preserve",Ur),edgeColorBy:Gr("preserve",Ur),edgeOpacity:Gr("preserve",Ur),showParticles:Gr("preserve",Ur),particleStyle:Gr("preserve",Ur),decay:Gr("preserve",Ur),pulse:Gr("preserve",Ur),thresholds:Gr("preserve",Ur),staleness:Gr("preserve",Ur),layoutSelection:Gr("preserve",Ur),clock:Gr("preserve",en),random:Gr("preserve",en),seed:Gr("preserve",en),tensionConfig:Gr("preserve",en),transition:Gr("preserve",en),introAnimation:Gr("preserve",en),onLayoutError:Gr("preserve",en),__skipForceSimulation:Gr("preserve",en),__hierarchyRoot:Gr("preserve",en),__orbitState:Gr("preserve",en),__previousPositions:Gr("preserve",en)},rn=Gr("preserve",Kr),nn=class{constructor(){this.tracker=new q}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},qr)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vr):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const r=new Set;for(const n of e){const e=tn[n]??rn;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)r.add(t)}return{retainedData:t,invalidations:r}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},on=class e{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.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new nn,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._decayAgeMap=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._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...He,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Ve(2e3))}currentTime(){return this.config.clock?.()??fe()}updateConfig(e){const t=this.config,r={...t,...e};t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(r.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(r)])].filter(e=>t[e]!==r[e]);this.config=r,this.tensionConfig={...He,...r.tensionConfig},!r.showParticles||"sankey"!==r.chartType&&!r.customNetworkLayout||this.particlePool||(this.particlePool=new Ve(2e3)),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}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._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,r,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:a="target",valueAccessor:s="value"}=this.config,c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a],d="function"==typeof s?s:e=>e[s]??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,this._networkDecayCache=null;for(const t of e){const e=c(t)+"";this.nodes.set(e,{...Br(e),data:t})}for(let e=0;t.length>e;e++){const r=t[e],n=l(r)+"",o=u(r)+"",i=d(r),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(n)||this.nodes.set(n,{...Br(n),data:r}),this.nodes.has(o)||this.nodes.set(o,{...Br(o),data:r});const c=`${n}\0${o}\0${e}`,h={source:n,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:c};r&&"object"==typeof r&&Yr(r.bezier)&&(h.bezier=r.bezier),this.edges.set(c,h)}n?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,n){return this.ingestBounded(e,t,r,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,r]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}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=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Br(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,Br(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;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);const u=o||i||l||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=zr(this.config.chartType);if(!t)return;let r=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===r.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of r)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.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(t.computeLayout(r,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of r)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[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,r=Array.from(this.nodes.values())}this.finalizeLayout();const o=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||o.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=o,this.saveTargetPositions();const i=r.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,s=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&s&&r.length>0&&a>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:this.currentTime(),duration:a}}else i&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a});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=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:r,restyleEdge:n,baseStyles:o,selection:i}){const a=!(!r&&!n);if(r)for(const t of e){const e=o.get(t)??t.style,n=r(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=o.get(e)??e.style,r=n(e,i);e.style=r?{...t,...r}:t}return a}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:r,nodes:n,edges:o,previousResult:i,revision:a}){const s=C(e.colorScheme,e.themeCategorical,Se),l={nodes:n,edges:o,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...s]},resolveColor:T(s,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const r=null!==i,n=c("network",t,r,a);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:r}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const r=t.result;return this.sceneNodes=r.sceneNodes??[],this.sceneEdges=r.sceneEdges??[],this.labels=r.labels??[],this.customLayoutOverlays=r.overlays??null,this.customLayoutHtmlMarks=r.htmlMarks??[],this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const r=new WeakMap;for(const t of e)r.set(t,t.style);for(const e of t)r.set(e,e.style);return r}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void L({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=zr(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const r=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,r=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>r&&(r=e.r));if(this._maxNodeRadius=r,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[o++]=e);this._nodeQuadtree=Fr().x(e=>e.cx).y(e=>e.cy).addAll(n)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=zr(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=zr(this.config.chartType);if(!r?.tick)return!1;const n=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=r.hierarchical?Array.from(this.edges.values()):this.edgesArray;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=U(e,this.transition),r=K(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=le(e._prevX0,e._targetX0,r),e.x1=le(e._prevX1,e._targetX1,r),e.y0=le(e._prevY0,e._targetY0,r),e.y1=le(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=le(e._prevY0,e._targetY0,r),e.y1=le(e._prevY1,e._targetY1,r),e.sankeyWidth=le(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=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){!function(e,t,r=.5){const n="string"==typeof e.source?t.get(e.source):e.source,o="string"==typeof e.target?t.get(e.target):e.target;!n||!o||(e.bezier=e.circular&&e.circularPathData?function(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}}(e):function(e,t,r,n=.5){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,a=r.x0,s=Xr(i,a);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(n)},{x:e.y1,y:s(1-n)},{x:e.y1,y:a}],halfWidth:o}}const i=t.x1,a=r.x0,s=Xr(i,a);return{circular:!1,points:[{x:i,y:e.y0},{x:s(n),y:e.y0},{x:s(1-n),y:e.y1},{x:a,y:e.y1}],halfWidth:o}}(e,n,o,r))}(e,this.nodes,.5)}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){!function(e){const t=e.pulse;if(!t)return;const r=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",o=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const a=t.id;if(!a)continue;const s=e.nodeTimestamps.get(a);if(!s)continue;const c=i-s;r>c&&(t._pulseIntensity=1-c/r,t._pulseColor=n,t._pulseGlowRadius=o)}for(const t of e.sceneEdges){const o=t.datum;if(!o)continue;const a="object"==typeof o.source?o.source?.id:o.source,s="object"==typeof o.target?o.target?.id:o.target;if(!a||!s)continue;const c=e.edgeTimestamps.get(`${a}\0${s}`);if(!c)continue;const l=i-c;r>l&&(t._pulseIntensity=1-l/r,t._pulseColor=n)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const r=e.nodeTimestamps.size;if(1>=r)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let r=0;e.cache.sortedNodes.length>r;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}const n=e.cache.ageMap;for(const o of e.sceneNodes){const e=o.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const a=s(t,i,r);o.style={...o.style,opacity:(o.style?.opacity??1)*a}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===jr&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=Hr)return;const r=1-t/Hr;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=jr,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,r=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&Hr>r-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const r=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",o=!1!==t.pulse;for(const i of e.sceneNodes){const a=i.id;if(!a)continue;const s=e.nodes.get(a);if(!s)continue;const c=t.metric(s);let l=null;void 0===t.critical||t.critical>c?void 0===t.warning||t.warning>c||(l=r):l=n,l&&(i.style={...i.style,fill:l},o&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=l,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const r of e){const e=t.metric(r);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const r=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>r-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;const n=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,r){const n=this.config.valueAccessor,o="function"==typeof n?n:n?e=>e[n]:e=>e.value,i=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){i.push(n.data?{...n.data}:{}),n.data=r(n.data??{});const e=o(n.data);null!=e&&(n.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!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++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!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=>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++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};on.QUADTREE_THRESHOLD=500;var an=on;o(an);import*as sn from"react";import{Fragment as cn,jsx as ln,jsxs as un}from"react/jsx-runtime";function dn(e){const{width:t,height:r,totalWidth:n,totalHeight:o,margin:i,labels:a,title:s,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:y,foregroundGraphics:g,sceneNodes:p,annotations:m,onAnnotationActivate:v,onObservation:x,chartId:k,chartType:b,autoPlaceAnnotations:_,svgAnnotationRules:S}=e,w=Le({onAnnotationActivate:v,onObservation:x,chartId:k,chartType:b}),A=sn.useMemo(()=>{const e=(p||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;const n=Ne(e.glyph,e.size);return{x:t+n.centerDx,y:r+n.centerDy,r:Math.max(1,n.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Ae(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),r=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:r,...t}]:[]});return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:p}},[r,p,t]),L=sn.useMemo(()=>{if(!m)return m;const e=M(m);return _?G({annotations:e,context:A,..."object"==typeof _?_:{}}):e},[m,_,A]),E=sn.useMemo(()=>J("network"),[]),P=L?ve(L.filter(e=>"widget"!==e.type),E,S,A):null,D=!0===L?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return un(cn,{children:[D&&ln("style",{children:I},"annotation-widget-disclosure-style"),un("svg",{role:"img",width:n,height:o,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[ln("title",{children:"string"==typeof s?s:"Network Chart"}),ln("desc",{children:"string"==typeof s?s+" (network data visualization)":"Network data visualization"}),un("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>ln("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),P,g]}),s&&"string"==typeof s?ln("text",{x:n/2,y:H,textAnchor:"middle",fontWeight:600,fill:"currentColor",fontSize:14,className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:s}):s?ln("foreignObject",{x:0,y:0,width:n,height:i.top,children:s}):null,xe({legend:c,totalWidth:n,totalHeight:o,margin:i,legendPosition:f,title:s,legendLayout:y,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),L?.filter(e=>"widget"===e.type&&e.nodeId&&p).map((e,t)=>{const r=!0===e._annotationDeferred,n=p.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!n)return null;const o=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),a=i.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),s=e.dx??0,c=e.dy??-16,l=e.width??32,u=e.height??32,d=e.content??ln("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return ln("div",{...V(e,w),className:r?"annotation-deferred":void 0,"data-annotation-disclosure":r?"deferred":void 0,style:{position:"absolute",left:o+s-l/2,top:a+c-u/2,width:l,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}dn.displayName="NetworkSVGOverlay";import*as hn from"react";import{jsx as fn}from"react/jsx-runtime";var yn={position:"absolute",top:0,left:0,pointerEvents:"none"};function gn({marks:e,margin:t,selection:r=null,overscan:n=400}){const o=hn.useRef(null),i=function(e,t,r){const[n,o]=hn.useState(null);return hn.useLayoutEffect(()=>{const e=t.current,r=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:r,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${r}`))return t;t=t.parentElement}return null}(e);if(!e||!r)return void o(null);let n=0;const i=()=>{n=0;const t=r.getBoundingClientRect(),i=e.getBoundingClientRect();o(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},a=()=>{0===n&&(n=window.requestAnimationFrame(i))};i(),r.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(r),()=>{0!==n&&window.cancelAnimationFrame(n),r.removeEventListener("scroll",a),s.disconnect()}},[t,e,r]),hn.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:o,originY:i}=n,a=t.left-r,s=t.right+r,c=t.top-r,l=t.bottom+r;return e.filter(e=>{const t=o+e.x,r=i+e.y;return!(a>t+e.width||t>s||c>r+e.height||r>l)})},[e,n,r])}(e,o,n);if(!e||0===e.length)return null;const a=fn("div",{className:"semiotic-network-html-marks",ref:o,style:{...yn,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>fn("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=r?fn(E,{value:r,children:a}):a}import{jsx as pn,jsxs as mn}from"react/jsx-runtime";function vn({props:e,store:t,responsiveRef:r,size:n,margin:o,adjustedWidth:i,adjustedHeight:s,resolvedBackground:c,resolvedForeground:l}){const{chartType:u,nodes:d,edges:h,data:f,className:y,description:g,title:p,responsiveWidth:m,responsiveHeight:v,summary:x,background:b,renderMode:_,legend:S,legendPosition:w,legendLayout:A,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:D,legendIsolatedCategories:R,layoutSelection:M,annotations:N,onAnnotationActivate:T,annotationObservationCallback:C,onObservation:I,chartId:W,autoPlaceAnnotations:$,svgAnnotationRules:z}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(u),r=e?f||(Array.isArray(h)?void 0:h):void 0;if(e&&r)t.ingestHierarchy(r,[i,s]),t.buildScene([i,s]);else{const e=oe(d),r=Array.isArray(h)?oe(h):[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[i,s]),t.buildScene([i,s]))}}const F=t?.sceneNodes??[],B=t?.sceneEdges??[],Y=t?.labels??[];return mn("div",{ref:r,className:"stream-network-frame"+(y?" "+y:""),role:"img","aria-label":g||("string"==typeof p?p:"Network chart"),style:{position:"relative",width:m?"100%":n[0],height:v?"100%":n[1]},children:[pn(X,{summary:x}),mn("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[c&&pn("g",{transform:`translate(${o.left},${o.top})`,children:c}),mn("g",{transform:`translate(${o.left},${o.top})`,children:[b&&pn("rect",{x:0,y:0,width:i,height:s,fill:b}),B.map((e,t)=>k({node:e,index:t,renderMode:_,fallback:()=>de(e,t)})).filter(Boolean),F.map((e,t)=>k({node:e,index:t,renderMode:_,fallback:()=>he(e,t)})).filter(Boolean),Y.map((e,t)=>ue(e,t)).filter(Boolean)]})]}),pn(dn,{width:i,height:s,totalWidth:n[0],totalHeight:n[1],margin:o,labels:Y,sceneNodes:F,title:p,legend:S,legendPosition:w,legendLayout:A,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:D,legendIsolatedCategories:R,foregroundGraphics:a(l,P(t?.customLayoutOverlays,M??null)),annotations:N,onAnnotationActivate:T,onObservation:C??I,chartId:W,chartType:"StreamNetworkFrame",autoPlaceAnnotations:$,svgAnnotationRules:z,annotationFrame:0}),pn(gn,{marks:t?.customLayoutHtmlMarks,margin:o,selection:M??null})]})}function xn(e){if("undefined"!=typeof DOMException)return new DOMException(e+" aborted","AbortError");const t=Error(e+" aborted");return t.name="AbortError",t}function kn(e){const t=Error(e.message);return t.name=e.name??"Error",e.stack&&(t.stack=e.stack),t}function bn(e){return e&&"object"==typeof e?{requestId:e.requestId,error:e.error}:{}}var _n=class{constructor(e){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.options=e,this.worker=e.createWorker(),this.worker.onmessage=e=>{const t=this.options.parseMessage(e.data),r=t.requestId,n=null!=r?this.pending.get(r):this.pending.values().next().value;if(n){if(null!=r)this.pending.delete(r);else{for(const e of this.pending.values())e!==n&&(e.cleanup(),e.reject(Error(this.options.name+" worker response missing requestId")));this.pending.clear()}n.cleanup(),t.ok?n.resolve(t.payload):n.reject(t.error)}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||this.options.name+" worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error(this.options.name+" worker session is closed"));if(t?.aborted)return Promise.reject(xn(this.options.name));const r=this.nextRequestId;this.nextRequestId+=1;const n=this.options.encodeRequest?.(r,e)??{requestId:r,request:e};return new Promise((e,o)=>{const i=()=>{this.pending.delete(r),t?.removeEventListener("abort",i),o(xn(this.options.name))},a=()=>t?.removeEventListener("abort",i);this.pending.set(r,{cleanup:a,reject:o,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(r),a(),o(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error(this.options.name+" worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}};function Sn(e){let t=null;return{get:()=>(t&&!t.isDead||(t=e()),t),resetForTest:()=>{if(t){try{t.terminate()}catch{}t=null}}}}function wn(e,t,r,n,o=4e4){return"sync"!==e&&("worker"===e||n*(t+r)>=o)}function An(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}var Ln=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):N("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.session=new _n({name:"Force layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:r,error:n}=bn(t);return n?{requestId:r,ok:!1,error:kn(n)}:{requestId:r,ok:!0,payload:{positions:t.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},En=Sn(()=>new Ln);function Pn(e,t){return An()?En.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as Dn,jsxs as Rn}from"react/jsx-runtime";var Mn=/^(value|amount|total|count|weight|score)$/i;function Nn({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Rn("div",{className:"semiotic-tooltip",style:te,children:[Rn("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const r=t.__hierarchyNode;if(r){const e=[];let n=r;for(;n;){const r=n.data?.name??n.data?.id??t.id;null!=r&&e.unshift(r+""),n=n.parent}e.length>1&&e.shift();const o=e.length-1;return Rn("div",{className:"semiotic-tooltip",style:te,children:[Dn("div",{children:e.map((e,t)=>Rn("span",{children:[t>0&&Dn("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===o?Dn("strong",{children:e}):Dn("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&Dn("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const n=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),o=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=we(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>Mn.test(e.key));return Rn("div",{className:"semiotic-tooltip",style:te,children:[Dn("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>Rn("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",d(e.value)]},e.key)),!s&&null!=t.value&&t.value>0&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,o!==n&&` (weighted: ${o.toLocaleString()})`]})]})}function Tn(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Cn(e,t){if(!t.pathD)return;e.save();const r=Tn(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const r=e.createLinearGradient(n.x0,n.y0??0,n.x1,n.y1??0),o=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",a=ke(e,i)||i;r.addColorStop(0,1===n.from?a:"transparent"),r.addColorStop(1,1===n.to?a:"transparent"),e.fillStyle=r,e.globalAlpha=o}else e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function In(e,t){e.save();const r=t.style.stroke||"#999";e.strokeStyle=ke(e,r)||r,e.lineWidth=t.style.strokeWidth??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=(t.style.strokeWidth??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 Wn(e,t){if(!t.pathD)return;e.save();const r=Tn(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function $n(e,t){if(!t.pathD)return;e.save();const r=Tn(t),n=t.style.stroke||"#999";e.strokeStyle=ke(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}function zn(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);return a>h(e.r,n)?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=f(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=p(Math.atan2(o,n)),s=p(e.startAngle),c=p(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);case"symbol":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i);return a>h(Ae(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"glyph":return function(e,t,r,n=30){if(null==e.datum)return null;const o=Ne(e.glyph,e.size),i=e.cx+o.centerDx,a=e.cy+o.centerDy,s=t-i,c=r-a,l=Math.sqrt(s*s+c*c);return l>h(o.radius,n)?null:{type:"node",datum:e.datum,x:i,y:a,distance:l}}(e,t,r,n);default:return null}}Nn.ownsChrome=!0;var Fn=null,Bn=null;function Yn(){return Bn||((Fn=document.createElement("canvas")).width=1,Fn.height=1,Bn=Fn.getContext("2d")),Bn}function On(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{return null}}function Xn(e,t,r){switch(e.type){case"bezier":return function(e,t,r){if(!e.pathD)return null;const n=On(e),o=Yn();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{}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((t-s)**2+(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=On(e),o=Yn();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{}return null}(e,t,r);default:return null}}function jn(e){const{clientX:t,clientY:r,canvasRect:n,margin:o,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,sceneEdges:c,nodeQuadtree:l,maxNodeRadius:d,hitRadius:h=30}=e,f=t-n.left-o.left,y=r-n.top-o.top;if(0>f||f>i||0>y||y>a)return{kind:"miss-outside"};const g=function(e,t,r,n,o=30,i,a=0){let s=null,c=o,l=1/0;if(i){const e=u(i,r,n,o,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},c=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=zn(t,r,n,o);if(e)if("rect"===t.type){const r=t.w*t.h;l>r&&(s=e,l=r)}else c>e.distance&&(s=e,c=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=Xn(e,r,n);t&&c>t.distance&&(s=t,c=t.distance)}return s}(s,c,f,y,h,l,d);return g?{kind:"hit",hover:Q(g.datum||{},g.x,g.y,{nodeOrEdge:g.type})}:{kind:"miss"}}import{useCallback as Hn}from"react";var qn="StreamNetworkFrame";import{jsx as Vn,jsxs as Gn}from"react/jsx-runtime";var Qn={top:20,right:80,bottom:20,left:80},Kn={top:40,right:40,bottom:40,left:40},Zn=new Set(["chord","force","circlepack","orbit"]),Un=[800,600],Jn=je(Xe(function(o,s){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:f,nodeIDAccessor:p="id",sourceAccessor:k="source",targetAccessor:L="target",valueAccessor:E="value",edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N="horizontal",nodeAlign:T="justify",nodePaddingRatio:C=.05,nodeWidth:I=15,iterations:H=300,forceStrength:q=.1,layoutExecution:V="auto",layoutLoadingContent:G,onLayoutStateChange:K,padAngle:U=.01,groupWidth:J=20,sortGroups:ee,edgeSort:te,treeOrientation:le="vertical",edgeType:ue="curve",padding:de,paddingTop:he,tensionConfig:fe,showParticles:ve=!1,particleStyle:xe,renderMode:be,nodeStyle:Se,edgeStyle:we,colorBy:Ae,colorScheme:Le="category10",edgeColorBy:Re="source",edgeOpacity:Ne=.5,colorByDepth:Xe=!1,nodeSize:je=8,nodeSizeRange:Ve=[5,20],nodeLabel:Ge,showLabels:Qe=!0,labelMode:Ke,size:Ze=Un,responsiveWidth:Ue,responsiveHeight:Je,margin:et,className:tt,background:rt,maxDevicePixelRatio:nt,enableHover:ot=!0,tooltipContent:it,customHoverBehavior:at,customClickBehavior:st,onObservation:ct,annotationObservationCallback:lt,chartId:ut,onTopologyChange:dt,annotations:ht,onAnnotationActivate:ft,autoPlaceAnnotations:yt,svgAnnotationRules:gt,legend:pt,legendPosition:mt,legendLayout:vt,legendHoverBehavior:xt,legendClickBehavior:kt,legendHighlightedCategory:bt,legendIsolatedCategories:_t,title:St,foregroundGraphics:wt,backgroundGraphics:At,decay:Lt,pulse:Et,transition:Pt,animate:Dt,staleness:Rt,frameScheduler:Mt,clock:Nt,random:Tt,seed:Ct,paused:It=!1,suspendWhenHidden:Wt=!0,thresholds:$t,accessibleTable:zt=!0,description:Ft,summary:Bt,orbitMode:Yt,orbitSize:Ot,orbitSpeed:Xt,orbitRevolution:jt,orbitRevolutionStyle:Ht,orbitEccentricity:qt,orbitShowRings:Vt,orbitAnimated:Gt,customNetworkLayout:Qt,onLayoutError:Kt,layoutConfig:Zt,layoutSelection:Ut}=o,Jt=Zn.has(c)?Kn:Qn,er=$e(!0),tr=Ee({sizeProp:Ze,responsiveWidth:Ue,responsiveHeight:Je,userMargin:et,marginDefault:Jt,title:St,legend:pt,legendPosition:mt,foregroundGraphics:wt,backgroundGraphics:At,animate:Dt,transitionProp:Pt,frameScheduler:Mt,clock:Nt,random:Tt,seed:Ct,paused:It,suspendWhenHidden:Wt,themeDirtyRef:er}),{reducedMotionRef:rr,responsiveRef:nr,size:or,margin:ir,adjustedWidth:ar,adjustedHeight:sr,resolvedForeground:cr,resolvedBackground:lr,transition:dr,introEnabled:hr,tableId:fr,rafRef:yr,renderFnRef:gr,scheduleRender:pr,frameRuntime:mr,currentTheme:vr}=tr,xr=Ce(),kr=Ie(),br=Be(()=>oe(u),[u]),_r=Be(()=>Array.isArray(d)?oe(d):d,[d]),Sr=Be(()=>({...He,...fe}),[fe]),wr=Be(()=>({...qe,...xe}),[xe]),Ar=Be(()=>{return{chartType:(e={chartType:c,clock:mr.now,random:Tt,seed:Ct,nodeIDAccessor:p,sourceAccessor:k,targetAccessor:L,valueAccessor:E,edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N,nodeAlign:T,nodePaddingRatio:C,nodeWidth:I,iterations:H,forceStrength:q,padAngle:U,groupWidth:J,sortGroups:ee,edgeSort:te,treeOrientation:le,edgeType:ue,padding:de,paddingTop:he,tensionConfig:Sr,showParticles:ve,particleStyle:wr,nodeStyle:Se,edgeStyle:we,nodeLabel:Ge,showLabels:Qe,labelMode:Ke,colorBy:Ae,colorScheme:Le,edgeColorBy:Re,edgeOpacity:Ne,colorByDepth:Xe,nodeSize:je,nodeSizeRange:Ve,decay:Lt,pulse:Et,transition:dr,introAnimation:hr,staleness:Rt,thresholds:$t,orbitMode:Yt,orbitSize:Ot,orbitSpeed:Xt,orbitRevolution:jt,orbitRevolutionStyle:Ht,orbitEccentricity:qt,orbitShowRings:Vt,orbitAnimated:Gt,customNetworkLayout:Qt,onLayoutError:Kt,layoutConfig:Zt,currentTheme:vr}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:Me(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[c,mr.now,Tt,Ct,p,k,L,E,D,R,M,N,T,C,I,H,q,U,J,ee,te,le,ue,de,he,Sr,ve,wr,Se,we,Ge,Qe,Ke,Ae,Le,Re,Ne,Xe,je,Ve,Lt,Et,dr,hr,Rt,$t,Yt,Ot,Xt,jt,Ht,qt,Vt,Gt,Qt,Kt,Zt,vr]),Lr=w(Ar),Er=w({chartType:(Pr={chartType:c,nodeIDAccessor:p,sourceAccessor:k,targetAccessor:L,valueAccessor:E,edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N,nodeAlign:T,nodePaddingRatio:C,nodeWidth:I,iterations:H,forceStrength:q,padAngle:U,groupWidth:J,sortGroups:ee,edgeSort:te,treeOrientation:le,edgeType:ue,padding:de,paddingTop:he,random:Tt,seed:Ct,tensionConfig:Sr,customNetworkLayout:Qt,orbitMode:Yt,orbitSize:Ot,orbitEccentricity:qt}).chartType,nodeIDAccessor:Pr.nodeIDAccessor,sourceAccessor:Pr.sourceAccessor,targetAccessor:Pr.targetAccessor,valueAccessor:Pr.valueAccessor,edgeIdAccessor:Pr.edgeIdAccessor,childrenAccessor:Pr.childrenAccessor,hierarchySum:Pr.hierarchySum,orientation:Pr.orientation,nodeAlign:Pr.nodeAlign,nodePaddingRatio:Pr.nodePaddingRatio,nodeWidth:Pr.nodeWidth,iterations:Pr.iterations,forceStrength:Pr.forceStrength,padAngle:Pr.padAngle,groupWidth:Pr.groupWidth,sortGroups:Pr.sortGroups,edgeSort:Pr.edgeSort,treeOrientation:Pr.treeOrientation,edgeType:Pr.edgeType,padding:Pr.padding,paddingTop:Pr.paddingTop,random:Pr.random,seed:Pr.seed,tensionConfig:Pr.tensionConfig,customNetworkLayout:Pr.customNetworkLayout,orbitMode:Pr.orbitMode,orbitSize:Pr.orbitSize,orbitEccentricity:Pr.orbitEccentricity});var Pr;const Dr=$e(0),Rr=$e(0),Mr=$e(!1),Nr=$e(null);Nr.current||(Nr.current=new an(Lr));const Tr=De("StreamNetworkFrame"),Cr=Ye((e,t,r=!1)=>_e(Tr.current,e,()=>e.buildScene(t),r),[Tr]),[Ir,Wr]=ze(null),[$r,zr]=ze(0),[Fr,Br]=ze(0),[Yr,Or]=ze(!1),[Xr,jr]=ze(!1),Hr=$e(0),qr=$e(null),Vr=$e(!1),Gr=$e(K);Gr.current=K;const Qr=$e(Lr);Qr.current=Lr;const Kr=$e(null),Zr=$e(new Map),Ur=$e(0),Jr=Ye(e=>function(e){const{node:t,colorBy:r,colorScheme:n,nodeColorMap:o,colorIndexRef:i}=e;if("function"==typeof r)return r(t)+"";if("string"==typeof r&&t.data){const e=t.data[r];if(void 0!==e){if(!o.has(e+"")){const t=Array.isArray(n)?n:z;o.set(e+"",t[i.current++%t.length])}return o.get(e+"")}}if(o.has(t.id))return o.get(t.id);const a=Array.isArray(n)?n:z,s=r?a[i.current++%a.length]:a[0];return o.set(t.id,s),s}({node:e,colorBy:Ae,colorScheme:Le,nodeColorMap:Zr.current,colorIndexRef:Ur}),[Ae,Le]),en=Ye(e=>{Ur.current=function(e){const{sceneNodes:t,nodes:r,nodeColorMap:n,colorScheme:o}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(o)?o:z,a=Array.from(r);for(let e=0;a.length>e;e++){const t=a[e];n.has(t.id)||n.set(t.id,i[e%i.length])}return a.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Zr.current,colorScheme:Le})},[Le]),tn=Ye((e,t)=>{Cr(e,t),en(e),er.current=!1,e.markStylePaintPending()},[Cr,en]),rn=Ye(()=>{Nr.current?.markStylePaintPending()},[]),nn=(on=vr,on?.colors?.border||on?.colors?.secondary||on?.colors?.primary||"#999");var on;const sn=Ye(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Nr.current?.nodes),[]),cn=Ye(e=>function(e){const{edge:t,edgeColorBy:r,getNodeColor:n,resolveEndpoint:o,fallback:i}=e;if("function"==typeof r)return r(t);const a=o(t.source),s=o(t.target);return"target"===r&&s?n(s):a?n(a):i}({edge:e,edgeColorBy:Re,getNodeColor:Jr,resolveEndpoint:sn,fallback:nn}),[Re,Jr,nn,sn]),ln=Ye(e=>function(e){const{edge:t,particleStyleColor:r,particleColorBy:n,hasExplicitParticleColorBy:o,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:c}=e;if("function"==typeof r){const e=s(t.source);return e?r(t,e):c}if(!o)return i(t);const l=n,u=s(t.source),d=s(t.target);return"target"===l&&d?a(d):u?a(u):c}({edge:e,particleStyleColor:wr.color,particleColorBy:wr.colorBy,hasExplicitParticleColorBy:!!xe?.colorBy,getEdgeColor:cn,getNodeColor:Jr,resolveEndpoint:sn,fallback:nn}),[xe?.colorBy,wr.color,wr.colorBy,Jr,cn,nn,sn]),un=function(e,t,r,n,o){return("sankey"===e||t)&&r||n||o}(c,!!Qt,ve,!!Et,Nr.current?.isAnimating??!1);_(Nr,Lr,er,pr),S(Nr,Ut,er,pr),Fe(()=>{const e=Nr.current;e&&(tn(e,[ar,sr]),zr(e=>e+1),pr())},[vr,ar,sr,tn,pr]);const hn=Ye(()=>{const e=Nr.current;if(e&&(e.runLayout([ar,sr]),tn(e,[ar,sr]),zr(e.layoutVersion),dt)){const{nodes:t,edges:r}=e.getLayoutData();dt(t,r)}},[ar,sr,tn,dt]),fn=$e(!1),yn=Ye((e=!1)=>!(!e&&!fn.current||(fn.current=!1,hn(),0)),[hn]),pn=Ye(()=>yn(!1),[yn]),mn=Ye(e=>{const t=Nr.current;if(!t)return!1;let r=!1,n=fn.current;for(const o of e)null!=o&&"object"==typeof o&&(r=!0,t.ingestEdge(o)&&(n=!0));const o=yn(n);return r||o},[yn]),xn=Ye(e=>{if(null==e||"object"!=typeof e)return;const t=Nr.current;t&&(t.ingestEdge(e)&&(fn.current=!0),mr.isActive?pr():pn())},[pn,mr,pr]),kn=Ye(e=>{mn(e)&&pr()},[mn,pr]);Fe(()=>mr.subscribe(()=>{mr.isActive||pn()}),[pn,mr]);const bn=Ye(()=>{fn.current=!1,Nr.current?.clear(),Zr.current.clear(),Ur.current=0,zr(Nr.current?.layoutVersion??0),Wr(null),Kr.current=null,er.current=!0,pr()},[pr]),_n=Ye(()=>{const e=Nr.current;e&&(e.tension+=999,yn(!0),pr())},[yn,pr]);Oe(s,()=>({push:xn,pushMany:kn,removeNode:e=>{const t=Nr.current?.removeNode(e)??!1;if(t){const t=Kr.current?.data?"function"==typeof p?p(Kr.current.data):Kr.current.data[p]:void 0;Kr.current&&"node"===Kr.current.nodeOrEdge&&t===e&&(Kr.current=null,Wr(null)),Zr.current.delete(e)}return yn(t)&&(er.current=!0,pr()),t},removeEdge:(e,t)=>{const r=Nr.current?.removeEdge(e,t)??!1;if(r&&Kr.current&&"edge"===Kr.current.nodeOrEdge){const r=Kr.current.data;let n;n=void 0!==t?("object"==typeof r?.source?r.source.id:r?.source)===e&&("object"==typeof r?.target?r.target.id:r?.target)===t:!D||!r||("function"==typeof D?D:e=>e?.[D])(r)===e,n&&(Kr.current=null,Wr(null))}return yn(r)&&(er.current=!0,pr()),r},updateNode:(e,t)=>{const r=Nr.current?.updateNode(e,t)??null;return yn(null!==r)&&(er.current=!0,pr()),r},updateEdge:(e,t,r)=>{const n=Nr.current?.updateEdge(e,t,r)??[];return yn(n.length>0)&&(er.current=!0,pr()),n},clear:bn,getTopology:()=>(pn(),Nr.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(pn(),Nr.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(pn(),Nr.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{pn();const e=Nr.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:_n,getTension:()=>(pn(),Nr.current?.tension??0)}),[xn,kn,bn,_n,pn,yn,p,pr,D]);const Sn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),Ln=Sn?h||(Array.isArray(d)?void 0:d):void 0;Fe(()=>{const e=Nr.current;if(!e)return;const t=++Hr.current;if(qr.current?.abort(),qr.current=null,Sn&&Ln)fn.current=!1,e.ingestHierarchy(Ln,[ar,sr]),tn(e,[ar,sr]),zr(e.layoutVersion),jr(!1),Gr.current?.("ready"),pr();else{const r=br,n=Array.isArray(_r)?_r:[];if(null==u&&null==d||(fn.current=!1),0===r.length&&0===n.length)return null==u&&null==d||0>=e.nodes.size&&0>=e.edges.size||bn(),jr(!1),void Gr.current?.("ready");const o=[ar,sr],i="force"===c&&!Qt&&An()&&!Tt&&wn(V,r.length,n.length,H);if(i&&kr&&!Vr.current&&e.sceneNodes.length>0)return Vr.current=!0,jr(!1),Gr.current?.("ready"),er.current=!0,void pr();if(i){const i=new AbortController;qr.current=i;const a=e._lastPositionSnapshot;e.ingestBounded(r,n,o,{deferLayout:!0});const s=e.getLayoutData(),c=function(e,t,r,n,o){const i=ur(r.nodeSize,r.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=o?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,r="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,o="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:r,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:o}}),config:{chartType:"force",iterations:r.iterations,forceStrength:r.forceStrength,seed:r.seed},size:n}}(s.nodes,s.edges,Qr.current,o,a);return jr(!0),Gr.current?.("pending"),Pn(c,i.signal).then(({positions:r})=>{t===Hr.current&&(e.applyForceLayoutPositions(r,o),tn(e,o),jr(!1),Gr.current?.("ready"),zr(e.layoutVersion),pr())}).catch(r=>{"AbortError"!==r.name&&t===Hr.current&&(e.runLayout(o),tn(e,o),jr(!1),Gr.current?.("error"),zr(e.layoutVersion),pr())}),()=>i.abort()}e.ingestBounded(r,n,o),tn(e,o),zr(e.layoutVersion),jr(!1),Gr.current?.("ready"),pr()}},[br,_r,u,d,h,Ln,Sn,ar,sr,Er,V,H,kr,c,Qt,Tt,pr,bn,tn]);const En=We.useRef(!1);Fe(()=>{En.current||f&&f.length>0&&(En.current=!0,kn(f))},[f,kn]);const{customHoverBehavior:Dn,customClickBehavior:Rn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:n}){return{customHoverBehavior:Hn((t,o)=>{e?.(t,o),ne({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:qn,chartId:n,context:o})},[e,r,n]),customClickBehavior:Hn((e,o)=>{t?.(e,o),re({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:qn,chartId:n,context:o})},[t,r,n])}}({customHoverBehavior:at,customClickBehavior:st,onObservation:ct,chartId:ut}),{hoverHandlerRef:Mn,hoverLeaveRef:Tn,onPointerMove:zn,onPointerLeave:Fn}=tr,Bn=()=>!Qt||(Nr.current?.hasCustomRestyle??!1);Mn.current=e=>{if(!ot)return;const t=Bn(),r=no.current;if(!r)return;const n=Nr.current;if(!n)return;const o=jn({clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:ir,adjustedWidth:ar,adjustedHeight:sr,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===o.kind?(Kr.current=o.hover,Wr(o.hover),Dn?.(o.hover),t&&pr()):Kr.current&&(Kr.current=null,Wr(null),Dn?.(null),t&&pr())},Tn.current=()=>{if(Kr.current){const e=Bn();Kr.current=null,Wr(null),Dn?.(null),e&&pr()}};const Yn=$e(()=>{});Yn.current=e=>{if(ae(e.target))return;if(!st&&!ct)return;const t=no.current;if(!t)return;const r=Nr.current;if(!r)return;const n=jn({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:ir,adjustedWidth:ar,adjustedHeight:sr,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===n.kind?Rn(n.hover,{type:"activate",inputType:ye(e.nativeEvent.pointerType)}):"miss"===n.kind&&Rn(null)};const On=Ye(e=>Yn.current(e),[]),Xn=$e(-1),Jn=$e(null),eo=$e(-1),to=Ye(e=>{if(se(e))return;const t=Nr.current;if(!t)return;const r=()=>{Xn.current=-1,Jn.current=null,eo.current=-1,Kr.current=null,Wr(null),Dn?.(null),pr()},n=l(t.sceneNodes);if(0===n.length)return void(0>Xn.current||r());const o=i(n);let a=Xn.current;if(o.flat.length>a||(r(),a=-1)," "===e.key&&a>=0){e.preventDefault();const t=o.flat[a];return void Rn?.(Q(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Xn.current=0,eo.current=-1;const t=o.flat[0];Jn.current={shape:t.shape,w:t.w,h:t.h};const r=Q(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Kr.current=r,Wr(r),Dn?.(r,{type:"focus",inputType:"keyboard"}),void pr()}const s=b(o,a),c=g(e.key,s,o,t.sceneEdges??[],eo);if(null===c)return;if(e.preventDefault(),0>c)return void r();Xn.current=c;const u=o.flat[c];Jn.current={shape:u.shape,w:u.w,h:u.h};const d={data:u.datum||{},x:u.x,y:u.y,__semioticHoverData:!0,nodeOrEdge:"node"};Kr.current=d,Wr(d),Dn?.(d,{type:"focus",inputType:"keyboard"}),pr()},[Rn,Dn,pr]),ro=Ye(e=>{Xn.current=-1,Jn.current=null,zn(e)},[zn]);gr.current=()=>{if(yr.current=null,pn(),!mr.isActive)return;const n=no.current;if(!n)return;const o=Nr.current;o&&function(n){const{canvas:o,store:i,sceneRevisionDiagnostics:a,size:s,margin:c,adjustedWidth:l,adjustedHeight:u,background:d,maxDevicePixelRatio:h,renderMode:f,hasBackgroundGraphics:g=!1,dirtyRef:p,resolutionDirtyRef:k,lastFrameTimeRef:b,now:_,random:S,reducedMotion:w,showParticles:A,isContinuous:L,animate:E,decay:P,pulse:D,thresholds:R,staleness:M,particleStyle:N,getParticleColor:T,pendingAnnotationFrameRef:C,lastAnnotationFrameTimeRef:I,setAnnotationFrame:W,scheduleNextFrame:$,syncColorMap:z}=n,F=o.getContext("2d");if(!F)return;const B=b.current?Math.min((_-b.current)/1e3,.1):.016;b.current=_;const Y=i.advanceTransition(w?_+1e6:_),O=!w&&Y,X=!w&&i.tickAnimation([l,u],B),j=p.current,H=a?.beforeCompute(i.getLastUpdateResult(),O),q=Y||j||X;q&&(i.buildScene([l,u]),j&&z?.()),H&&a?.afterCompute(H,q,!1);const V=A&&!w&&!!i.particlePool,G=!!P||!!D||!!R||!1!==E&&i.hasActiveTopologyDiff||i.hasActivePulses||i.hasActiveThresholds,Q=i.consumeStylePaintPending(),K=e({dirtyOrRebuilt:j,transitioning:O,animationTicked:X,continuous:V||L,liveEncoding:G,forced:Q||!0===k?.current});k&&(k.current=!1);const U=!!M&&i.lastIngestTime>0&&_-i.lastIngestTime>(M?.threshold??5e3);if(K){const e=ie(h);if(!me(o,s,c,e))return;if(F.clearRect(-c.left,-c.top,s[0],s[1]),t(F,{background:d,hasBackgroundGraphics:g,width:l,height:u}),P&&i.applyDecay(),D&&i.applyPulse(_),R&&i.applyThresholds(_),!1!==E&&i.applyTopologyDiff(_),U&&(F.globalAlpha=M?.dimOpacity??.5),m({context:F,nodes:i.sceneEdges,renderMode:f,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const r of t)switch(r.type){case"bezier":Cn(e,r);break;case"line":In(e,r);break;case"ribbon":Wn(e,r);break;case"curved":$n(e,r)}}(F,e)}),m({context:F,nodes:i.sceneNodes,renderMode:f,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),ge(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),pe(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),x(e,t),e.restore())}}(F,t),function(e,t){for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),ge(e,t.style,"#007bff",()=>e.fill()),pe(e,t.style,()=>e.stroke()),v(e,t),e.restore())}}(F,t),function(e,t){for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),ge(e,t.style,"#007bff",()=>e.fill()),pe(e,t.style,()=>e.stroke()),e.restore()}}(F,t),r(F,t),y(F,t)}}),V&&!U){const e=i.edgesArray;if(e.length>0){!function(e,t,r,n,o=Math.random){const i=n.spawnRate??.1,a=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const s=t[n];if(!s.bezier)continue;if(e.countForEdge(n)>=a)continue;const c=s.value*i*r*(s.bezier.circular?.3:1),l=Math.floor(c),u=c-l;let d=l;o()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n,o)}}(i.particlePool,e,B,N,S);const t=.5*(N.speedMultiplier??1);let r;if(N.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}i.particlePool.step(B,t,e,r),function(e,t,r,n,o){const i=n.radius??3;e.globalAlpha=n.opacity??.7;for(let a=0;t.particles.length>a;a++){const s=t.particles[a];if(!s.active)continue;const c=r[s.edgeIndex];if(!c)continue;let l;l="string"==typeof n.color&&"inherit"!==n.color?n.color:o(c),e.fillStyle=ke(e,l)||l,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(F,i.particlePool,e,N,T)}}U&&(F.globalAlpha=1)}p.current=!1,(j||O||X)&&o.setAttribute("aria-label",Z(i.sceneNodes?.length??0,i.sceneEdges?.length??0,"Network chart"));const J=j||O||X||C.current;J&&_-I.current>=33?(W(e=>e+1),I.current=_,C.current=!1):C.current=!!J,(L||O||null!=i.transition||X||i.hasActivePulses||i.hasActiveThresholds||!1!==E&&i.hasActiveTopologyDiff||C.current)&&$()}({canvas:n,store:o,sceneRevisionDiagnostics:Tr.current,size:or,margin:ir,adjustedWidth:ar,adjustedHeight:sr,background:rt,maxDevicePixelRatio:nt,renderMode:be,hasBackgroundGraphics:!!At,dirtyRef:er,resolutionDirtyRef:oo,lastFrameTimeRef:Dr,now:mr.now(),random:mr.random,reducedMotion:!!rr.current,showParticles:ve,isContinuous:un,animate:Dt,decay:Lt,pulse:Et,thresholds:$t,staleness:Rt,particleStyle:wr,getParticleColor:ln,pendingAnnotationFrameRef:Mr,lastAnnotationFrameTimeRef:Rr,setAnnotationFrame:Br,scheduleNextFrame:()=>{pr()},syncColorMap:()=>en(o)})};const{canvasRef:no,resolutionDirtyRef:oo}=Pe(tr,{hydrated:xr,wasHydratingFromSSR:kr,storeRef:Nr,dirtyRef:er,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:rn,maxDevicePixelRatio:nt,canvasPaintDependencies:[c,ar,sr,rt,At,be,pr]});A(Rt,Nr,er,pr,Yr,Or);const io=ot&&Ir?Vn(F,{x:Ir.x,y:Ir.y,containerWidth:ar,containerHeight:sr,margin:ir,className:"stream-network-tooltip",zIndex:2,children:it?it(Ir):Vn(Nn,{data:Ir})}):null;if(ce||!xr&&kr)return Vn(vn,{props:o,store:Nr.current,responsiveRef:nr,size:or,margin:ir,adjustedWidth:ar,adjustedHeight:sr,resolvedBackground:lr,resolvedForeground:cr});const ao=Nr.current;return Gn("div",{ref:nr,className:"stream-network-frame"+(tt?" "+tt:""),role:"group","aria-label":Ft||("string"==typeof St?St:"Network chart"),tabIndex:0,"aria-busy":Xr||void 0,style:{position:"relative",width:Ue?"100%":or[0],height:Je?"100%":or[1],overflow:"visible"},onKeyDown:to,children:["production"!==process.env.NODE_ENV&&Nr.current&&Vn(O,{store:Nr.current,diagnostics:Tr.current}),zt&&Vn(j,{tableId:fr}),zt&&Vn(Y,{nodes:ao?.sceneNodes??[],edges:ao?.sceneEdges??[],chartType:"Network chart",tableId:fr,chartTitle:"string"==typeof St?St:void 0}),Vn(X,{summary:Bt}),Vn(W,{hoverPoint:Ir}),Gn("div",{role:"img","aria-label":Ft||("string"==typeof St?St:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ot?ro:void 0,onMouseLeave:ot?Fn:void 0,onClick:st||ct?On:void 0,children:[Xr&&!1!==G&&Vn("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Te(!0,or[0],or[1],G)}),Vn($,{size:or,margin:ir,overflowVisible:!0,children:lr}),Vn("canvas",{ref:no,"aria-label":Z(ao?.sceneNodes?.length??0,ao?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),Vn(dn,{width:ar,height:sr,totalWidth:or[0],totalHeight:or[1],margin:ir,labels:ao?.labels||[],sceneNodes:ao?.sceneNodes,title:St,legend:pt,legendPosition:mt,legendLayout:vt,legendHoverBehavior:xt,legendClickBehavior:kt,legendHighlightedCategory:bt,legendIsolatedCategories:_t,foregroundGraphics:a(cr,P(Nr.current?.customLayoutOverlays,Ut??null)),annotations:ht,onAnnotationActivate:ft,onObservation:lt??ct,chartId:ut,chartType:"StreamNetworkFrame",autoPlaceAnnotations:yt,svgAnnotationRules:gt,annotationFrame:Fr}),Vn(gn,{marks:ao?.customLayoutHtmlMarks,margin:ir,selection:Ut??null}),Vn(B,{active:Xn.current>=0,hoverPoint:Ir,margin:ir,size:or,shape:Jn.current?.shape,width:Jn.current?.w,height:Jn.current?.h}),io,Rt?.showBadge&&Vn(n,{isStale:Yr,position:Rt.badgePosition})]})]})}));Jn.displayName="StreamNetworkFrame";var eo=Jn;export{Ht as buildRibbonGeometry,kn as errorFromPayload,bn as parseModuleWorkerErrorField,_n as ModuleWorkerSession,Sn as createSharedWorkerSessionHolder,wn as shouldUseForceWorker,An as canUseForceWorker,Pn as runForceLayoutWorker,eo as StreamNetworkFrame_default};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{resolveCategoricalPalette as t,resolveExplicitColor as r}from"./chunk-chunk-7ZDJSYKI.module.min.js";function e(r,e,n){return t(r,e,n)}function n(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&r(n,t)||"#4e79a7":e=>{if(n){const t=r(n,e);if(t)return t}let o=0;for(let t=0;e.length>t;t++)o=31*o+e.charCodeAt(t)|0;return t[Math.abs(o)%t.length]??"#4e79a7"}}export{e as resolveCustomLayoutPalette,n as buildResolveColor};
2
+ import{resolveCategoricalPalette as t,resolveExplicitColor as r}from"./chunk-chunk-SK2TQMG4.module.min.js";function e(r,e,n){return t(r,e,n)}function n(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&r(n,t)||"#4e79a7":e=>{if(n){const t=r(n,e);if(t)return t}let o=0;for(let t=0;e.length>t;t++)o=31*o+e.charCodeAt(t)|0;return t[Math.abs(o)%t.length]??"#4e79a7"}}export{e as resolveCustomLayoutPalette,n as buildResolveColor};
@@ -1 +1 @@
1
- import{DARK_THEME as o,HIGH_CONTRAST_THEME as e,LIGHT_THEME as t,ThemeProvider as i,resolveThemePreset as r,resolveThemeUpdate as n,useThemeSelector as c}from"./chunk-chunk-DSNGDNJY.module.min.js";import{useState as s,useEffect as l}from"react";function a(o,e){if("function"==typeof o.addEventListener)return o.addEventListener("change",e),()=>o.removeEventListener("change",e);const t=o;return t.addListener(e),()=>t.removeListener(e)}function d(o){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(o).matches}function u(){const[o,e]=s(()=>d("(prefers-reduced-motion: reduce)"));return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(prefers-reduced-motion: reduce)");return e(o.matches),a(o,o=>e(o.matches))},[]),o}function m(){const[o,e]=s(()=>d("(forced-colors: active)"));return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return e(o.matches),a(o,o=>e(o.matches))},[]),o}import*as f from"react";import{jsx as h,jsxs as p}from"react/jsx-runtime";var y=f.createContext(void 0),g="undefined"==typeof window?f.useEffect:f.useLayoutEffect;function w(o){if("string"!=typeof o)return o;if("light"===o||"dark"===o||"high-contrast"===o)return o;return r(o)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${o}". Falling back to light theme.`),"light")}function v({theme:i}){const r=c(o=>o.setTheme),n=c(o=>o.theme),s=f.useRef(n);s.current=n;const l=f.useRef(null);f.useEffect(()=>{if(void 0!==i)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(l.current=s.current===e?t:s.current,r("high-contrast")),a(n,i=>{i.matches?(l.current=s.current===e?l.current??t:s.current,r("high-contrast")):(function(i,r){i(r===t?"light":r===o?"dark":r===e?"high-contrast":r)}(r,l.current??t),l.current=null)})},[i,r]);const d=f.useRef(!1);return g(()=>{d.current?void 0!==i&&r(w(i)):d.current=!0},[i,r]),null}function b({children:o}){const e=c(o=>o.theme),t={position:"relative","--semiotic-bg":e.colors.background,"--semiotic-text":e.colors.text,"--semiotic-text-secondary":e.colors.textSecondary,"--semiotic-grid":e.colors.grid,"--semiotic-border":e.colors.border,"--semiotic-cell-border":e.colors.cellBorder||e.colors.border,"--semiotic-primary":e.colors.primary,"--semiotic-font-family":e.typography.fontFamily,...e.colors.focus?{"--semiotic-focus":e.colors.focus}:{},...e.tooltip?.background?{"--semiotic-tooltip-bg":e.tooltip.background}:{},...e.tooltip?.text?{"--semiotic-tooltip-text":e.tooltip.text}:{},...e.tooltip?.borderRadius?{"--semiotic-tooltip-radius":e.tooltip.borderRadius}:{},...e.tooltip?.fontSize?{"--semiotic-tooltip-font-size":e.tooltip.fontSize}:{},...e.tooltip?.shadow?{"--semiotic-tooltip-shadow":e.tooltip.shadow}:{},...e.borderRadius?{"--semiotic-border-radius":e.borderRadius}:{},...e.colors.selection?{"--semiotic-selection-color":e.colors.selection}:{},...null!=e.colors.selectionOpacity?{"--semiotic-selection-opacity":e.colors.selectionOpacity+""}:{},...e.colors.diverging?{"--semiotic-diverging":e.colors.diverging}:{},...e.colors.annotation?{"--semiotic-annotation-color":e.colors.annotation}:{},...null!=e.typography.legendSize?{"--semiotic-legend-font-size":e.typography.legendSize+"px"}:{},...null!=e.typography.titleFontSize?{"--semiotic-title-font-size":e.typography.titleFontSize+"px"}:{},...null!=e.typography.tickFontFamily?{"--semiotic-tick-font-family":e.typography.tickFontFamily}:{},...null!=e.typography.tickSize?{"--semiotic-tick-font-size":e.typography.tickSize+"px"}:{},...null!=e.typography.labelSize?{"--semiotic-axis-label-font-size":e.typography.labelSize+"px"}:{},"--semiotic-secondary":e.colors.secondary||e.colors.primary,"--semiotic-surface":e.colors.surface||e.colors.background,...e.colors.success?{"--semiotic-success":e.colors.success}:{},...e.colors.danger?{"--semiotic-danger":e.colors.danger}:{},...e.colors.warning?{"--semiotic-warning":e.colors.warning}:{},...e.colors.error?{"--semiotic-error":e.colors.error}:{},...e.colors.info?{"--semiotic-info":e.colors.info}:{}},i=f.useContext(y),r={};return i&&(r["data-semiotic-theme"]=i),h("div",{style:t,...r,children:o})}function k({theme:o,children:c}){const s="string"==typeof o&&r(o)?o:void 0,l=f.useMemo(()=>function(o){return void 0!==o?n(t,w(o)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?e:t}(o),[o]);return h(i,{initialState:{theme:l},children:p(y.Provider,{value:s,children:[h(v,{theme:o}),h(b,{children:c})]})})}function x(){return c(o=>o.theme)}export{u as useReducedMotion,m as useHighContrast,k as ThemeProviderWrapper,x as useTheme};
1
+ import{DARK_THEME as o,HIGH_CONTRAST_THEME as e,LIGHT_THEME as t,ThemeProvider as i,resolveThemePreset as r,resolveThemeUpdate as n,useThemeSelector as c}from"./chunk-chunk-HADHLMY5.module.min.js";import{useState as s,useEffect as l}from"react";function a(o,e){if("function"==typeof o.addEventListener)return o.addEventListener("change",e),()=>o.removeEventListener("change",e);const t=o;return t.addListener(e),()=>t.removeListener(e)}function d(o){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(o).matches}function u(){const[o,e]=s(()=>d("(prefers-reduced-motion: reduce)"));return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(prefers-reduced-motion: reduce)");return e(o.matches),a(o,o=>e(o.matches))},[]),o}function m(){const[o,e]=s(()=>d("(forced-colors: active)"));return l(()=>{if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return e(o.matches),a(o,o=>e(o.matches))},[]),o}import*as f from"react";import{jsx as h,jsxs as p}from"react/jsx-runtime";var y=f.createContext(void 0),g="undefined"==typeof window?f.useEffect:f.useLayoutEffect;function w(o){if("string"!=typeof o)return o;if("light"===o||"dark"===o||"high-contrast"===o)return o;return r(o)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${o}". Falling back to light theme.`),"light")}function v({theme:i}){const r=c(o=>o.setTheme),n=c(o=>o.theme),s=f.useRef(n);s.current=n;const l=f.useRef(null);f.useEffect(()=>{if(void 0!==i)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(l.current=s.current===e?t:s.current,r("high-contrast")),a(n,i=>{i.matches?(l.current=s.current===e?l.current??t:s.current,r("high-contrast")):(function(i,r){i(r===t?"light":r===o?"dark":r===e?"high-contrast":r)}(r,l.current??t),l.current=null)})},[i,r]);const d=f.useRef(!1);return g(()=>{d.current?void 0!==i&&r(w(i)):d.current=!0},[i,r]),null}function b({children:o}){const e=c(o=>o.theme),t={position:"relative","--semiotic-bg":e.colors.background,"--semiotic-text":e.colors.text,"--semiotic-text-secondary":e.colors.textSecondary,"--semiotic-grid":e.colors.grid,"--semiotic-border":e.colors.border,"--semiotic-cell-border":e.colors.cellBorder||e.colors.border,"--semiotic-primary":e.colors.primary,"--semiotic-font-family":e.typography.fontFamily,...e.colors.focus?{"--semiotic-focus":e.colors.focus}:{},...e.tooltip?.background?{"--semiotic-tooltip-bg":e.tooltip.background}:{},...e.tooltip?.text?{"--semiotic-tooltip-text":e.tooltip.text}:{},...e.tooltip?.borderRadius?{"--semiotic-tooltip-radius":e.tooltip.borderRadius}:{},...e.tooltip?.fontSize?{"--semiotic-tooltip-font-size":e.tooltip.fontSize}:{},...e.tooltip?.shadow?{"--semiotic-tooltip-shadow":e.tooltip.shadow}:{},...e.borderRadius?{"--semiotic-border-radius":e.borderRadius}:{},...e.colors.selection?{"--semiotic-selection-color":e.colors.selection}:{},...null!=e.colors.selectionOpacity?{"--semiotic-selection-opacity":e.colors.selectionOpacity+""}:{},...e.colors.diverging?{"--semiotic-diverging":e.colors.diverging}:{},...e.colors.annotation?{"--semiotic-annotation-color":e.colors.annotation}:{},...null!=e.typography.legendSize?{"--semiotic-legend-font-size":e.typography.legendSize+"px"}:{},...null!=e.typography.titleFontSize?{"--semiotic-title-font-size":e.typography.titleFontSize+"px"}:{},...null!=e.typography.tickFontFamily?{"--semiotic-tick-font-family":e.typography.tickFontFamily}:{},...null!=e.typography.tickSize?{"--semiotic-tick-font-size":e.typography.tickSize+"px"}:{},...null!=e.typography.labelSize?{"--semiotic-axis-label-font-size":e.typography.labelSize+"px"}:{},"--semiotic-secondary":e.colors.secondary||e.colors.primary,"--semiotic-surface":e.colors.surface||e.colors.background,...e.colors.success?{"--semiotic-success":e.colors.success}:{},...e.colors.danger?{"--semiotic-danger":e.colors.danger}:{},...e.colors.warning?{"--semiotic-warning":e.colors.warning}:{},...e.colors.error?{"--semiotic-error":e.colors.error}:{},...e.colors.info?{"--semiotic-info":e.colors.info}:{}},i=f.useContext(y),r={};return i&&(r["data-semiotic-theme"]=i),h("div",{style:t,...r,children:o})}function k({theme:o,children:c}){const s="string"==typeof o&&r(o)?o:void 0,l=f.useMemo(()=>function(o){return void 0!==o?n(t,w(o)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?e:t}(o),[o]);return h(i,{initialState:{theme:l},children:p(y.Provider,{value:s,children:[h(v,{theme:o}),h(b,{children:c})]})})}function x(){return c(o=>o.theme)}export{u as useReducedMotion,m as useHighContrast,k as ThemeProviderWrapper,x as useTheme};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{addMqlListener as e}from"./chunk-chunk-YHNZCPOZ.module.min.js";import{createContext as o,useCallback as r,useContext as t,useMemo as a,useRef as i,useSyncExternalStore as c}from"react";import{jsx as s}from"react/jsx-runtime";function n(e){let n=null;const d=()=>(n||(n=o(null)),n),f=l(e);return[function({children:o,initialState:r}){const t=i(r),c=a(()=>l(e,t.current),[]),n=d();return s(n.Provider,{value:c,children:o})},(e,o)=>{const a=d(),s=t(a)??f,n=i(e);n.current=e;const l=i({hasValue:!1,value:void 0}),u=r(()=>{const e=n.current(s.getState()),r=l.current;return r.hasValue&&o&&o(r.value,e)?r.value:(l.current={hasValue:!0,value:e},e)},[s,o]),p=r(()=>n.current(s.getState()),[s]);return c(s.subscribe,u,p)}]}function l(e,o){const r=new Set;let t={...e(function(e){const o=e(t);if(d(o)){t={...t,...o};for(const e of r)e()}}),...o??{}};return{getState:()=>t,subscribe:function(e){return r.add(e),()=>{r.delete(e)}}}}function d(e){for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o))return!0;return!1}function f(e){if(!e?.colors)return;const o=e.colors;return{primary:o.primary,secondary:o.secondary||o.primary,surface:o.surface||o.background,success:o.success,danger:o.danger,warning:o.warning,error:o.error,info:o.info,text:o.text,textSecondary:o.textSecondary,border:o.border,grid:o.grid}}function u(e){if(!e.accessibility)return e;let o=e;if(e.accessibility.colorBlindSafe&&(o={...o,colors:{...o.colors,categorical:p}}),e.accessibility.highContrast){const e="dark"===o.mode;o={...o,colors:{...o.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return o}var p=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],g={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},y={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},b={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:p,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 m(e,o){if("light"===o)return g;if("dark"===o)return y;if("high-contrast"===o)return b;if("string"==typeof o)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${o}". Keeping current theme.`),e;if(o.mode&&"auto"!==o.mode){const e="dark"===o.mode?y:g;return u({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}return u({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}var[h,x]=n(e=>({theme:g,setTheme(o){e(e=>({theme:m(e.theme,o)}))}}));function S(e,o=":root"){const r=[];return r.push(` --semiotic-bg: ${e.colors.background};`),r.push(` --semiotic-text: ${e.colors.text};`),r.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),r.push(` --semiotic-grid: ${e.colors.grid};`),r.push(` --semiotic-border: ${e.colors.border};`),r.push(` --semiotic-primary: ${e.colors.primary};`),r.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&r.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&r.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&r.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&r.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&r.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&r.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&r.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&r.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&r.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&r.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&r.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&r.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&r.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&r.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&r.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&r.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),r.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),r.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&r.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&r.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&r.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&r.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&r.push(` --semiotic-info: ${e.colors.info};`),`${o} {\n${r.join("\n")}\n}`}function k(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var $=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],z={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},v={light:g,dark:y,"high-contrast":b,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function w(e){return v[e]}import*as F from"react";import{jsx as R,jsxs as q}from"react/jsx-runtime";var B=F.createContext(void 0),C="undefined"==typeof window?F.useEffect:F.useLayoutEffect;function M(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return w(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function N({theme:o}){const r=x(e=>e.setTheme),t=x(e=>e.theme),a=F.useRef(t);a.current=t;const i=F.useRef(null);F.useEffect(()=>{if(void 0!==o)return;if("undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(forced-colors: active)");return t.matches&&(i.current=a.current===b?g:a.current,r("high-contrast")),e(t,e=>{e.matches?(i.current=a.current===b?i.current??g:a.current,r("high-contrast")):(function(e,o){e(o===g?"light":o===y?"dark":o===b?"high-contrast":o)}(r,i.current??g),i.current=null)})},[o,r]);const c=F.useRef(!1);return C(()=>{c.current?void 0!==o&&r(M(o)):c.current=!0},[o,r]),null}function O({children:e}){const o=x(e=>e.theme),r={position:"relative","--semiotic-bg":o.colors.background,"--semiotic-text":o.colors.text,"--semiotic-text-secondary":o.colors.textSecondary,"--semiotic-grid":o.colors.grid,"--semiotic-border":o.colors.border,"--semiotic-cell-border":o.colors.cellBorder||o.colors.border,"--semiotic-primary":o.colors.primary,"--semiotic-font-family":o.typography.fontFamily,...o.colors.focus?{"--semiotic-focus":o.colors.focus}:{},...o.tooltip?.background?{"--semiotic-tooltip-bg":o.tooltip.background}:{},...o.tooltip?.text?{"--semiotic-tooltip-text":o.tooltip.text}:{},...o.tooltip?.borderRadius?{"--semiotic-tooltip-radius":o.tooltip.borderRadius}:{},...o.tooltip?.fontSize?{"--semiotic-tooltip-font-size":o.tooltip.fontSize}:{},...o.tooltip?.shadow?{"--semiotic-tooltip-shadow":o.tooltip.shadow}:{},...o.borderRadius?{"--semiotic-border-radius":o.borderRadius}:{},...o.colors.selection?{"--semiotic-selection-color":o.colors.selection}:{},...null!=o.colors.selectionOpacity?{"--semiotic-selection-opacity":o.colors.selectionOpacity+""}:{},...o.colors.diverging?{"--semiotic-diverging":o.colors.diverging}:{},...o.colors.annotation?{"--semiotic-annotation-color":o.colors.annotation}:{},...null!=o.typography.legendSize?{"--semiotic-legend-font-size":o.typography.legendSize+"px"}:{},...null!=o.typography.titleFontSize?{"--semiotic-title-font-size":o.typography.titleFontSize+"px"}:{},...null!=o.typography.tickFontFamily?{"--semiotic-tick-font-family":o.typography.tickFontFamily}:{},...null!=o.typography.tickSize?{"--semiotic-tick-font-size":o.typography.tickSize+"px"}:{},...null!=o.typography.labelSize?{"--semiotic-axis-label-font-size":o.typography.labelSize+"px"}:{},"--semiotic-secondary":o.colors.secondary||o.colors.primary,"--semiotic-surface":o.colors.surface||o.colors.background,...o.colors.success?{"--semiotic-success":o.colors.success}:{},...o.colors.danger?{"--semiotic-danger":o.colors.danger}:{},...o.colors.warning?{"--semiotic-warning":o.colors.warning}:{},...o.colors.error?{"--semiotic-error":o.colors.error}:{},...o.colors.info?{"--semiotic-info":o.colors.info}:{}},t=F.useContext(B),a={};return t&&(a["data-semiotic-theme"]=t),R("div",{style:r,...a,children:e})}function P({theme:e,children:o}){const r="string"==typeof e&&w(e)?e:void 0,t=F.useMemo(()=>function(e){return void 0!==e?m(g,M(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?b:g}(e),[e]);return R(h,{initialState:{theme:t},children:q(B.Provider,{value:r,children:[R(N,{theme:e}),R(O,{children:o})]})})}function j(){return x(e=>e.theme)}export{n as createStore,d as hasOwnEnumerableKey,f as resolveThemeSemanticColors,p as COLOR_BLIND_SAFE_CATEGORICAL,g as LIGHT_THEME,y as DARK_THEME,b as HIGH_CONTRAST_THEME,x as useThemeSelector,S as themeToCSS,k as themeToTokens,$ as CARBON_CATEGORICAL_14,z as CARBON_ALERT,v as THEME_PRESETS,w as resolveThemePreset,P as ThemeProviderWrapper,j as useTheme};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{resolveCSSColor as t,resolveCanvasFill as l,symbolPathString as e}from"./chunk-chunk-SK2TQMG4.module.min.js";var o=new Map;function r(r,s,a,n,i,y){if(0>=s.size)return;const c=function(t,l,r){try{if(r)return new Path2D(r);const s=`${t??"circle"}:${Math.round(l)}`;let a=o.get(s);return a||(a=new Path2D(e(t,l)),o.size>256&&o.clear(),o.set(s,a)),a}catch{return null}}(s.symbolType,s.size,s.path);if(!c)return;r.save(),r.translate(a,n),s.rotation&&r.rotate(s.rotation);const f=(s.style.opacity??1)*(s._decayOpacity??1);s.style.fill&&(r.globalAlpha=i*f*(s.style.fillOpacity??1),r.fillStyle=l(r,s.style.fill,y),r.fill(c)),s.style.stroke&&"none"!==s.style.stroke&&(r.globalAlpha=i*f,r.strokeStyle=t(r,s.style.stroke)||s.style.stroke,r.lineWidth=s.style.strokeWidth??1,r.stroke(c)),r.restore()}var s=(t,l)=>{const e=t.globalAlpha;for(const o of l)"symbol"===o.type&&r(t,o,o.x,o.y,e,"#4e79a7");t.globalAlpha=e};function a(t,l){const e=t.globalAlpha;for(const o of l)"symbol"===o.type&&r(t,o,o.cx,o.cy,e,"#007bff");t.globalAlpha=e}export{s as symbolCanvasRenderer,a as networkSymbolRenderer};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{StreamXYFrame_default as e}from"./chunk-chunk-FSIHAW6L.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-DVCWU7MT.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-SK2TQMG4.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function v(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var g=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as x,useCallback as y,useState as b,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function R(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function z(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function I(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=R(o,t,"time"),a=R(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),z(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),z(a)]})]})}}function P(e,t){return null!=e?e:Math.max(t?.length??0,200)}var C="time",T="value",M="__aggLower",F="__aggUpper",D="__aggPartial",N="count",E="__aggStart",B="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[C]:(e.start+e.end)/2,[T]:m(e,n),[N]:e.count,[D]:e.partial,[E]:e.start,[B]:e.end},o=h(e,i,n,s);return o&&(t[M]=o[0],t[F]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=x(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:x,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:R,extentPadding:z,stroke:D="#007bff",strokeWidth:N=2,strokeDasharray:E,opacity:B,background:W,tooltipContent:V,tooltip:$,onHover:q,annotations:U,autoPlaceAnnotations:X,svgAnnotationRules:Y,tickFormatTime:G,tickFormatValue:K,decay:Q,pulse:J,staleness:Z,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ve=c??[s.width,s.height],ge=V??$??I({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),xe=y(e=>{q&&q(e),we(e)},[q,we]),ye=null!=ue,[be,Ae]=b([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(ye);He.current=ye;const Se=f(be);Se.current=be;const Re=f({timeAccessor:k,valueAccessor:H});Re.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!ye)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=v("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?v(e.hop):void 0,s=null!=e.gap?v(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=Re.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[ye?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",ye,_]),A(()=>{ye&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const ze=y(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=Re.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ie=null!=me,Pe=f(null),Ce=f(me);Ce.current=me;const Te=f(Ie);Te.current=Ie;const Me=f(ie);Me.current=ie;const Fe=f(se);Fe.current=se,A(()=>{Pe.current=Ie?function(e){const t=v(e.lateness);return null==t?null:new g({lateness:t,getTime:e=>L(e,Re.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Ce.current):null},[Ie?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ie]);const De=y(e=>{0!==e.length&&(He.current?ze(e):fe.current?.pushMany(e))},[ze]),Ne=y(e=>{const t=Pe.current;if(!Te.current||!t)return void De(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Me.current;if(n){const{timeAccessor:i}=Re.current,s=Ce.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Fe.current})}}}De(n)},[De]);w(i,()=>({push:e=>Ne([e]),pushMany:e=>Ne(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Pe.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[Ne]);const Ee=l(oe,ve[0],ve[1],re),Be=Ee?null:a(ye?void 0:_,ve[0],ve[1],ae),Oe={stroke:D,strokeWidth:N,strokeDasharray:E};null!=B&&(Oe.opacity=B);const je=P(x,_),Le=ye?be:_,We=ye?C:k,Ve=ye?T:H,$e=ye&&ue&&"none"!==(ue.band??"none")?{y0Accessor:M,y1Accessor:F,perSeries:!1}:void 0;return Ee||Be||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ve,maxDevicePixelRatio:n.maxDevicePixelRatio,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:ye?"growing":p,windowSize:ye?Math.max(1,ue?.retain??Math.max(be.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:R,extentPadding:z,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ge,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:xe}),annotations:U,autoPlaceAnnotations:X,svgAnnotationRules:Y,tickFormatTime:G,tickFormatValue:K,decay:Q,pulse:J,staleness:Z,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as q,useCallback as U,useMemo as X}from"react";function Y(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as G}from"react/jsx-runtime";var K=q(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:v,arrowOfTime:g="right",windowMode:f="sliding",windowSize:w,data:x,timeAccessor:y,valueAccessor:b,direction:A="up",timeExtent:I,valueExtent:C,extentPadding:T,categoryAccessor:M,colors:F,fill:D,stroke:N,strokeWidth:E,opacity:B,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:q,annotations:K,autoPlaceAnnotations:Q,svgAnnotationRules:J,tickFormatTime:Z,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ve,onBrush:ge,linkedBrush:fe}=c,we=m.showAxes,xe=m.enableHover,ye=d??[m.width,m.height],be=X(()=>F?e=>F[e]??D??"#999":void 0,[F,D]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:x??[],colorBy:M,colorScale:be,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe,chartWidth:ye[0],axisChrome:{hasAxis:!1!==m.showAxes}}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=R(i,t,"time"),s=R(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),z(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),z(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),z(i.binStart),"–",z(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),z(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),z(i.category)]})]})}}({timeAccessor:y,valueAccessor:b}),Se=V(null),{customHoverBehavior:Re}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),ze=U(e=>{q&&q(e),Re(e)},[q,Re]),Ie=!0===ve?{dimension:"x",snap:"bin"}:"x"===ve?{dimension:"x"}:"object"==typeof ve?ve:void 0,Pe=n(fe),Ce="string"==typeof y?y:"time",Te=i({name:Pe?.name||"__unused_hist_brush__",xField:Pe?.xField||Ce,...Pe?.yField?{yField:Pe.yField}:{}}),Me=V(Te.brushInteraction);Me.current=Te.brushInteraction;const Fe=U(e=>{if(ge&&ge(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Pe){const t=Me.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ge,ae,le,Pe]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const De=l(ce,ye[0],ye[1],ue),Ne=De?null:a(x,ye[0],ye[1],me),Ee={};null!=D&&(Ee.fill=D),null!=N&&(Ee.stroke=N),null!=E&&(Ee.strokeWidth=E),null!=B&&(Ee.opacity=B),null!=O&&(Ee.gap=O);const Be=he?`${v||""} semiotic-emphasis-${he}`.trim():v,Oe=P(w,x),je=X(()=>"down"!==A?C:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=Y(s,n,"time"),o=Y(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:x,valueAccessor:b,timeAccessor:y,binSize:h,valueExtent:C,extentPadding:T}),[A,x,b,y,h,C,T]);return De||Ne||G(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:ye,maxDevicePixelRatio:c.maxDevicePixelRatio,margin:_e,className:Be,arrowOfTime:g,windowMode:f,windowSize:Oe,data:x,timeAccessor:y,valueAccessor:b,xExtent:I,yExtent:je,extentPadding:T,binSize:h,categoryAccessor:M,barColors:F,barStyle:Ee,showAxes:we,background:j,hoverAnnotation:xe,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:ze}),annotations:K,autoPlaceAnnotations:Q,svgAnnotationRules:J,tickFormatTime:Z,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ie||(fe?{dimension:"x"}:void 0),onBrush:Ie||fe?Fe:void 0})});function Q(e){return G(K,{...e,windowMode:"growing"})}K.displayName="RealtimeHistogram",Q.displayName="TemporalHistogram";var J=K;import{useRef as Z,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:v,timeAccessor:g,valueAccessor:f,timeExtent:w,valueExtent:x,yScaleType:y,extentPadding:b,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:R,strokeWidth:z,pointStyle:C,background:T,tooltipContent:M,tooltip:F,onHover:D,annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:q,loadingContent:U,emptyContent:X,emphasis:Y,legendPosition:G}=n,K=s.showAxes,Q=s.enableHover,J=u??s.marginDefaults,te=c??[s.width,s.height],se=M??F??I({timeAccessor:g,valueAccessor:f}),oe=Z(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{D&&D(e),re(e)},[D,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(q,te[0],te[1],U),ce=le?null:a(v,te[0],te[1],X),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=R&&(ue.stroke=R),null!=z&&(ue.strokeWidth=z);const me=C,he=Y?`${m||""} semiotic-emphasis-${Y}`.trim():m,de=P(p,v);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,maxDevicePixelRatio:n.maxDevicePixelRatio,margin:J,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:v,timeAccessor:g,valueAccessor:f,xExtent:w,yExtent:x,yScaleType:y,extentPadding:b,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:K,background:T,hoverAnnotation:Q,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,legendPosition:G,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:v,timeAccessor:g,valueAccessor:f,timeExtent:w,valueExtent:x,extentPadding:y,positiveColor:b,negativeColor:A,connectorStroke:I,connectorWidth:C,gap:T,stroke:M,strokeWidth:F,opacity:D,background:N,tooltipContent:E,tooltip:B,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:q,selection:U,onObservation:X,chartId:Y,loading:G,loadingContent:K,emptyContent:Q,emphasis:J,legendPosition:Z}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=E??B??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=R(i,t,"time"),o=i?.delta??R(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?z(o):"+"+z(o):z(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),z(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),z(r)]})]})}}({timeAccessor:g,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:U,linkedHover:q,unwrapData:!0,onObservation:X,chartType:"RealtimeWaterfallChart",chartId:Y}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(G,ie[0],ie[1],K),de=he?null:a(v,ie[0],ie[1],Q),pe={};null!=b&&(pe.positiveColor=b),null!=A&&(pe.negativeColor=A),null!=I&&(pe.connectorStroke=I),null!=C&&(pe.connectorWidth=C),null!=T&&(pe.gap=T),null!=M&&(pe.stroke=M),null!=F&&(pe.strokeWidth=F),null!=D&&(pe.opacity=D);const ve=J?`${m||""} semiotic-emphasis-${J}`.trim():m,ge=P(p,v);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,maxDevicePixelRatio:n.maxDevicePixelRatio,margin:ne,className:ve,arrowOfTime:h,windowMode:d,windowSize:ge,data:v,timeAccessor:g,valueAccessor:f,xExtent:w,yExtent:x,extentPadding:y,waterfallStyle:pe,showAxes:ee,background:N,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:q,selection:U,onObservation:X,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Z,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ve}from"react/jsx-runtime";var ge=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:v,timeAccessor:g,valueAccessor:f,categoryAccessor:w,timeExtent:x,valueExtent:y,extentPadding:b,heatmapXBins:A=20,heatmapYBins:I=20,aggregation:C="count",background:T,tooltipContent:M,tooltip:F,onHover:D,annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:q,onObservation:U,chartId:X,loading:Y,loadingContent:G,emptyContent:K,emphasis:Q,legendPosition:J}=n,Z=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=M??F??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??R(o,t,"time"),a=o?.yCenter??R(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),z(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),z(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),z(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),z(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),z(u)]})]})}}({timeAccessor:g,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:q,linkedHover:$,unwrapData:!0,onObservation:U,chartType:"RealtimeHeatmap",chartId:X}),re=pe(e=>{D&&D(e),oe(e)},[D,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(Y,ne[0],ne[1],G),le=ae?null:a(v,ne[0],ne[1],K),ce=Q?`${m||""} semiotic-emphasis-${Q}`.trim():m,ue=P(p,v);return ae||le||ve(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,maxDevicePixelRatio:n.maxDevicePixelRatio,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:v,timeAccessor:g,valueAccessor:f,categoryAccessor:w,xExtent:x,yExtent:y,extentPadding:b,heatmapXBins:A,heatmapYBins:I,heatmapAggregation:C,showAxes:Z,background:T,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:q,onObservation:U,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});ge.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,v as parseWindowDuration,g as ReorderBuffer,W as RealtimeLineChart,K as RealtimeHistogram,Q as TemporalHistogram,J as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ge as RealtimeHeatmap};