semiotic 3.7.5 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (575) hide show
  1. package/CLAUDE.md +63 -18
  2. package/README.md +121 -27
  3. package/agent-skill/semiotic-charts/SKILL.md +146 -0
  4. package/ai/cli.js +133 -45
  5. package/ai/componentMetadata.cjs +6 -1
  6. package/ai/dist/mcp-server.js +1741 -163
  7. package/ai/examples.md +174 -0
  8. package/ai/schema.json +2733 -536
  9. package/ai/surface-manifest.json +201 -0
  10. package/ai/system-prompt.md +20 -4
  11. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  12. package/dist/components/AccessibleNavTree.d.ts +7 -1
  13. package/dist/components/CategoryColors.d.ts +1 -1
  14. package/dist/components/ChartContainer.d.ts +91 -0
  15. package/dist/components/ChartGrid.d.ts +11 -1
  16. package/dist/components/CircularBrush.d.ts +61 -0
  17. package/dist/components/ContextLayout.d.ts +5 -1
  18. package/dist/components/DirectManipulationControl.d.ts +63 -0
  19. package/dist/components/LinkedCharts.d.ts +3 -1
  20. package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
  21. package/dist/components/MobileChartContainer.d.ts +51 -0
  22. package/dist/components/MobileStandardControls.d.ts +68 -0
  23. package/dist/components/SmallMultipleChart.d.ts +84 -0
  24. package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
  25. package/dist/components/ai/ChartRecipe.d.ts +16 -0
  26. package/dist/components/ai/IntentMark.d.ts +15 -0
  27. package/dist/components/ai/chartCapabilities.d.ts +8 -1
  28. package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
  29. package/dist/components/ai/chartClinic.d.ts +91 -0
  30. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  31. package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
  32. package/dist/components/ai/chartRecipes.d.ts +278 -0
  33. package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
  34. package/dist/components/ai/describeChart.d.ts +7 -0
  35. package/dist/components/ai/describeRecipeChart.d.ts +16 -0
  36. package/dist/components/ai/generativeChart.d.ts +28 -3
  37. package/dist/components/ai/intentManifest.d.ts +62 -0
  38. package/dist/components/ai/navigationTree.d.ts +3 -0
  39. package/dist/components/ai/observedSceneAudit.d.ts +72 -0
  40. package/dist/components/ai/readerGrounding.d.ts +83 -0
  41. package/dist/components/ai/recipeCapability.d.ts +8 -0
  42. package/dist/components/ai/recipeNavigation.d.ts +13 -0
  43. package/dist/components/ai/recipeSemantics.d.ts +11 -0
  44. package/dist/components/ai/repairChartConfig.d.ts +9 -0
  45. package/dist/components/ai/suggestCharts.d.ts +11 -1
  46. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  47. package/dist/components/chartContainerMobile.d.ts +9 -0
  48. package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
  49. package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
  50. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
  51. package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
  52. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  53. package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
  54. package/dist/components/charts/geo/FlowMap.d.ts +11 -7
  55. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
  56. package/dist/components/charts/geo/index.d.ts +2 -0
  57. package/dist/components/charts/index.d.ts +35 -1
  58. package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
  59. package/dist/components/charts/network/CirclePack.d.ts +1 -1
  60. package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -5
  61. package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
  62. package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
  63. package/dist/components/charts/network/SankeyDiagram.d.ts +10 -2
  64. package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
  65. package/dist/components/charts/network/Treemap.d.ts +1 -1
  66. package/dist/components/charts/network/useForceLayout.d.ts +17 -0
  67. package/dist/components/charts/ordinal/BarChart.d.ts +22 -1
  68. package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
  69. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  70. package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
  71. package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
  72. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +12 -1
  73. package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
  74. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  75. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +12 -1
  77. package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
  78. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
  79. package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
  80. package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
  81. package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
  82. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +54 -0
  83. package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
  84. package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
  85. package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
  86. package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -0
  87. package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
  88. package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
  89. package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
  90. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
  91. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +99 -0
  92. package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
  93. package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -0
  94. package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
  95. package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
  96. package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
  97. package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
  98. package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
  99. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
  100. package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
  101. package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
  102. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
  103. package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
  104. package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
  105. package/dist/components/charts/physics/gauntletController.d.ts +73 -0
  106. package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
  107. package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
  108. package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
  109. package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
  110. package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
  111. package/dist/components/charts/physics/physicsChartShared.d.ts +57 -0
  112. package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
  113. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  114. package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
  115. package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
  116. package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
  117. package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
  118. package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
  119. package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
  120. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
  121. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
  122. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
  123. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
  124. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
  125. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  126. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  127. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  128. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  129. package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
  130. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
  131. package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
  132. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  133. package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
  134. package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
  135. package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
  136. package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
  137. package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
  138. package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
  139. package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
  140. package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
  141. package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
  142. package/dist/components/charts/shared/colorContrast.d.ts +3 -0
  143. package/dist/components/charts/shared/colorUtils.d.ts +16 -1
  144. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  145. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -0
  146. package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
  147. package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
  148. package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
  149. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  150. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  151. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  152. package/dist/components/charts/shared/hooks.d.ts +34 -10
  153. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  154. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  155. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  156. package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
  157. package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
  158. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  159. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  160. package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
  161. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  162. package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
  163. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  164. package/dist/components/charts/shared/types.d.ts +58 -7
  165. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  166. package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
  167. package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
  168. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  169. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  170. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
  171. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  172. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
  173. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
  174. package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
  175. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  176. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  177. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  178. package/dist/components/charts/shared/validationMap.d.ts +7 -9
  179. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  180. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  181. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  182. package/dist/components/charts/value/types.d.ts +5 -6
  183. package/dist/components/charts/xy/AreaChart.d.ts +9 -1
  184. package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
  185. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  186. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  187. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  188. package/dist/components/charts/xy/LineChart.d.ts +12 -1
  189. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  190. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
  191. package/dist/components/charts/xy/QuadrantChart.d.ts +8 -1
  192. package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
  193. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
  194. package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
  195. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  196. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  197. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  198. package/dist/components/controls/controlAudit.d.ts +24 -0
  199. package/dist/components/controls/controlContract.d.ts +57 -0
  200. package/dist/components/data/fromFlintChart.d.ts +74 -0
  201. package/dist/components/data/fromVegaLite.d.ts +46 -9
  202. package/dist/components/data/portability/index.d.ts +6 -3
  203. package/dist/components/data/portability/result.d.ts +52 -0
  204. package/dist/components/data/portability/spec.d.ts +31 -0
  205. package/dist/components/data/portability/vegaLite.d.ts +24 -6
  206. package/dist/components/export/chartConfig.d.ts +11 -0
  207. package/dist/components/realtime/types.d.ts +11 -0
  208. package/dist/components/recipes/annotationLayout.d.ts +29 -0
  209. package/dist/components/recipes/axisFixedForce.d.ts +119 -0
  210. package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
  211. package/dist/components/recipes/cyclical.d.ts +39 -0
  212. package/dist/components/recipes/edgeRouter.d.ts +103 -0
  213. package/dist/components/recipes/forceLayout.d.ts +48 -0
  214. package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
  215. package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
  216. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
  217. package/dist/components/recipes/gofishIR.d.ts +178 -132
  218. package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
  219. package/dist/components/recipes/intervalLanes.d.ts +87 -0
  220. package/dist/components/recipes/intervals.d.ts +80 -0
  221. package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
  222. package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
  223. package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
  224. package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
  225. package/dist/components/recipes/networkAnalysis.d.ts +102 -0
  226. package/dist/components/recipes/networkLayouts.d.ts +83 -0
  227. package/dist/components/recipes/physics.d.ts +122 -0
  228. package/dist/components/recipes/physicsReference.d.ts +102 -0
  229. package/dist/components/recipes/processAggregates.d.ts +32 -0
  230. package/dist/components/recipes/processChrome.d.ts +67 -0
  231. package/dist/components/recipes/processJourney.d.ts +54 -0
  232. package/dist/components/recipes/processPhysics.d.ts +300 -0
  233. package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
  234. package/dist/components/recipes/radialCoords.d.ts +69 -0
  235. package/dist/components/recipes/random.d.ts +2 -0
  236. package/dist/components/recipes/recipeChrome.d.ts +91 -0
  237. package/dist/components/recipes/recipeGlyph.d.ts +42 -0
  238. package/dist/components/recipes/recipeLegend.d.ts +53 -1
  239. package/dist/components/recipes/recipeUtils.d.ts +52 -0
  240. package/dist/components/recipes/runs.d.ts +59 -0
  241. package/dist/components/recipes/tokenEncoding.d.ts +157 -0
  242. package/dist/components/recipes/tokenLayer.d.ts +79 -0
  243. package/dist/components/recipes/unitize.d.ts +108 -0
  244. package/dist/components/recipes/vector.d.ts +28 -0
  245. package/dist/components/recipes/waffle.d.ts +43 -0
  246. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  247. package/dist/components/semiotic-ai-core.d.ts +47 -0
  248. package/dist/components/semiotic-ai.d.ts +53 -9
  249. package/dist/components/semiotic-controls.d.ts +20 -0
  250. package/dist/components/semiotic-experimental.d.ts +38 -9
  251. package/dist/components/semiotic-geo.d.ts +15 -0
  252. package/dist/components/semiotic-network.d.ts +15 -0
  253. package/dist/components/semiotic-ordinal.d.ts +14 -0
  254. package/dist/components/semiotic-physics-matter.d.ts +10 -0
  255. package/dist/components/semiotic-physics-rapier.d.ts +9 -0
  256. package/dist/components/semiotic-physics.d.ts +60 -0
  257. package/dist/components/semiotic-realtime-core.d.ts +34 -0
  258. package/dist/components/semiotic-realtime-react.d.ts +10 -0
  259. package/dist/components/semiotic-realtime.d.ts +4 -30
  260. package/dist/components/semiotic-recipes-core.d.ts +92 -0
  261. package/dist/components/semiotic-recipes-react.d.ts +7 -0
  262. package/dist/components/semiotic-recipes.d.ts +4 -43
  263. package/dist/components/semiotic-rough.d.ts +4 -0
  264. package/dist/components/semiotic-server-edge.d.ts +8 -0
  265. package/dist/components/semiotic-server-node.d.ts +5 -0
  266. package/dist/components/semiotic-server.d.ts +2 -2
  267. package/dist/components/semiotic-themes-core.d.ts +53 -0
  268. package/dist/components/semiotic-themes-react.d.ts +4 -0
  269. package/dist/components/semiotic-themes.d.ts +6 -76
  270. package/dist/components/semiotic-utils-core.d.ts +50 -0
  271. package/dist/components/semiotic-utils-react.d.ts +5 -0
  272. package/dist/components/semiotic-utils.d.ts +3 -39
  273. package/dist/components/semiotic-xy.d.ts +12 -0
  274. package/dist/components/semiotic.d.ts +44 -8
  275. package/dist/components/server/animatedGif.d.ts +36 -0
  276. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  277. package/dist/components/server/renderEvidence.d.ts +1 -1
  278. package/dist/components/server/renderToStaticSVG.d.ts +3 -35
  279. package/dist/components/server/serverChartConfigShared.d.ts +21 -0
  280. package/dist/components/server/serverChartConfigs.d.ts +22 -12
  281. package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
  282. package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
  283. package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
  284. package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
  285. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  286. package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
  287. package/dist/components/server/staticAnnotations.d.ts +6 -3
  288. package/dist/components/server/staticGeo.d.ts +4 -0
  289. package/dist/components/server/staticLegend.d.ts +2 -2
  290. package/dist/components/server/staticNetwork.d.ts +8 -0
  291. package/dist/components/server/staticOrdinal.d.ts +11 -0
  292. package/dist/components/server/staticPhysics.d.ts +3 -0
  293. package/dist/components/server/staticSVGChrome.d.ts +110 -0
  294. package/dist/components/server/staticXY.d.ts +4 -0
  295. package/dist/components/store/ObservationStore.d.ts +23 -2
  296. package/dist/components/store/themeSerialization.d.ts +32 -0
  297. package/dist/components/store/useChartInterrogation.d.ts +9 -0
  298. package/dist/components/stream/AccessibleDataTable.d.ts +7 -23
  299. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  300. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  301. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  302. package/dist/components/stream/FocusRing.d.ts +4 -2
  303. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  304. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  305. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  306. package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
  307. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  308. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  309. package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
  310. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  311. package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
  312. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  313. package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
  314. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  315. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  316. package/dist/components/stream/ParticlePool.d.ts +1 -1
  317. package/dist/components/stream/PipelineStore.d.ts +81 -174
  318. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  319. package/dist/components/stream/SceneGraph.d.ts +12 -4
  320. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  321. package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
  322. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  323. package/dist/components/stream/StreamXYFrame.d.ts +2 -18
  324. package/dist/components/stream/accessibleDataRows.d.ts +33 -0
  325. package/dist/components/stream/accessorUtils.d.ts +25 -12
  326. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  327. package/dist/components/stream/brushAccessibility.d.ts +25 -0
  328. package/dist/components/stream/canvasBackground.d.ts +24 -0
  329. package/dist/components/stream/canvasSetup.d.ts +4 -1
  330. package/dist/components/stream/customLayoutFailure.d.ts +33 -0
  331. package/dist/components/stream/customLayoutPalette.d.ts +19 -9
  332. package/dist/components/stream/frameGraphics.d.ts +4 -0
  333. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  334. package/dist/components/stream/frameThemeColors.d.ts +24 -0
  335. package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
  336. package/dist/components/stream/geoCartogram.d.ts +17 -0
  337. package/dist/components/stream/geoCustomLayout.d.ts +59 -0
  338. package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
  339. package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
  340. package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
  341. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  342. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  343. package/dist/components/stream/geoTypes.d.ts +97 -15
  344. package/dist/components/stream/glyphDef.d.ts +98 -0
  345. package/dist/components/stream/hitTarget.d.ts +170 -0
  346. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  347. package/dist/components/stream/hoverUtils.d.ts +7 -2
  348. package/dist/components/stream/keyboardNav.d.ts +4 -1
  349. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
  350. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +58 -0
  351. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  352. package/dist/components/stream/networkBezier.d.ts +10 -0
  353. package/dist/components/stream/networkColorAccessors.d.ts +49 -0
  354. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  355. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  356. package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
  357. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  358. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  359. package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
  360. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  361. package/dist/components/stream/networkFramePaint.d.ts +52 -0
  362. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  363. package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
  364. package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
  365. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  366. package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
  367. package/dist/components/stream/networkTypes.d.ts +103 -51
  368. package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
  369. package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
  370. package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
  371. package/dist/components/stream/ordinalDomain.d.ts +38 -0
  372. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +31 -0
  373. package/dist/components/stream/ordinalPulse.d.ts +10 -0
  374. package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
  375. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
  376. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  377. package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
  378. package/dist/components/stream/ordinalTypes.d.ts +68 -9
  379. package/dist/components/stream/paintNeeds.d.ts +31 -0
  380. package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
  381. package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
  382. package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
  383. package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
  384. package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
  385. package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
  386. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
  387. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
  388. package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
  389. package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
  390. package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
  391. package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
  392. package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
  393. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
  394. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +86 -0
  395. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
  396. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -0
  397. package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
  398. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
  399. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
  400. package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
  401. package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
  402. package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
  403. package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
  404. package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
  405. package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
  406. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
  407. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +317 -0
  408. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
  409. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  410. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  411. package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
  412. package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
  413. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
  414. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +27 -0
  415. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
  416. package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
  417. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +18 -0
  418. package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
  419. package/dist/components/stream/pipelineConfig.d.ts +179 -0
  420. package/dist/components/stream/pipelineDecay.d.ts +21 -3
  421. package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
  422. package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
  423. package/dist/components/stream/pipelinePulse.d.ts +17 -3
  424. package/dist/components/stream/pipelineRibbons.d.ts +41 -0
  425. package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
  426. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +33 -0
  427. package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
  428. package/dist/components/stream/pipelineTransitions.d.ts +3 -1
  429. package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
  430. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  431. package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
  432. package/dist/components/stream/renderBackend.d.ts +27 -0
  433. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  434. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  435. package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
  436. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  437. package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
  438. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  439. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
  440. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  441. package/dist/components/stream/streamStoreSync.d.ts +37 -0
  442. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  443. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  444. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  445. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  446. package/dist/components/stream/titleLayout.d.ts +31 -0
  447. package/dist/components/stream/types.d.ts +165 -72
  448. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  449. package/dist/components/stream/useFrame.d.ts +44 -2
  450. package/dist/components/stream/useHydration.d.ts +6 -0
  451. package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
  452. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  453. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  454. package/dist/components/stream/workerModuleUrl.d.ts +10 -0
  455. package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
  456. package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
  457. package/dist/components/stream/xyCrosshair.d.ts +11 -0
  458. package/dist/components/stream/xyDateTicks.d.ts +9 -0
  459. package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
  460. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  461. package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
  462. package/dist/controls.min.js +2 -0
  463. package/dist/controls.module.min.js +2 -0
  464. package/dist/forceLayoutWorker.js +1 -0
  465. package/dist/geo.min.js +1 -1
  466. package/dist/geo.module.min.js +1 -1
  467. package/dist/network.min.js +1 -1
  468. package/dist/network.module.min.js +1 -1
  469. package/dist/ordinal.min.js +1 -1
  470. package/dist/ordinal.module.min.js +1 -1
  471. package/dist/physics-matter.min.js +1 -0
  472. package/dist/physics-matter.module.min.js +1 -0
  473. package/dist/physics-rapier.min.js +1 -0
  474. package/dist/physics-rapier.module.min.js +1 -0
  475. package/dist/physics.min.js +2 -0
  476. package/dist/physics.module.min.js +2 -0
  477. package/dist/physicsWorker.js +1 -0
  478. package/dist/realtime.min.js +1 -1
  479. package/dist/realtime.module.min.js +1 -1
  480. package/dist/rough.min.js +1 -0
  481. package/dist/rough.module.min.js +1 -0
  482. package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
  483. package/dist/semiotic-ai-core.d.ts +47 -0
  484. package/dist/semiotic-ai-core.min.js +1 -0
  485. package/dist/semiotic-ai-core.module.min.js +1 -0
  486. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
  487. package/dist/semiotic-ai.d.ts +53 -9
  488. package/dist/semiotic-ai.min.js +1 -1
  489. package/dist/semiotic-ai.module.min.js +1 -1
  490. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
  491. package/dist/semiotic-controls.d.ts +20 -0
  492. package/dist/semiotic-data.min.js +1 -1
  493. package/dist/semiotic-data.module.min.js +1 -1
  494. package/dist/semiotic-experimental.d.ts +38 -9
  495. package/dist/semiotic-experimental.min.js +1 -1
  496. package/dist/semiotic-experimental.module.min.js +1 -1
  497. package/dist/semiotic-geo.d.ts +15 -0
  498. package/dist/semiotic-network.d.ts +15 -0
  499. package/dist/semiotic-ordinal.d.ts +14 -0
  500. package/dist/semiotic-physics-matter.d.ts +10 -0
  501. package/dist/semiotic-physics-rapier.d.ts +9 -0
  502. package/dist/semiotic-physics.d.ts +60 -0
  503. package/dist/semiotic-realtime-core.d.ts +34 -0
  504. package/dist/semiotic-realtime-core.min.js +1 -0
  505. package/dist/semiotic-realtime-core.module.min.js +1 -0
  506. package/dist/semiotic-realtime-react.d.ts +10 -0
  507. package/dist/semiotic-realtime-react.min.js +2 -0
  508. package/dist/semiotic-realtime-react.module.min.js +2 -0
  509. package/dist/semiotic-realtime.d.ts +4 -30
  510. package/dist/semiotic-recipes-core.d.ts +92 -0
  511. package/dist/semiotic-recipes-core.min.js +1 -0
  512. package/dist/semiotic-recipes-core.module.min.js +1 -0
  513. package/dist/semiotic-recipes-react.d.ts +7 -0
  514. package/dist/semiotic-recipes-react.min.js +2 -0
  515. package/dist/semiotic-recipes-react.module.min.js +2 -0
  516. package/dist/semiotic-recipes.d.ts +4 -43
  517. package/dist/semiotic-recipes.min.js +1 -1
  518. package/dist/semiotic-recipes.module.min.js +1 -1
  519. package/dist/semiotic-rough.d.ts +4 -0
  520. package/dist/semiotic-server-edge.d.ts +8 -0
  521. package/dist/semiotic-server-edge.min.js +1 -0
  522. package/dist/semiotic-server-edge.module.min.js +1 -0
  523. package/dist/semiotic-server-node.d.ts +5 -0
  524. package/dist/semiotic-server-node.min.js +1 -0
  525. package/dist/semiotic-server-node.module.min.js +1 -0
  526. package/dist/semiotic-server.d.ts +2 -2
  527. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
  528. package/dist/semiotic-themes-core.d.ts +53 -0
  529. package/dist/semiotic-themes-core.min.js +1 -0
  530. package/dist/semiotic-themes-core.module.min.js +1 -0
  531. package/dist/semiotic-themes-react.d.ts +4 -0
  532. package/dist/semiotic-themes-react.min.js +2 -0
  533. package/dist/semiotic-themes-react.module.min.js +2 -0
  534. package/dist/semiotic-themes.d.ts +6 -76
  535. package/dist/semiotic-themes.min.js +1 -2
  536. package/dist/semiotic-themes.module.min.js +1 -2
  537. package/dist/semiotic-utils-core.d.ts +50 -0
  538. package/dist/semiotic-utils-core.min.js +1 -0
  539. package/dist/semiotic-utils-core.module.min.js +1 -0
  540. package/dist/semiotic-utils-react.d.ts +5 -0
  541. package/dist/semiotic-utils-react.min.js +2 -0
  542. package/dist/semiotic-utils-react.module.min.js +2 -0
  543. package/dist/semiotic-utils.d.ts +3 -39
  544. package/dist/semiotic-utils.min.js +1 -2
  545. package/dist/semiotic-utils.module.min.js +1 -2
  546. package/dist/semiotic-value.min.js +1 -1
  547. package/dist/semiotic-value.module.min.js +1 -1
  548. package/dist/semiotic-xy.d.ts +12 -0
  549. package/dist/semiotic.d.ts +44 -8
  550. package/dist/semiotic.min.js +1 -1
  551. package/dist/semiotic.module.min.js +1 -1
  552. package/dist/server.min.js +1 -1
  553. package/dist/server.module.min.js +1 -1
  554. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  555. package/dist/test-utils/frameMock.d.ts +12 -9
  556. package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
  557. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
  558. package/dist/xy.min.js +1 -1
  559. package/dist/xy.module.min.js +1 -1
  560. package/package.json +259 -88
  561. package/spec/README.md +152 -0
  562. package/spec/bindings/README.md +35 -0
  563. package/spec/bindings/vega-lite.mjs +112 -0
  564. package/spec/v0.1/annotation-provenance.schema.json +127 -0
  565. package/spec/v0.1/audience-profile.schema.json +67 -0
  566. package/spec/v0.1/chart-capability.schema.json +186 -0
  567. package/dist/components/recipes/gofish.d.ts +0 -207
  568. package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
  569. package/dist/components/recipes/gofishLambdas.d.ts +0 -145
  570. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
  571. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
  572. package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
  573. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
  574. package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
  575. package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{A as AccessibleNavTree,b as AreaChart,B as BarChart,c as BoxPlot,e as BubbleChart,C as CARBON_ALERT,f as CARBON_CATEGORICAL_14,h as COLOR_BLIND_SAFE_CATEGORICAL,i as CandlestickChart,j as CategoryColorProvider,k as ChartContainer,m as ChartErrorBoundary,n as ChartGrid,o as ChordDiagram,p as CirclePack,q as ConnectedScatterplot,r as ContextLayout,D as DARK_THEME,s as DetailsPanel,t as DifferenceChart,u as DonutChart,v as DotPlot,F as ForceDirectedGraph,w as FunnelChart,G as GaugeChart,x as GroupedBarChart,H as HIGH_CONTRAST_THEME,y as Heatmap,z as Histogram,I as IncrementalExtent,L as LIGHT_THEME,E as LikertChart,J as LineChart,K as LinkedCharts,M as MinimapChart,N as MultiAxisLineChart,O as MultiLineTooltip,P as NetworkCustomChart,Q as OrbitDiagram,R as OrdinalCustomChart,S as PieChart,T as ProcessSankey,U as QuadrantChart,V as RealtimeHeatmap,W as RealtimeHistogram,X as RealtimeLineChart,Y as RealtimeSwarmChart,Z as RealtimeTemporalHistogram,_ as RealtimeWaterfallChart,$ as RidgelinePlot,a0 as RingBuffer,a1 as SankeyDiagram,a2 as Scatterplot,a3 as ScatterplotMatrix,a4 as StackedAreaChart,a5 as StackedBarChart,a6 as StreamNetworkFrame,a7 as StreamOrdinalFrame,a8 as StreamXYFrame,a9 as SwarmPlot,aa as SwimlaneChart,ab as THEME_PRESETS,ac as TemporalHistogram,ad as ThemeProvider,ae as Tooltip,af as TreeDiagram,ag as Treemap,ah as ViolinPlot,ai as XYCustomChart,aj as adaptiveTimeTicks,ak as buildNavigationTree,al as configToJSX,am as copyConfig,an as createHatchPattern,d as darkenColor,ao as deserializeSelections,ap as exportChart,aq as fromConfig,ar as fromURL,as as fromVegaLite,l as lightenColor,at as normalizeTooltip,au as resolveThemePreset,av as serializeSelections,aw as smartTickFormat,ax as smartTooltipEntries,ay as themeToCSS,az as themeToTokens,aA as toConfig,aB as toURL,aC as useBrushSelection,aD as useCategoryColors,aE as useChartObserver,aF as useCustomLayoutSelection,aG as useFilteredData,aH as useLinkedHover,aI as useNavigationSync,aJ as useSelection,aK as useSelectionActions,aL as useTheme}from"./semiotic-semiotic-BmrYbi99.js";import"react/jsx-runtime";import"react";import"d3-selection";import"d3-brush";import"d3-scale";import"d3-quadtree";import"d3-shape";import"d3-array";import"d3-hierarchy";import"regression";import"d3-interpolate";import"d3-force";import"d3-chord";
2
+ import{darkenColor as e,getMax as t,getMin as o,getMinMax as n,lightenColor as r}from"./semiotic-chunk-3FSVZ46U.module.min.js";import*as i from"react";import{useRef as a,useState as s,useEffect as l,useMemo as c,useCallback as u,useImperativeHandle as d,useId as h,forwardRef as f,memo as p}from"react";import{useRef as m,useEffect as g,useMemo as y}from"react";import{select as b}from"d3-selection";import{brush as v,brushX as x,brushY as k}from"d3-brush";import*as w from"react";function S({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:o}={}){const n=w.useId().replace(/:/g,""),r=w.useRef(o);return r.current=o,{description:t,descriptionId:"semiotic-brush-description-"+n,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+n,onKeyDown:w.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),r.current?.(t))},[])}}}import{jsx as A,jsxs as C}from"react/jsx-runtime";function M(e,t,o,n){const[r,i]=[Math.min(...t),Math.max(...t)],a=(i-r)/20;let[s,l]=e;if(n)0>o?s=Math.max(r,s-a):l=Math.min(i,l+a);else{const e=l-s;s=Math.max(r,Math.min(i-e,s+o*a)),l=s+e}return[s,l]}function _(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n+1>>1;t[r]>e?n=r-1:o=r}return t[o]}function P(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n>>1;e>t[r]?o=r+1:n=r}return t[o]}function R({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,dimension:i,scales:a,onBrush:s,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:h}){const f=m(null),p=m(null),w=m(s);w.current=s;const R=m(a);R.current=a;const L=y(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),T=m(L);T.current=L;const $=m(!1),I=m(null),N=S({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=R.current,o=p.current;if(!t||!o||!f.current)return;const n=b(f.current).select(".brush-g");if("clear"===e.type)return $.current=!0,n.call(o.move,null),$.current=!1,I.current=null,void w.current(null);const r=t.x.domain(),a=t.y.domain(),s=I.current;let l=s?.x??[r[0]+.4*(r[1]-r[0]),r[0]+.6*(r[1]-r[0])],c=s?.y??[a[0]+.4*(a[1]-a[0]),a[0]+.6*(a[1]-a[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=M(l,r,d,e.resize)),u||"x"===i||(c=M(c,a,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};$.current=!0,n.call(o.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),$.current=!1,I.current=h,w.current(h)}});return g(()=>{if(!f.current)return;const o=b(f.current).select(".brush-g"),n="x"===i?x():"y"===i?k():v();return n.extent([[0,0],[e,t]]),n.on("brush end",r=>{if($.current)return;const a=R.current;if(!a)return;if(!r.selection)return I.current=null,void w.current(null);let s,u;if("x"===i){const[e,o]=r.selection;s=[a.x.invert(e),a.x.invert(o)],u=[a.y.invert(t),a.y.invert(0)]}else if("y"===i){const[t,o]=r.selection;s=[a.x.invert(0),a.x.invert(e)],u=[a.y.invert(o),a.y.invert(t)]}else{const[[e,t],[o,n]]=r.selection;s=[a.x.invert(e),a.x.invert(o)],u=[a.y.invert(n),a.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===r.type||"brush"===r.type&&d)){const e=T.current;e&&e.length>0?s=function(e,t){return 0===t.length?e:[_(e[0],t),P(e[1],t)]}(s,e):l&&l>0&&(s=[Math.floor(s[0]/l)*l,Math.ceil(s[1]/l)*l]);const t=a.x(s[0]),c=a.x(s[1]);if($.current=!0,"x"===i)o.call(n.move,[t,c]);else if("xy"===i){const e=r.selection;o.call(n.move,[[t,e[0][1]],[c,e[1][1]]])}$.current=!1}const h={x:s,y:u};I.current=h,w.current(h)}),o.call(n),p.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),p.current=null}},[e,t,i,c,l,d]),g(()=>{if(!(h&&a&&p.current&&I.current))return;if(!f.current)return;if("y"===i)return;const e=I.current,t=a.x.domain()[0],o=b(f.current).select(".brush-g");if(t>=e.x[1])return $.current=!0,o.call(p.current.move,null),$.current=!1,I.current=null,void w.current(null);let n=e.x[0],r=!1;if(t>e.x[0]){if(n=t,"bin"===c){const e=T.current;e&&e.length>0?n=P(t,e):l&&l>0&&(n=Math.ceil(t/l)*l)}if(n>=e.x[1])return $.current=!0,o.call(p.current.move,null),$.current=!1,I.current=null,void w.current(null);r=!0}const s=a.x(n),u=a.x(e.x[1]);if($.current=!0,"x"===i)o.call(p.current.move,[s,u]);else{const t=a.y(e.y[1]),n=a.y(e.y[0]);o.call(p.current.move,[[s,t],[u,n]])}if($.current=!1,r){const t={x:[n,e.x[1]],y:e.y};I.current=t,w.current(t)}},[a,h,i,c,l]),C("svg",{ref:f,width:o,height:n,...N.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[A("title",{children:N.svgProps["aria-label"]}),A("desc",{id:N.descriptionId,children:N.description}),A("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`})]})}var L=Object.freeze([]);function T(e){if(!e)return L;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var $=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=T(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=T(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};import{createContext as I,useCallback as N,useContext as D,useMemo as E,useRef as B,useSyncExternalStore as F}from"react";import{jsx as H}from"react/jsx-runtime";function z(e){let t=null;const o=()=>(t||(t=I(null)),t),n=O(e);return[function({children:t,initialState:n}){const r=B(n),i=E(()=>O(e,r.current),[]),a=o();return H(a.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=D(r)??n,a=B(e);a.current=e;const s=B({hasValue:!1,value:void 0}),l=N(()=>{const e=a.current(i.getState()),o=s.current;return o.hasValue&&t&&t(o.value,e)?o.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=N(()=>a.current(i.getState()),[i]);return F(i.subscribe,l,c)}]}function O(e,t){const o=new Set;let n={...e(function(e){const t=e(n);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){n={...n,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function W(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function j(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Y}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var Y=["#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}},V={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}},X={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Y,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 q(e,t){if("light"===t)return G;if("dark"===t)return V;if("high-contrast"===t)return X;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?V:G;return j({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return j({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[U,K]=z(e=>({theme:G,setTheme(t){e(e=>({theme:q(e.theme,t)}))}})),Z=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},o.push(e),this.buffer[i]=t(a)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},Q=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function J(e,t){return e===t}function ee(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function te(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function oe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ne=/^\d{4}-\d{1,2}$/;function re(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=ne.test(t)?t+"-01":t;if(o===t&&10>t.length)return NaN;const n=Date.parse(o);return Number.isFinite(n)?n:NaN}function ie(e){return e instanceof Date?e.getTime():"string"==typeof e?re(e):+e}function ae(e){return new Set(Array.isArray(e)?e:[e])}import{scaleOrdinal as se}from"d3-scale";function le(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ce(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function ue(e){const t=e.map(le),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return ce(e,o,n)}if(e>=1){const[e,n,r]=t[o];return ce(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[a,s,l]=t[r],[c,u,d]=t[r+1];return ce(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var de=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],he=ue(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),fe=ue(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),pe=ue(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),me=ue(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ge=ue(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ye=ue(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),be=ue(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ve=ue(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),xe=ue(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ke=ue(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),we=ue(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Se=ue(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ae={blues:he,reds:fe,greens:pe,viridis:be,oranges:me,purples:ge,greys:ye,plasma:ve,inferno:xe,magma:ke,cividis:we,turbo:Se};function Ce(e){return e&&Ae[e]||he}var Me=ue(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),_e=ue(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Pe=ue(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Re=ue(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Le=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Te=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),$e=ue(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Ie={category10:de,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ae},Ne=de,De=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ee=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Fe(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Be.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):Ne[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%Ne.length]}function He(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function ze(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>He(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return se().domain(n).range(o).unknown("#999");const i=Ie[o]||Ie.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Ne;return se().domain(n).range(e).unknown("#999")}}function Oe(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,a]=n,[s,l]=o;if(a===i)return(s+l)/2;let c=(r-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function We(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function je(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Ye(e,t,o){return e+(t-e)*o}function Ge(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ve(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??1)>e?"fresh":t*(o.aging??1.5)>e?"aging":t*(o.stale??3)>e?"stale":"expired":"fresh"}function Xe(e,t,o){if(null!=e)return"function"==typeof e?e(t,o):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function qe(e){const{data:t,encoding:o}=e,n=[],r=new Map;return t.forEach((e,t)=>{const i=Xe(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const a=i+"";if(r.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=Xe(o.process?.group,e,t),l=Xe(o.process?.stage,e,t),c=Xe(o.accessible?.group,e,t)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const n of Object.keys(o.evidence??{}))u[n]=Xe(o.evidence?.[n],e,t);const d={id:a,datum:e,time:{arrival:Xe(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:Xe(o.placement?.x,e,t),y:Xe(o.placement?.y,e,t),lane:Xe(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:Xe(o.kinematics?.velocityX,e,t),velocityY:Xe(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:s,stage:l,target:Xe(o.process?.target,e,t),work:Xe(o.process?.work,e,t)},evidence:u,accessible:{description:Xe(o.accessible?.description,e,t),group:c,label:Xe(o.accessible?.label,e,t)??a}};n.push(d),r.set(a,d)}),{rows:n,byId:r}}function Ue(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:Ve(t,e.ttl,e.thresholds)}}function Ke(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}function Ze(e,t){const o=Number.isFinite(e)?e:0,n=Number.isFinite(t)?t:0;return{velocityX:o,velocityY:n,speed:Math.hypot(o,n),direction:Math.atan2(n,o)}}function Qe(e,t,o){return Number.isFinite(o)&&o>0?Ze((t.x-e.x)/o,(t.y-e.y)/o):Ze(0,0)}function Je(e,t,o){if(1>=o)return 1;const n=o-1;return Ke({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function et(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function tt(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function ot(e,t,o,n){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==o&&(e._pulseColor=o,r=!0),e._pulseGlowRadius!==n&&(e._pulseGlowRadius=n,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function nt(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const n=e.duration??500,r=t.peek();return null!=r&&n>o-r}function rt(e,t,o){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+o;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function it(e,t,o,n,r,i){const a=[];for(const r of e){const e=o(r),i=n(r);Number.isFinite(e)&&Number.isFinite(i)&&a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function at(e,t,o,n,r,i,a,s){const l=[];for(const i of e){const e=o(i),a=n(i);if(!Number.isFinite(e)||!Number.isFinite(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:a}}function st(e,t,o,n){const r=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const r of t)e+=o(r,n)||0;r.set(n,-e/2)}else if("wiggle"===n){e.length>0&&r.set(e[0],0);for(let n=1;e.length>n;n++){const i=e[n-1],a=e[n];let s=0,l=0,c=0;for(const e of t){const t=o(e,a)||0;s+=(2*c+t)*(t-(o(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(a,u-(l>0?s/(2*l):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(r.get(i)??0)+e/2}const i=n/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function lt(e,t,o,n,r,i,a){const s=o(e),l=n(e);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function ct(e,t,o,n,r,i,a,s){const l=o(e),c=n(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:a,datum:e};return void 0!==s&&(u.pointId=s),u}function ut(e,t,o,n,r,i,a){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:a}}function dt(e,t,o,n,r,i,a){const s={type:"heatcell",x:e,y:t,w:o,h:n,fill:r,datum:i};return a?.showValues&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function ht(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function ft(e,t,o,n){if(!e.scales)return null;const r=[],i=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const a=n.getTop(o),s=n.getBottom(o);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=e.scales.x(t),c=e.scales.y(a),u=e.scales.y(s);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:ht(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function pt(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function mt(e,t,o){const n=[];for(const r of o){const o=ft(e,t,"__ribbon_aggregate",r);o&&n.push(o)}return n}function gt(e,t,o,n){const r=[];for(const i of n){const n=ft(e,t,o,i);n&&r.push(n)}return r}function yt(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),r=n.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&o.push({y0:r,y1:t})}return 0===o.length?e:{...e,band:o[0],bands:o}}function bt(e,t,o,n){if(!e.config.pointStyle)return;const r=n??e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const i of n.data){let n=e.config.pointStyle(i);!n.fill&&t&&(n={...n,fill:t});const a=n.r??3,s=e.getPointId?e.getPointId(i)+"":void 0,l=lt(i,e.scales,e.getX,r,a,n,s);l&&o.push(l)}}}function vt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var xt={topOpacity:.8,bottomOpacity:.05};function kt(e){if(e)return!0===e?xt:"colorStops"in e?e:{topOpacity:e.topOpacity??xt.topOpacity,bottomOpacity:e.bottomOpacity??xt.bottomOpacity}}import{symbol as wt,symbolCircle as St,symbolCross as At,symbolDiamond as Ct,symbolSquare as Mt,symbolStar as _t,symbolTriangle as Pt,symbolWye as Rt}from"d3-shape";var Lt={circle:St,square:Mt,triangle:Pt,diamond:Ct,star:_t,cross:At,wye:Rt},Tt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function $t(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*It(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):wt(Lt[n]??St,Math.max(1,t))()??""}function It(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Nt=new Map;function Dt(e,t,o,n,r){const i=new Map;for(const a of e){const e=t(a),s=o(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/n)*n;let c=i.get(l);if(c||(c={start:l,end:l+n,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Et(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:n,warned:r}=e;Bt(n)&&0===o.length&&Ft(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),o.length>0&&o.every(e=>null==e.datum)&&Ft(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Bt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Bt))}function Ft(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Ht(e,t,o,n){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:n}}function zt(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Ot(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=zt(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=ee(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:zt(e.y1Accessor,"y1"),getBottom:zt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}import{scaleLinear as Wt,scaleLog as jt,scaleSymlog as Yt,scaleTime as Gt}from"d3-scale";function Vt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Xt(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return jt().domain(e).range(o).clamp(!0)}return"symlog"===e?Yt().domain(t).range(o):"time"===e?Gt().domain([new Date(t[0]),new Date(t[1])]).range(o):Wt().domain(t).range(o)}function qt(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function Ut(e,t){const o=new Z(e.capacity);return e.forEach(()=>o.push(t)),o}function Kt(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}function Zt(e,t,o){if(!t||0===t.size)return;const n=new Set;if(e.forEach((e,t)=>{o(e)&&n.add(t)}),0===n.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)n.has(e)||t.push(r[e])}var Qt=new WeakMap;function Jt(){return this.updateResults.last}function eo(){return this.updateResults.last}function to(e){return this.updateResults.subscribe(e)}function oo(e){this.config.layoutSelection=e}function no(){Qt.set(this,!0)}function ro(){const e=!0===Qt.get(this);return Qt.delete(this),e}function io(e){Object.assign(e.prototype,{getLastUpdateResult:Jt,getUpdateSnapshot:eo,subscribeUpdateResult:to,setLayoutSelection:oo,markStylePaintPending:no,consumeStylePaintPending:ro})}var ao={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function so(e,t){const o={...e};for(const e of t)o[ao[e]]++;return o}function lo(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:so(o,n)}}var co=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=lo({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const o=lo(e,t,this.revisions);this.revisions=o.revisions,this.latest=o;for(const e of[...this.listeners])e();return o}},uo=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ho=["scene-style","data-paint","accessibility","evidence"],fo=(e,t)=>({retainedData:e,invalidations:t}),po=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],mo=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],go=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],yo=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],bo=["scene-geometry","data-paint","accessibility","evidence"],vo=["scene-style","data-paint","accessibility","evidence"],xo=[],ko={chartType:fo("rebuild",po),runtimeMode:fo("rebuild",po),xAccessor:fo("rebuild",po),yAccessor:fo("rebuild",po),timeAccessor:fo("rebuild",po),valueAccessor:fo("rebuild",po),y0Accessor:fo("rebuild",po),boundsAccessor:fo("rebuild",po),band:fo("rebuild",po),openAccessor:fo("rebuild",po),highAccessor:fo("rebuild",po),lowAccessor:fo("rebuild",po),closeAccessor:fo("rebuild",po),candlestickRangeMode:fo("rebuild",po),accessorRevision:fo("rebuild",po),groupAccessor:fo("rebuild",mo),categoryAccessor:fo("rebuild",mo),lineDataAccessor:fo("rebuild",mo),colorAccessor:fo("rebuild",vo),sizeAccessor:fo("rebuild",bo),symbolAccessor:fo("rebuild",bo),pointIdAccessor:fo("rebuild",bo),xScaleType:fo("preserve",go),yScaleType:fo("preserve",go),xExtent:fo("preserve",go),yExtent:fo("preserve",go),extentPadding:fo("preserve",go),scalePadding:fo("preserve",go),axisExtent:fo("preserve",go),binSize:fo("preserve",go),normalize:fo("preserve",go),heatmapAggregation:fo("preserve",go),heatmapXBins:fo("preserve",go),heatmapYBins:fo("preserve",go),arrowOfTime:fo("preserve",yo),baseline:fo("preserve",yo),stackOrder:fo("preserve",yo),sizeRange:fo("preserve",yo),curve:fo("preserve",yo),areaGroups:fo("preserve",yo),customLayout:fo("preserve",yo),layoutConfig:fo("preserve",yo),layoutMargin:fo("preserve",yo),symbolMap:fo("preserve",bo),showValues:fo("preserve",bo),heatmapValueFormat:fo("preserve",bo),lineStyle:fo("preserve",vo),pointStyle:fo("preserve",vo),areaStyle:fo("preserve",vo),barStyle:fo("preserve",vo),swarmStyle:fo("preserve",vo),waterfallStyle:fo("preserve",vo),candlestickStyle:fo("preserve",vo),boundsStyle:fo("preserve",vo),gradientFill:fo("preserve",vo),lineGradient:fo("preserve",vo),colorScheme:fo("preserve",vo),themeCategorical:fo("preserve",vo),themeSemantic:fo("preserve",vo),themeSequential:fo("preserve",vo),themeDiverging:fo("preserve",vo),barColors:fo("preserve",vo),decay:fo("preserve",vo),pulse:fo("preserve",vo),staleness:fo("preserve",vo),layoutSelection:fo("preserve",vo),annotations:fo("preserve",["overlay","accessibility","evidence"]),windowSize:fo("preserve",xo),windowMode:fo("preserve",xo),maxCapacity:fo("preserve",xo),clock:fo("preserve",xo),transition:fo("preserve",xo),introAnimation:fo("preserve",xo),onLayoutError:fo("preserve",xo)},wo=fo("preserve",yo),So=class{constructor(){this.tracker=new co}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}},uo)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},ho):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=ko[n]??wo;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};import{quadtree as Ao}from"d3-quadtree";var Co=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let o=0,n=0;for(const e of t)"point"===e.type&&(o++,e.r>n&&(n=e.r));if(this.maxRadius=n,500>=o)return void(this.tree=null);const r=Array(o);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=Ao().x(e=>e.x).y(e=>e.y).addAll(r)}},Mo=class e{constructor(e){if(this.xExtent=new Q,this.yExtent=new Q,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new So,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new Co,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,o)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const a=e.color??"rgba(255,255,255,0.6)",s=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;o.length>t;t++)e.set(o[t],t);return e})();for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let r=0,s=!1;for(const o of t){const t=c.get(o);if(null==t)continue;s=!0;const a=n.get(t);if(null==a)continue;const l=tt(e,a,i);l>r&&(r=l)}s&&(l=ot(o,r,a)||l);continue}const t=c.get(o.datum);if(null==t)continue;const r=n.get(t);l=ot(o,null==r?0:tt(e,r,i),a,s)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this.config=e,this.buffer=new Z(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ee(e.timeAccessor||e.xAccessor,"time"),this.getY=ee(e.valueAccessor||e.yAccessor,"value")):(this.getX=ee(e.xAccessor,"x"),this.getY=ee(e.yAccessor,"y")),this.getGroup=oe(e.groupAccessor),this.getCategory=oe(e.categoryAccessor),this.getSize=e.sizeAccessor?ee(e.sizeAccessor,"size"):void 0,this.getColor=oe(e.colorAccessor),this.getSymbol=oe(e.symbolAccessor),this.getY0=e.y0Accessor?ee(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ot(e),this.getPointId=oe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?ee(e.openAccessor,"open"):void 0,this.getHigh=ee(e.highAccessor,"high"),this.getLow=ee(e.lowAccessor,"low"),this.getClose=o?ee(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Z(e.windowSize))}currentTime(){return this.config.clock?.()??Ge()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Ut(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=o?ee(this.config.timeAccessor||this.config.xAccessor,"time"):ee(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],r=n instanceof Date,i="string"==typeof n&&Number.isFinite(re(n));if(this.xIsDate=r||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>ie(t[e]):e=>ie(o(e))}}qt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Kt(this.buffer,o,this.timestampBuffer,t),this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o)}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Kt(this.buffer,o,this.timestampBuffer,t);this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:o}=this,n=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(o,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),a=this.yExtent.extent;let s=Vt(this.xExtent.extent,t.xExtent),l=Vt(a,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const d="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&o.size>0){const e=function(e){const{config:t,groups:o,getX:n,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const o=[0,i?1:1+t.extentPadding];return{yDomain:o,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:o}}}const a=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===a)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const s=new Map,l=new Set;let c=0;const u=new Map,d=new Map;for(const e of o){const t=new Map;let o=0;for(const i of e.data){const e=n(i),a=r(i);if(!Number.isFinite(e)||!Number.isFinite(a))continue;t.set(e,(t.get(e)||0)+a),l.add(e),o+=a;const s=(u.get(e)||0)+a;u.set(e,s),s>c&&(c=s)}s.set(e.key,t),d.set(e.key,o)}const h=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,m;if("input"===h)p=o.map(e=>e.key);else if("insideOut"===h){const e=[...o].map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:f(e,t)}),t=[],n=[];let r=0,i=0;for(const o of e)i>r?(t.push(o),r+=d.get(o)??0):(n.push(o),i+=d.get(o)??0);p=[...n.reverse(),...t]}else p="asc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(e)??0)-(d.get(t)??0);return 0!==o?o:f(e,t)}):"desc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:f(e,t)}):o.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),o=st(e,p,(e,t)=>s.get(e)?.get(t)||0,t.baseline);let n=1/0,r=-1/0;for(const t of e){const e=o.get(t)??0,i=u.get(t)??0;n>e&&(n=e),e+i>r&&(r=e+i)}Number.isFinite(n)&&Number.isFinite(r)||(n=0,r=0);const a=r-n,c=i?0:a>0?a*t.extentPadding:1;m=[n-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[o,n]=function(e,t,o){let n=0,r=0;for(const i of e){let e=0,a=0;for(const n of t){const t=o(n,i)||0;0>t?a+=t:e+=t}n>a&&(n=a),e>r&&(r=e)}return[n,r]}(e,p,(e,t)=>s.get(e)?.get(t)||0),r=n-o,a=i?0:r>0?r*t.extentPadding:1;m=[o-a,n+a]}else m=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:m,stackExtentCache:{key:a,yDomain:m}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:o.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&o.size>0?l=function(e,t,o,n,r,i,a){const[,s]=function(e,t,o,n,r){const i=Dt(e,t,o,n,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(e,t,o,n,r);return[0,a?s:s+s*i]}(o,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,d):"waterfall"===t.chartType&&!c&&o.size>0?l=function(e,t,o,n){const[r,i]=function(e,t){let o=0,n=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,o>r&&(o=r),r>n&&(n=r))}return[o,n]}(e,t),a=i-r,s=n?0:a>0?a*o:1;return[Math.min(0,r-Math.abs(s)),Math.max(0,i+Math.abs(s))]}(o,this.getY,t.extentPadding,d):c||l[0]===1/0||(l=function(e,t,o){if(!o.length)return e;let[n,r]=e;for(const e of t)for(const t of o){const o=t.getTop(e),i=t.getBottom(e);Number.isFinite(o)&&(n>o&&(n=o),o>r&&(r=o)),Number.isFinite(i)&&(n>i&&(n=i),i>r&&(r=i))}return[n,r]}(l,i,this.resolvedRibbons),l=function(e,t){const o=e[1]-e[0],n=t.exactMode?0:o>0?o*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-n,null!=t.userMax?e[1]:e[1]+n];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:d,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:a}));l=function(e,t,o){if(!t||o)return e;const n=t[0],r=t[1];return null==n&&null==r?e:[null!=n?n:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:s,yDomain:l}=function(e,t,o){let n=e,r=t;if(n[0]===1/0||n[1]===-1/0)if("time"===o){const e=Date.now();n=[e-864e5,e]}else n=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:n,yDomain:r}}(s,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:n,yDomain:r}=e,i="streaming"===t.runtimeMode,a=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(s=t.arrowOfTime)||"down"===s?"y":"x")){const e="right"===t.arrowOfTime?[a,o.width-a]:[o.width-a,a];return{x:Wt().domain(n).range(e),y:Xt(t.yScaleType,r,[o.height-a,a])}}const e="down"===t.arrowOfTime?[a,o.height-a]:[o.height-a,a];return{x:Xt(t.yScaleType,r,[a,o.width-a]),y:Wt().domain(n).range(e)}}var s;return{x:Xt(t.xScaleType,n,[a,o.width-a]),y:Xt(t.yScaleType,r,[o.height-a,a])}}({config:t,layout:e,xDomain:s,yDomain:l}),this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=h,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":case"glyph":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),a=this.scales.y.range(),s=Xt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,n,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:o,scales:n}=this;if(!n)return[];if(o.customLayout){const r={data:t,scales:n,dimensions:{width:e.width,height:e.height,margin:o.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:o.themeSemantic??{},categorical:o.themeCategorical??De},resolveColor:(e,t)=>{const n=this.resolveGroupColor(e);if(n)return n;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:o.themeSemantic?.primary??"#4e79a7"},config:o.layoutConfig??{},selection:o.layoutSelection??null};let i;try{i=o.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,n=Ht("xy",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{o.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const a=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of a)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(a,o.layoutSelection??null)}return Et({label:"customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:n,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){const o=e.groupData(t),n=[],r=e.config.annotations?.filter(vt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=pt(e.ribbons);if(i.length>0&&n.push(...mt(e,t,i)),r.length>0)for(const t of o)n.push(...gt(e,t.data,t.key,r))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=it(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return bt(e,o,n),n}(r,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=pt(e.ribbons);if(i.length>0&&n.push(...mt(e,t,i)),r.length>0)for(const t of o)n.push(...gt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),a=at(t.data,e.scales,e.getX,e.getY,r,o,t.key,i),s=kt(e.config.gradientFill);s&&(a.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),n.push(a)}return bt(e,o,n),n}(r,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=pt(e.ribbons);if(i.length>0&&n.push(...mt(e,t,i)),r.length>0)for(const t of o)n.push(...gt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],a=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o)if(r.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),r=at(t.data,e.scales,e.getX,e.getY,i,o,t.key,a),s=kt(e.config.gradientFill);s&&(r.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),n.push(r)}else{const o=e.resolveLineStyle(t.key,t.data[0]),r=it(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),n.push(r)}return bt(e,o,n),n}(r,t);case"stackedarea":return function(e,t){const o=e.groupData(t),n=e.config.stackOrder??"key",r=()=>o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===n);else if("key"===n)r();else if("asc"===n||"desc"===n||"insideOut"===n){const t=new Map;for(const n of o){let o=0;for(const t of n.data){const n=e.getX(t),r=e.getY(t);Number.isFinite(n)&&Number.isFinite(r)&&(o+=r)}t.set(n.key,o)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===n)o.sort((e,o)=>{const n=(t.get(e.key)??0)-(t.get(o.key)??0);return 0!==n?n:r(e.key,o.key)});else if("desc"===n)o.sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)});else{const e=[...o].sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)}),n=[],i=[];let a=0,s=0;for(const o of e)s>a?(n.push(o),a+=t.get(o.key)??0):(i.push(o),s+=t.get(o.key)??0);o.length=0,o.push(...i.reverse(),...n)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,a=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:s,stackedTops:l}=function(e,t,o,n,r,i,a,s="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=o(r),i=n(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let o=0;for(const n of e)o+=u.get(n.key)?.get(t)||0;d.set(t,o||1)}}const h=st(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,s),f="diverging"===s&&!i,p=[],m=new Map,g=new Map,y=new Map,b=new Map;for(const e of c)g.set(e,h.get(e)??0),y.set(e,0),b.set(e,0);for(const o of e){const e=u.get(o.key),n=new Map;let s=[],l=[];const h=()=>{if(s.length>=2){const e={type:"area",topPath:s,bottomPath:l,style:r(o.key,o.data[0]),datum:o.data,group:o.key};a&&(e.curve=a),p.push(e)}s=[],l=[]};for(const o of c){const r=e.has(o);let a,c,u=r?e.get(o):0;if(i&&r&&(u/=d.get(o)),!r||!Number.isFinite(u)||0===u){h();continue}f?u>0?(a=y.get(o),c=a+u,y.set(o,c)):(a=b.get(o),c=a+u,b.set(o,c)):(a=g.get(o),c=a+u,g.set(o,c));const p=t.x(o);l.push([p,t.y(a)]),s.push([p,t.y(c)]),n.set(o,c)}h(),m.set(o.key,n)}return{nodes:p,stackedTops:m}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,a),c=s;if(e.config.pointStyle){const t=new WeakMap;for(const n of o){const o=l.get(n.key);if(o)for(const r of n.data){const n=e.getX(r),i=e.getY(r);null==n||Number.isNaN(n)||null==i||Number.isNaN(i)||!o.has(n)||t.set(r,o.get(n))}}const n=o=>t.get(o)??e.getY(o);bt(e,o,c,n)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const o=[],n="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);i=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,s=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let d=0;const h=e=>{const t=c?.[e];if(t)return t;let o=u.get(e);return o||(o=Tt[d%Tt.length],d++,u.set(e,o)),o};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:s,opacity:.8},c=t.r||n;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(r);o&&a.has(o)&&(t={...t,fill:a.get(o)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const n=h(l(r)+""),i=ct(r,e.scales,e.getX,e.getY,Math.PI*c*c,n,t,u);i&&o.push(i)}else{const n=lt(r,e.scales,e.getX,e.getY,c,t,u);n&&o.push(n)}}return o}(r,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){const n=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",a=ee(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[s,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-s||1)/n,h=(u-c||1)/r,f=n*r;if(f>1e6)return[];const p=new Int32Array(f),m=new Float64Array(f);for(let o=0;t.length>o;o++){const i=t[o],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-s)/d),n-1),g=Math.min(Math.floor((u-c)/h),r-1);if(0>f||0>g)continue;const y=g*n+f;p[y]++;const b=a(i);m[y]+=isFinite(b)?b:0}let g=1/0,y=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=m[e];break;case"mean":t=m[e]/p[e];break;default:t=p[e]}g>t&&(g=t),t>y&&(y=t)}if(!isFinite(g))return[];const b=y-g||1,v=o.width/n,x=o.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,S=[];for(let e=0;r>e;e++){const t=e*n;for(let o=0;n>o;o++){const n=t+o;if(0===p[n])continue;let a;switch(i){case"sum":a=m[n];break;case"mean":a=m[n]/p[n];break;default:a=p[n]}const l=(a-g)/b;S.push(dt(o*v,(r-1-e)*x,v,x,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:o,yi:e,value:a,count:p[n],sum:m[n],xCenter:s+(o+.5)*d,yCenter:c+(e+.5)*h,agg:i},k?{value:a,showValues:!0,valueFormat:w}:void 0))}}return S}(e,t,o);if(0===t.length)return[];const n=ee(e.config.valueAccessor,"value"),r=te(e.config.xAccessor,"x"),i=te(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=r(o),u=i(o);l[e]=n,c[e]=u,a.has(n)||a.set(n,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),f=Array.from(s.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),m=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(m){f.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;f.length>e;e++)s.set(f[e],e)}const g=new Float64Array(t.length),y=new Float64Array(t.length),b=Array(t.length),v=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],r=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=n(o),h=i*u+r,f=v.get(h);let p;void 0!==f?p=f:(p=x++,v.set(h,p)),g[p]=h,y[p]=d,b[p]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const S=function(e){const t=e in Ae?e:"blues";let o=Nt.get(t);if(o)return o;o=Array(256);const n=Ce(t);for(let e=0;256>e;e++)o[e]=n(e/255);return Nt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),C=o.width/u,M=o.height/d,_=e.config.showValues,P=e.config.heatmapValueFormat,R=[];for(let e=0;x>e;e++){const t=y[e];if(!isFinite(t))continue;const o=g[e],n=o%u;R.push(dt(n*C,(d-1-(o-n)/u)*M,C,M,S[Math.min((t-k)*A+.5|0,255)],b[e],_?{value:t,showValues:!0,valueFormat:P}:void 0))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Dt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let n=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const o of e.categories.keys())t.add(o);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=r.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?n=e.barCategoryCache.order:(n=[...s,...a],e.barCategoryCache={key:l,order:n})}const r=[],i=e.scales,[a,s]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,d="number"!=typeof u||0>u?1:u,h={};l?.stroke&&(h.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(h.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(h.opacity=l.opacity);for(const t of o.values()){const o=Math.max(t.start,a),u=Math.min(t.end,s);if(o>=u)continue;const f=i.x(o),p=i.x(u),m=Math.abs(p-f),g=m>d+1?d:0,y=Math.min(f,p)+g/2,b=Math.max(m-g,1);if(b>0)if(n&&t.categories.size>0){let o=0;for(const a of n){const n=t.categories.get(a)||0;if(0===n)continue;const s=i.y(o),u=i.y(o+n);r.push(ut(y,Math.min(s,u),b,Math.abs(s-u),{fill:e.config.barColors?.[a]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:a,categoryValue:n},a)),o+=n}}else{const e=i.y(0),o=i.y(t.total);r.push(ut(y,Math.min(e,o),b,Math.abs(e-o),{fill:l?.fill||c||"#007bff",...h},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of o.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const o=[],n=e.config.swarmStyle||{},r=n.radius??3,i=n.fill??e.config.themeSemantic?.primary??"#007bff",a=n.opacity??.7,s=n.stroke,l=n.strokeWidth;for(const n of t){const t=e.getX(n),c=e.getY(n);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),d=e.scales.y(c);let h=i;if(e.getCategory){const t=e.getCategory(n);h=e.config.barColors?.[t]||h}const{r:f,...p}=e.config.pointStyle?.(n)??{},m={type:"point",x:u,y:d,r:f??r,style:{fill:h,opacity:a,stroke:s,strokeWidth:l,...p},datum:n};e.getPointId&&(m.pointId=e.getPointId(n)+""),o.push(m)}return o}(r,t);case"waterfall":return function(e,t,o){const n=[],r=e.scales,i=e.config.waterfallStyle,a=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===a.length)return n;const s=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,d=i?.strokeWidth,h=i?.opacity;let f=0;for(let t=0;a.length>t;t++){const p=a[t],m=e.getX(p),g=e.getY(p),y=f+g;let b;b=a.length-1>t?e.getX(a[t+1])-m:t>0?m-e.getX(a[t-1]):0;const v=r.x(m),x=0!==b?r.x(m+b):v+o.width/10,k=Math.min(v,x)+c/2,w=Math.max(v,x)-c/2-k;if(0>=w){f=y;continue}const S=r.y(f),A=r.y(y),C=Math.min(S,A),M=Math.abs(S-A),_={fill:0>g?l:s,stroke:u,strokeWidth:d};null!=h&&(_.opacity=h),n.push(ut(k,C,w,M,_,{...p,baseline:f,cumEnd:y,delta:g,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=y}return n}(r,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const n=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",a=o?i:r.upColor||"#28a745",s=o?i:r.downColor||"#dc3545",l=o?i:r.wickColor||"#333",c=r.wickWidth||(o?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let o=1;u.length>o;o++){const n=Math.abs(e.scales.x(u[o])-e.scales.x(u[o-1]));n>0&&t>n&&(t=n)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const h=o?i:e.getOpen(r),f=o?u:e.getClose(r);if(!o&&[h,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=h,m={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:d,upColor:a,downColor:s,wickColor:l,wickWidth:c,isUp:p,datum:r};o&&(m.isRange=!0),n.push(m)}return n}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,o,n){const r=e.boundsStyle;return"function"==typeof r?r(o||{},t):r&&"object"==typeof r?r:{fill:n(t,o).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?Je(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=et(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,n=et(o)){const r=o.length;if(r>1)for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const i=Array(t.length);let a=!1;for(let o=0;t.length>o;o++){const s=n.get(t[o]);null!=s?(i[o]=Je(e,s,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],i=o.topPath?o.topPath.length:t.length;if(2>i)continue;if(t.length===i){const a=Array(i);let s=!1;for(let o=0;t.length>o;o++){const i=n.get(t[o]);null!=i?(a[o]=Je(e,i,r),1>a[o]&&(s=!0)):a[o]=1}s&&(o._decayOpacities=a)}else{let a=1;for(const o of t){const t=n.get(o);if(null!=t){const o=Je(e,t,r);a>o&&(a=o)}}if(1>a){const e=Array(i);e.fill(a),o._decayOpacities=e}}continue}const t=n.get(o.datum);if(null==t)continue;const i=Je(e,t,r);"heatcell"===o.type?o.style={opacity:i}:"candlestick"===o.type?o._decayOpacity=i:o.style={...o.style,opacity:(o.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&nt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,n){o.clear(),n.clear();for(let r=0;t.length>r;r++){const i=t[r],a=rt(e,i,r);a&&("point"===i.type?o.set(a,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?o.set(a,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?o.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?o.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?o.set(a,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?n.set(a,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&n.set(a,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=rt(this.transitionContext,o,t);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:0,opacity:0}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:e,w:o.w,h:0,opacity:o.style.opacity??1}):"heatcell"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:0}):"line"===o.type?(o._introClipFraction=0,this.prevPathMap.set(n,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style.opacity})):"area"===o.type&&(o._introClipFraction=0,this.prevPathMap.set(n,{topPath:o.topPath.map(e=>[e[0],e[1]]),bottomPath:o.bottomPath.map(e=>[e[0],e[1]]),opacity:o.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,n,r,i=Ge()){if(0===n.size&&0===r.size)return o;const a=t.duration??300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let s=!1;const l=new Set,c=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],a=rt(e,i,t);if(!a)continue;if(i._transitionKey=a,"line"===i.type||"area"===i.type){const e=r.get(a);if(e){if(c.add(a),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];s=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];s=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},s=!0;continue}const u=n.get(a);if("point"===i.type)if(u){l.add(a);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("glyph"===i.type)if(u){l.add(a);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("rect"===i.type)if(u){l.add(a);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("heatcell"===i.type)if(u){l.add(a);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(a);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),s=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),s=!0}for(const[e,t]of n)if(!l.has(e)){if(e.startsWith("p:"))o.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)o.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))o.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))o.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const n=t.openY??t.y;o.exitNodes.push({type:"candlestick",x:t.x,openY:n,closeY:t.closeY??n,highY:t.highY??n,lowY:t.lowY??n,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}s=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),s&&(o.activeTransition={startTime:i,duration:a}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,n){if(!o.activeTransition)return!1;const r=je(e,o.activeTransition),i=We(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Ye(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Ye(o.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Ye(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Ye(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Ye(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==o.w&&(e.w=Ye(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Ye(o.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Ye(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==o.w&&(e.w=Ye(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Ye(o.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Ye(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ye(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Ye(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Ye(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Ye(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Ye(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ye(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=Ye(t[n][0],o[n][0],i),e.path[n][1]=Ye(t[n][1],o[n][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ye(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,r=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Ye(t[o][0],n[o][0],i),e.topPath[o][1]=Ye(t[o][1],n[o][1],i);if(o&&r&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ye(o[t][0],r[t][0],i),e.bottomPath[t][1]=Ye(o[t][1],r[t][1],i)}}if(r>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:o}=function(e,t,o,n){if(n&&n.version===o&&n.group===t&&n.data===e)return{result:n.result,cache:n};let r;if(t){const o=new Map;for(const n of e){const e=t(n);o.has(e)||o.set(e,[]),o.get(e).push(n)}r=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:o,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=o,t}resolveColorMap(e){const{map:t,cache:o}=function(e,t,o,n,r){if(r&&r.version===n)return{map:r.map,cache:r};const i=new Set;if(t)for(const o of e){const e=t(o);e&&i.add(e)}const a=Array.from(i).sort(),s=a.join("\0");if(r&&r.key===s){const e={...r,version:n};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||De,c=new Map;for(let e=0;a.length>e;e++)c.set(a[e],l[e%l.length]);return{map:c,cache:{key:s,map:c,version:n}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=o,t}resolveLineStyle(e,t){return function(e,t,o,n){const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.stroke&&t){const o=n(t);if(o)return{...e,stroke:o}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:n(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,o,n){if(e.areaStyle){const r=e.areaStyle(o||{});if(r&&!r.fill&&t){const e=n(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.fill&&t){const o=n(t);if(o)return{...e,fill:o,stroke:e.stroke||o}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const a=n(t)||i||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:o,groupColorCounter:n}=function(e){const{group:t,colorMapCache:o,groupColorMap:n,groupColorMapCap:r,config:i}=e;let{groupColorCounter:a}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:a}}const s=n.get(t);if(s)return{color:s,groupColorCounter:a};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||De;if(0===l.length)return{color:null,groupColorCounter:a};const c=l[a%l.length];if(a++,n.set(t,c),n.size>r){const e=n.keys().next().value;void 0!==e&&n.delete(e)}return{color:c,groupColorCounter:a}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=n,o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ae(e),o=this.getPointId,n=e=>t.has(o(e));Zt(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=ae(e),n=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let n=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,o=e&&this.config.valueAccessor||this.config.yAccessor,a=e&&t.valueAccessor||t.yAccessor,s=i||!J(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!J(o,a);(s||l)&&(e?(this.getX=ee(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ee(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ee(this.config.xAccessor,"x"),this.getY=ee(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ot(this.config)),n=!0,r=!0)}if("groupAccessor"in e&&!J(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?oe(this.config.groupAccessor):void 0,n=!0),"categoryAccessor"in e&&!J(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?oe(this.config.categoryAccessor):void 0,n=!0),"sizeAccessor"in e&&!J(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ee(this.config.sizeAccessor,"size"):void 0,n=!0),"symbolAccessor"in e&&!J(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?oe(this.config.symbolAccessor):void 0,n=!0),"colorAccessor"in e&&!J(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0,n=!0),"y0Accessor"in e&&!J(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?ee(this.config.y0Accessor,"y0"):void 0,n=!0,r=!0),("boundsAccessor"in e&&!J(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Ot(this.config),n=!0,r=!0),"pointIdAccessor"in e&&!J(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?oe(this.config.pointIdAccessor):void 0,n=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!J(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!J(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!J(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!J(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ee(this.config.openAccessor,"open"):void 0,this.getHigh=ee(this.config.highAccessor,"high"),this.getLow=ee(this.config.lowAccessor,"low"),this.getClose=t?ee(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,n=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(n=!0,r=!0),!n){const o=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of o)if(e[r]!==t[r]){n=!0;break}}n&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Mo.GROUP_COLOR_MAP_CAP=1e3;var _o=Mo;io(_o);import{memo as Po,useEffect as Ro,useRef as Lo}from"react";var To={sceneGeometry:0,layout:0,domain:0};function $o(e){const{domain:t,layout:o,sceneGeometry:n}=e.revisions;return{domain:t,layout:o,sceneGeometry:n}}function Io(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var No="production"!==process.env.NODE_ENV,Do={revisions:To,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Eo=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=To,this.lastObserved=To,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){No&&(this.lastObserved=Io(this.lastObserved,$o(e)))}beforeCompute(e,t){if(!No)return Do;const o=Io($o(e),this.lastObserved),n=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(o),r=!((i=o).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:o,signature:n,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==n}}afterCompute(e,t,o){if(No){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!o&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function Bo(e){return Lo(new Eo(e))}var Fo=Po(function({store:e,diagnostics:t}){return Ro(()=>{const o=()=>t.observeUpdateResult(e.getUpdateSnapshot());return o(),e.subscribeUpdateResult(o)},[t,e]),null});import*as Ho from"react";function zo(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Ho.createElement(Ho.Fragment,null,...t)}import*as Oo from"react";import{jsx as Wo}from"react/jsx-runtime";var jo={isActive:!1,predicate:()=>!0},Yo=Oo.createContext(null);function Go({value:e,children:t}){return Wo(Yo.Provider,{value:e,children:t})}function Vo(){return Oo.useContext(Yo)??jo}function Xo(e,t){return null!=e?Wo(Go,{value:t,children:e}):e}import{useEffect as qo,useRef as Uo}from"react";function Ko(e,t,o,n){qo(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}function Zo(e,t,o,n){const r=Uo(null);qo(()=>{const i=e.current;if(!i)return;const a=t??null;r.current!==a&&(r.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):o.current=!0,n())},[t,n,e,o])}function Qo(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function Jo(e,t=30){return Math.max((e??4)+5,12,t)}function en(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function tn(e,t){const o=en(e);if(!o)return!1;const n=en(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function on(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var nn=[40,40],rn=[.5,.5];function an(e,t){const[o,n]=e.viewBox??nn,[r,i]=e.anchor??rn,a=n>0?n:1,s=Math.max(0,t)/a,l=(o>0?o:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-r*l,offsetY:-i*c}}function sn(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var ln=null;function cn(e){if("undefined"==typeof Path2D)return null;ln||(ln=new Map);const t=ln.get(e);if(t)return t;const o=new Path2D(e);return ln.size>1024&&ln.clear(),ln.set(e,o),o}function un(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??nn,a=Math.min(1,Math.max(0,o)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===n?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function dn(e,t){const o=an(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function hn(e,t,o,n,r,i=e=>e){for(const a of t.parts){const t=cn(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=r?"none"===a.fill?void 0:r:sn(a.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?a.stroke&&"none"!==a.stroke?r:void 0:sn(a.stroke??"none",o,n);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function fn(e,t,o,n,r,i=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,p=1/0;return e.visit((e,r,l,m,g)=>{if(r>u||c>m||l>h||d>g)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=a(e)-o,u=Math.sqrt(l*l+c*c);Jo(s(e),n)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}var pn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,mn=new WeakMap,gn=0,yn=!1,bn=null,vn=null;function xn(e,t){if(!t)return t;const o=pn.exec(t);if(!o)return t;const n=e.canvas;if(!n)return o[2]?.trim()||t;!function(){if(yn)return;if("undefined"==typeof window||"undefined"==typeof document)return;yn=!0;const e=()=>{gn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{bn=window.matchMedia("(prefers-color-scheme: dark)"),vn=e,"function"==typeof bn.addEventListener?bn.addEventListener("change",vn):"function"==typeof bn.addListener&&bn.addListener(vn)}catch{}}();let r=mn.get(n);r&&r.version===gn||(r={version:gn,map:new Map},mn.set(n,r));const i=r.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(n).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return r.map.set(t,a),a}function kn(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=o,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}var wn=null;function Sn(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(wn||(wn=document.createElement("canvas")),wn.width=e,wn.height=e,wn)}(s)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=n,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}import{jsx as An,jsxs as Cn}from"react/jsx-runtime";function Mn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function _n(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function Pn(e,t){let o=2166136261;const n=_n(t);for(let e=0;n.length>e;e++)o^=n.charCodeAt(e),o=Math.imul(o,16777619);return`${e}-hatch-${(o>>>0).toString(36)}`}var Rn=new Map;function Ln(e,t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*i));return Cn("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[o&&"transparent"!==o&&An("rect",{width:l,height:l,fill:o}),An("line",{x1:0,y1:0,x2:0,y2:l,stroke:n,strokeWidth:r,strokeOpacity:s}),An("line",{x1:i,y1:0,x2:i,y2:l,stroke:n,strokeWidth:r,strokeOpacity:s})]},t)}function Tn(e,t,o="#4e79a7"){if(Mn(e)){const o=Pn(t,e);return{fill:`url(#${o})`,def:Ln(e,o)}}return e&&"string"==typeof e?{fill:e}:{fill:o}}import{curveMonotoneX as $n,curveMonotoneY as In,curveCardinal as Nn,curveCatmullRom as Dn,curveStep as En,curveStepBefore as Bn,curveStepAfter as Fn,curveBasis as Hn,curveNatural as zn}from"d3-shape";function On(e){switch(e){case"monotoneX":return $n;case"monotoneY":return In;case"cardinal":return Nn;case"catmullRom":return Dn;case"step":return En;case"stepBefore":return Bn;case"stepAfter":return Fn;case"basis":return Hn;case"natural":return zn;default:return null}}function Wn(e,t,o){if(null==t)return o;if(Mn(t)){const n=function(e,t){const o="undefined"!=typeof window&&window.devicePixelRatio||1,n=`${_n(e)}@${o}`,r=Rn.get(n);if(void 0!==r)return r;const i=Sn({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Rn.set(n,i),i}(t,e);return n||t.background&&xn(e,t.background)||o}return"string"!=typeof t?t:xn(e,t)||o}function jn(e,t){if(null==t)return;const o=Wn(e,t,"");return""===o?void 0:o}function Yn(e,t,o,n,r,i,a){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const s=e.createLinearGradient(n,r,i,a);for(const e of o)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,r,i,a),[h,f,p]=kn(e,o);return d.addColorStop(0,`rgba(${h},${f},${p},${c})`),d.addColorStop(1,`rgba(${h},${f},${p},${u})`),d}function Gn(e,t,o,n,r,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(o,n,r,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}import{line as Vn}from"d3-shape";var Xn=new WeakMap;function qn(e,t){const o=On(t);if(!o)return e;const n=Xn.get(e);if(n)return n;const r=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let r=null;const i={moveTo(e,t){r=[e,t],n.push([e,t])},lineTo(e,t){r=[e,t],n.push([e,t])},bezierCurveTo(e,t,i,a,s,l){if(!r)return r=[s,l],void n.push([s,l]);const[c,u]=r;for(let r=1;o>=r;r++){const d=r/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*i+d*d*d*s,h*h*h*u+3*h*h*d*t+3*h*d*d*a+d*d*d*l])}r=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){r=[o,i],n.push([o,i])}};return Vn().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),n}(e,o);return Xn.set(e,r),r}function Un(e,t,o,n=30,r,i=0){let a=null;if(r){const e=fn(r,t,o,n,i);e&&(a={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=Zn(i,t,o,n);break;case"symbol":e=Qn(i,t,o,n);break;case"glyph":e=Jn(i,t,o,n);break;case"line":e=er(i,t,o,n);break;case"rect":if(null==i.datum)break;e=or(i,t,o);break;case"heatcell":e=nr(i,t,o);break;case"area":if(!1===i.interactive)break;e=ir(i,t,o);break;case"candlestick":e=rr(i,t,o)}e&&n>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function Kn(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=ar(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let r=n,i=n;n>0&&e[n][0]>=t?(r=n-1,i=n):e.length-1>n&&(r=n,i=n+1);const[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function Zn(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>Jo(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function Qn(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>Jo(It(e.size),n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function Jn(e,t,o,n=30){if(null==e.datum)return null;const r=dn(e.glyph,e.size),i=e.x+r.centerDx,a=e.y+r.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>Jo(r.radius,n)?null:{node:e,datum:e.datum,x:i,y:a,distance:c}}function er(e,t,o,n=30){if(0===e.path.length)return null;const r=ar(e.path,t);if(0>r)return null;const[i,a]=e.path[r];let s;if(e.path.length>1){let n=1/0;const i=Math.max(0,r-1),a=Math.min(e.path.length-2,r);for(let r=i;a>=r;r++){const[i,a]=e.path[r],[s,l]=e.path[r+1],c=tr(t,o,i,a,s,l);n>c&&(n=c)}s=n}else{const e=t-i,n=o-a;s=Math.sqrt(e*e+n*n)}const l=e.style;return s>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:a,distance:s}}function tr(e,t,o,n,r,i){const a=r-o,s=i-n,l=a*a+s*s;if(0===l)return Math.sqrt((e-o)**2+(t-n)**2);let c=((e-o)*a+(t-n)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*a))**2+(t-(n+c*s))**2)}function or(e,t,o){const n=Qo(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function nr(e,t,o){const n=Qo(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function rr(e,t,o){const n=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(i*i+a*a)}}return null}function ir(e,t,o){if(0===e.topPath.length)return null;const n=ar(e.topPath,t);if(0>n)return null;const[r,i]=e.topPath[n],a=t-r,s=o-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:r,y:i,distance:l}}function ar(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const r=o+n>>1;t>e[r][0]?o=r+1:n=r}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}import{useEffect as sr,useRef as lr}from"react";var cr={fresh:1,aging:.7,stale:.45,expired:.25},ur={alpha:1,band:"fresh",isStale:!1};function dr(e,t){if(!e||0>=t)return ur;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,n=e.graded;if(n){const e="object"==typeof n?n:{},r=Ve(t,o,e.thresholds);return{alpha:{...cr,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:ur}function hr(e,t,o,n,r,i){const a=lr("fresh");sr(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=dr(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,r,n,t,i,o])}import{jsx as fr}from"react/jsx-runtime";function pr({isStale:e,position:t}){return fr("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}import{useMemo as mr,useRef as gr,useEffect as yr}from"react";import*as br from"react";import{jsx as vr,jsxs as xr}from"react/jsx-runtime";var kr={fill:(e,t)=>vr("rect",{style:e,width:t,height:t}),line:(e,t)=>vr("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function wr(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,kr[o])(n(e,t),r),i}function Sr({swatchSize:e}){return vr("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ar(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Cr=(e,t,o,n,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const g=!(!t&&!o),y="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=wr(e,c,d,h,b),k=Ar(e,n,r),w=r&&r.size>0&&r.has(e.label);p.push(xr("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&y?w||!1:void 0,"aria-current":g&&!y&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:g?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+f.length)%f.length;l(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(s,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&vr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&vr(Sr,{swatchSize:b}),vr("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Mr({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+br.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),a=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(vr("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return xr("g",{"aria-label":i||"Gradient legend",children:[vr("defs",{children:vr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&vr("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),vr("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),vr("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])}),vr("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(vr("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return xr("g",{"aria-label":i||"Gradient legend",children:[i&&vr("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),vr("defs",{children:vr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),vr("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),vr("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])}),vr("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])})]})}function _r(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),o=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,p]=br.useState(0),[m,g]=br.useState(0),y=br.useCallback((e,t)=>{p(e),g(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(vr("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push(vr("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push(vr("g",{className:"legend-item",transform:`translate(0,${d})`,children:Cr(e,o,n,r,i,a,s,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,o,n,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:g,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,k=!(!t&&!o),w="isolate"===c||void 0===c&&null!=r,S=p.map(e=>g+y+7*e.label.length),A=[];let C=0,M=0;S.forEach((e,t)=>{const o=0===M?e:M+b+e;d&&d>0&&M>0&&o>d?(A.push({start:C,end:t,width:M}),C=t,M=e):M=o}),p.length>0&&A.push({start:C,end:p.length,width:M}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=wr(e,d,h,f,g),A=Ar(e,n,r),C=r&&r.size>0&&r.has(e.label);m.push(xr("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?s===i&&d===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:k?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+p.length)%p.length;l(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(s,d),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&vr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+y+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,C&&vr(Sr,{swatchSize:g}),vr("text",{y:g/2,x:g+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const _=Math.max(0,...A.map(e=>e.width)),P=A.length;return{items:m,offset:_,totalRows:P,totalHeight:P*v}})(e,n,r,i,a,s,l,t,c,u,d,d.maxWidth??o);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??o;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const g=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(g.push(vr("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+n)),m+=16),g.push(vr("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+n)),m+=o.offset+5,e[n+1]&&g.push(vr("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),m+=12}),vr("g",{children:g})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),v=!(!o&&!n);return xr("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&vr("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),b]})}function Pr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as Rr}from"react/jsx-runtime";function Lr(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!s,m=Math.max(0,o-r.left-r.right),g=Math.max(1,f?a?.maxWidth??m:100);let y,b;return"left"===i?(y=Math.max(4,r.left-g-10),b=r.top):"top"===i?(y=r.left,b=p?32:8):"bottom"===i?(y=r.left,b=n-r.bottom+38):(y=o-r.right+10,b=r.top),Rr("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?Rr(Mr,{config:t.gradient,orientation:f?"horizontal":"vertical",width:g}):Pr(t)?Rr(_r,{legendGroups:t.legendGroups,title:"",width:g,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}import{useMemo as Tr}from"react";import{bin as $r}from"d3-array";import{jsx as Ir,jsxs as Nr}from"react/jsx-runtime";function Dr(e){return"string"==typeof e?{type:e}:e}function Er({orient:e,config:o,values:n,scale:r,size:i,length:a}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(o),l="top"===e||"bottom"===e,c=Tr(()=>{if(0===n.length)return null;const o=r.domain(),c=i-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],r=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],a=i-n;return{q1:n,median:r,q3:i,whiskerLow:Math.max(t[0],n-1.5*a),whiskerHigh:Math.min(t[o-1],i+1.5*a)}}(n);if(!t)return null;const{q1:o,median:i,q3:a,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*c,20),f=(c-h)/2+4;if(l){const t=r(o),n=r(a),l=r(i),c=r(u),p=r(d),m="top"===e?-1:1,g=0;return Nr("g",{"data-testid":"marginal-boxplot-"+e,children:[Ir("line",{x1:c,y1:g+m*(f+h/2),x2:p,y2:g+m*(f+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("line",{x1:c,y1:g+m*f,x2:c,y2:g+m*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("line",{x1:p,y1:g+m*f,x2:p,y2:g+m*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("rect",{x:Math.min(t,n),y:"top"===e?g-f-h:g+f,width:Math.abs(n-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),Ir("line",{x1:l,y1:"top"===e?g-f-h:g+f,x2:l,y2:"top"===e?g-f:g+f+h,stroke:s.fill,strokeWidth:2})]})}{const t=r(o),n=r(a),l=r(i),c=r(u),p=r(d),m="left"===e?-1:1,g=0;return Nr("g",{"data-testid":"marginal-boxplot-"+e,children:[Ir("line",{x1:g+m*(f+h/2),y1:c,x2:g+m*(f+h/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("line",{x1:g+m*f,y1:c,x2:g+m*(f+h),y2:c,stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("line",{x1:g+m*f,y1:p,x2:g+m*(f+h),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),Ir("rect",{x:"left"===e?g-f-h:g+f,y:Math.min(t,n),width:h,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),Ir("line",{x1:"left"===e?g-f-h:g+f,y1:l,x2:"left"===e?g-f:g+f+h,y2:l,stroke:s.fill,strokeWidth:2})]})}}const u=$r().domain(o).thresholds(s.bins)(n);if(0===u.length)return null;const d=t(u.map(e=>e.length));if(0===d)return null;if("histogram"===s.type)return Ir("g",{"data-testid":"marginal-histogram-"+e,children:u.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const n=t.length/d*c;if(l){const i=r(t.x0),a=r(t.x1)-r(t.x0);return Ir("rect",{x:i,y:"top"===e?-4-n:4,width:Math.max(a,.5),height:n,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}{const i=r(t.x0),a=r(t.x1)-r(t.x0);return Ir("rect",{x:"left"===e?-4-n:4,y:Math.min(i,i+a),width:n,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}})});if("violin"===s.type){const t=c/2+4,o=[];for(const n of u){if(null==n.x0||null==n.x1)continue;const i=n.length/d*(c/2),a=r((n.x0+n.x1)/2);o.push(l?`${a},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${a}`)}for(let n=u.length-1;n>=0;n--){const i=u[n];if(null==i.x0||null==i.x1)continue;const a=i.length/d*(c/2),s=r((i.x0+i.x1)/2);o.push(l?`${s},${"top"===e?-(t+a):t+a}`:`${"left"===e?-(t+a):t+a},${s}`)}return Ir("g",{"data-testid":"marginal-violin-"+e,children:Ir("polygon",{points:o.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(l){const o=0,n=null!=u[0].x0?r(u[0].x0):0;t.push(`M${n},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const n=o.length/d*c,i=r((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-n-4:n+4}`)}const i=null!=u[u.length-1].x1?r(u[u.length-1].x1):a;t.push(`L${i},${o}`),t.push("Z")}else{const o=0,n=null!=u[0].x0?r(u[0].x0):0;t.push(`M${o},${n}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const n=o.length/d*c,i=r((o.x0+o.x1)/2);t.push(`L${"left"===e?-n-4:n+4},${i}`)}const i=null!=u[u.length-1].x1?r(u[u.length-1].x1):a;t.push(`L${o},${i}`),t.push("Z")}return Ir("g",{"data-testid":"marginal-ridgeline-"+e,children:Ir("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,r,s,i,a,e,l,4]);return c?Ir("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:c}):null}import*as Br from"react";import{jsx as Fr,jsxs as Hr}from"react/jsx-runtime";function zr(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>n?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Or(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Wr(e,t,o,n){if(!e)return Fr("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return Fr("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:zr(i,l):[],m=r?c?[r]:zr(r,l):[],g="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Fr("foreignObject",{className:"annotation-note-html",x:"end"===h?g-l:"middle"===h?g-l/2:g,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:Hr("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Fr("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&Fr("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(b.push(Fr("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>Fr("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=p.length*f),m.length>0&&b.push(Fr("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:m.map((e,t)=>Fr("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=Fr("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=Fr("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+m.length-1)*f;let w=0;return"topBottom"===u?w=0>o?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),Hr("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[Fr("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),x]})}function jr(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Fr("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push(Fr("rect",{width:e,height:n,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=n||0,a=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push(Fr("line",{x1:n,y1:(t.y1||0)-a,x2:n,y2:(t.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-a;i.push(Fr("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Fr("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Fr("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push(Fr("path",{d:Or(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Fr("g",{className:"annotation-subject",children:i})}function Yr(e,t,o,n,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;s=r+a*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(s=e/2,l=o):void 0!==t&&(s=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);s=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-s);if(i){const n=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(o?.curve??.25)*c,p=n+d*f,m=i+h*f;a.push(Fr("path",{className:"connector-curve",d:`M${s},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,p-s)}else a.push(Fr("line",{x1:s,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;a.push(Fr("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return Fr("g",{className:"annotation-connector",children:a})}function Gr(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:g={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(f)?f:[]);let k=n||0,w=r||0;null!=i&&(k=i-b),null!=a&&(w=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Hr("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...g,children:[!x.has("connector")&&Yr(k,w,l,d,S,c),!x.has("subject")&&jr(S,c,d,b,v),!x.has("note")&&Wr(s,k,w,d)]})}function Vr(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return Fr(Gr,{"data-testid":"semiotic-annotation",...a,type:n},"multi-annotation-"+i)});return Fr("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Fr(Gr,{"data-testid":"semiotic-annotation",events:r,...t,type:n},a)}import{packEnclose as Xr}from"d3-hierarchy";import{area as qr,curveLinear as Ur,curveMonotoneX as Kr,curveMonotoneY as Zr,curveStep as Qr,curveStepAfter as Jr,curveStepBefore as ei,curveBasis as ti,curveCardinal as oi,curveCatmullRom as ni}from"d3-shape";function ri(e){return Math.round(100*e)/100}function ii(e,t=2){const o=[],n=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[o,n]of e)null!==n&&(i+=o**t*n);o.push(i);const a=[];for(let o=0;r>o;o++){let n=0;for(const[r,i]of e)null!==i&&(n+=r**(t+o));a.push(n)}n.push(a)}n.push(o);const i=function(e,t){const o=e,n=e.length-1,r=[t];for(let e=0;n>e;e++){let t=e;for(let r=e+1;n>r;r++)Math.abs(o[e][r])>Math.abs(o[e][t])&&(t=r);for(let r=e;n+1>r;r++){const n=o[r][e];o[r][e]=o[r][t],o[r][t]=n}for(let t=e+1;n>t;t++)for(let r=n;r>=e;r--)o[r][t]-=o[r][e]*o[e][t]/o[e][e]}for(let e=n-1;e>=0;e--){let t=0;for(let i=e+1;n>i;i++)t+=o[i][e]*r[i];r[e]=(o[n][e]-t)/o[e][e]}return r}(n,r).map(ri);return{points:e.map(([e])=>[ri(e),ri(i.reduce((t,o,n)=>t+o*e**n,0))]),equation:[...i].reverse()}}function ai(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function si(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function li(e){return null==e?null:e+""}function ci(e,t,o){return t.stickyPositionCache?.set(e,o),o}function ui(e,t,o){const n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return ci(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],a=o[e.yAccessor||"y"];return null==i||null==a?null:{x:n(i),y:r(a)}}(o);return n?ci(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return li(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>li(e.pointId)===n);if(r)return ci(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return li(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const a=ai(i,o),s=si(i,o);return null==a||null==s?null:ci(t,o,{x:a,y:s})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=ai(e,o),i=si(e,o)),null!=r&&null!=i)return ci(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function di(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}import{jsx as hi}from"react/jsx-runtime";var fi={secondary:0,primary:3},pi=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function mi(e){return!0===e?._annotationDeferred}function gi(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function yi(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function bi(e){return Math.max(.72,.95-.06*e)}import*as vi from"react";var[xi,ki]=z(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function wi(e){const t=ki(e=>e.pushObservation),o=vi.useCallback(o=>{e.onObservation?.(o),t?.(o)},[e,t]);return vi.useMemo(()=>({...e,onObservation:o}),[o,e])}function Si(e){const t=e.provenance,o=e.id??e.stableId??t?.stableId;return null==o||""===o?void 0:o+""}function Ai(e,t={}){const o=Si(e);return{"data-semiotic-annotation-widget":"",...o?{"data-semiotic-annotation-id":o}:{},onClickCapture(n){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(n);t.onAnnotationActivate?.({annotation:e,annotationId:o,chartId:t.chartId,inputType:r}),o&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:o,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Ci(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}import{jsx as Mi,jsxs as _i}from"react/jsx-runtime";var Pi="var(--semiotic-bg, #ffffff)";function Ri(e,t){return(e+"").length*t*.6}function Li(e){const{x:t,y:o,text:n,fill:r,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>Mi("text",{x:t,y:o,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:a,fontFamily:s,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:n});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Pi,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,g="number"==typeof p?p:p.y,y=Ri(n,i),b=i+2*g;let v,x;return v="middle"===l?t-y/2-m:"end"===l?t-y-m:t-m,x="middle"===c||"central"===c?o-b/2:"hanging"===c||"text-before-edge"===c?o-g:o-.8*i-g,_i("g",{className:d,children:[Mi("rect",{x:v,y:x,width:y+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Pi,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}import{jsx as Ti,jsxs as $i}from"react/jsx-runtime";var Ii={linear:Ur,monotoneX:Kr,monotoneY:Zr,step:Qr,stepAfter:Jr,stepBefore:ei,basis:ti,cardinal:oi,catmullRom:ni};function Ni(e,t,o,n){const r=[];return e.forEach((e,i)=>{let a;if(o){const r=o(e,i,n);a=null!=r?r:t(e,i,n)}else a=t(e,i,n);a&&r.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:yi(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>mi(e.annotation)),r=e.some(e=>null!=gi(e.annotation)),i=e.some(e=>"layer"===gi(e.annotation));if(!o&&!n&&!r)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=fi[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=mi(t.annotation);let a=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;a=hi("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:bi(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const s=gi(t.annotation);return s&&(a=hi("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+o)),i&&(a=hi("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return n&&s.unshift(hi("style",{children:pi},"annotation-disclosure-style")),i&&s.unshift(hi("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(r)}function Di(e,t={}){return function(e,o,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=ui(e,o,r);if(!t)return null;const{x:n,y:i}=t;if(!di(n,i,r))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return Ti(Vr,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+o)}case"x-threshold":{const t=ai(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const s=t>.6*(r.width||0),l=s?t-4:t+4,c=s?"end":"start";return $i("g",{opacity:e.opacity,children:[Ti("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Ti(Li,{x:l,y:a,text:e.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"y-threshold":{const t=si(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return $i("g",{opacity:e.opacity,children:[Ti("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Ti(Li,{x:a,y:c,text:e.label,textAnchor:l,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:ai({...e,type:"point"},r),y:si({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=Xr(t),i=e.padding||10;return $i("g",{children:[Ti("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Ti(Li,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+o)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:ai({...e,type:"point"},r),y:si({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=e.padding||10,a=t.map(e=>e.x),s=t.map(e=>e.y),[l,c]=n(a),[u,d]=n(s),h=l-i,f=c+i,p=u-i;return $i("g",{children:[Ti("rect",{x:h,y:p,width:f-h,height:d+i-p,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Ti(Li,{x:(h+f)/2,y:p-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+o)}case"highlight":{const t=r.data||[],n="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return Ti("g",{children:n.map((t,o)=>{const n=ai(t,r),a=si(t,r);if(null==n||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return Ti("circle",{cx:n,cy:a,r:s,...l},"hl-"+o)})},"ann-"+o)}case"bracket":{const t=ai(e,r),n=si(e,r);return Ti(Vr,{noteData:{x:t??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+o)}case"trend":{const t=r.data||[];if(2>t.length)return null;const n=r.xAccessor||"x",i=r.yAccessor||"y",a="ordinal"===r.frameType,s="horizontal"===r.projection,l=a?n:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=t.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const n=h.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},g=f,y=p;let b;if(a)if(s){const e=m(y);b=(t,o)=>[g(o),e(t)]}else{const e=m(g);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[g(e),y(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),r=n.map(e=>e[0]),i=n.map(e=>e[1]),a=Math.max(2,Math.ceil(t*o)),s=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(a-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))s.push([t,h/u]);else{const e=(u*p-d*h)/m;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3);else{const t="polynomial"===v?ii(u,e.order||2):function(e){const t=[0,0,0,0];let o=0;for(const[n,r]of e)null!==r&&(o++,t[0]+=n,t[1]+=r,t[2]+=n*n,t[3]+=n*r);const n=o*t[2]-t[0]*t[0],r=0===n?0:ri((o*t[3]-t[0]*t[1])/n),i=ri(t[1]/o-r*t[0]/o);return{points:e.map(([e])=>[ri(e),ri(r*e+i)]),equation:[r,i]}}(u);x=t.points}const k=x.map(([e,t])=>{const[o,n]=b(e,t);return`${o},${n}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return $i("g",{children:[Ti("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Ti("text",{x:A+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+o)}case"band":{const t=r.scales?.y??r.scales?.value,n=t?.(e.y0)??0,s=t?.(e.y1)??(r.height||0),l=Tn(e.fill,"ann-"+o,"var(--semiotic-primary, #6366f1)");return $i("g",{opacity:e.opacity,children:[l.def&&Ti("defs",{children:l.def}),Ti("rect",{x:0,y:Math.min(n,s),width:r.width||0,height:Math.abs(s-n),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&Ti(Li,{x:(r.width||0)-4,y:(i=n,a=s,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+o)}case"x-band":{const t=r.scales?.x??r.scales?.time,n=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==n||null==i)return null;const a=Tn(e.fill||e.color,"ann-"+o,"var(--semiotic-primary, #6366f1)");return $i("g",{opacity:e.opacity,children:[a.def&&Ti("defs",{children:a.def}),Ti("rect",{x:Math.min(n,i),y:0,width:Math.abs(i-n),height:r.height||0,fill:a.fill,fillOpacity:e.fillOpacity??.1}),e.label&&Ti(Li,{x:Math.min(n,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+o)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const n=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=Ii[r.curve||"linear"]||Ur,h=qr().x(e=>i(e[n])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return $i("g",{children:[Ti("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&Ti("text",{x:i(u[u.length-1][n])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+o)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const n=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=t.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=a(l+d*u),v=a(h),x=t.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return $i("g",{children:[f&&Ti("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const o=ai(e,r),n=si(e,r);return null==o||null==n?null:Ti("circle",{cx:o,cy:n,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&Ti("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+o)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const n=r.xAccessor||"x",i=r.yAccessor||"y",a=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!a||!s)return null;const l=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=ii(l,e.order||2).equation;c=e=>t.reduce((t,o,n)=>t+o*Math.pow(e,n),0)}else{const e=l.length;let t=0,o=0,n=0,r=0;for(const[e,i]of l)t+=e,o+=i,n+=e*e,r+=e*i;const i=e*n-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*o)/i,s=(o-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),g=e.confidence??.95,y=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(v+e*x);const w=[];for(const e of k){const t=c(e),o=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*y;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,A=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),C=`${a(v)},${s(c(v))}`,M=e.strokeColor||"#6366f1";return $i("g",{children:[Ti("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),Ti("polyline",{points:`${C} ${A}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&Ti("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+o)}case"widget":{let n,i;if(null!=e.px&&null!=e.py)n=e.px,i=e.py;else{const t=ui(e,o,r);if(!t)return null;n=t.x,i=t.y}if(!di(n,i,r))return null;const a=e.dx??0,s=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??Ti("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return Ti("foreignObject",{x:n+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:Ti("div",{...Ai(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=ui(e,o,r);if(!t)return null;const{x:n,y:i}=t,a=n+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=Ti("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Br.cloneElement(c,{key:"ann-text-"+o}):$i("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[Ti("line",{x1:n,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Br.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const t=e.category;if(null==t)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,a=r.scales?.x,s=r.scales?.y,l=n(i)?i:n(a)?a:n(s)?s:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return $i("g",(r.projection?"vertical"===r.projection:l===a)?{children:[Ti("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&Ti(Li,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[Ti("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&Ti(Li,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+o)}default:return null}var i,a,s}}var Ei=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Bi(e){return!!e&&"object"==typeof e&&Ei.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Fi(e){return"primary"===e?.emphasis||!0===e?.defensive}function Hi(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function zi(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*Math.max(0,Math.min(1,n))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Oi=32,Wi=6,ji=4,Yi=8,Gi=72;var Vi={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Xi(e){if(!qi(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function qi(e){return Bi(e)}function Ui(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Ki(e,t,o,n,r){const i=e+o,a=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?a-r.height:a,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?a-r.height-4:a+4,width:r.width,height:r.height}}function Zi(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Qi(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Ji(e,t,o,n,r,i,a,s){const l=Zi(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,s);for(const e of o)c+=12*Qi(l,e);for(const e of n)c+=4*Qi(l,e);return c}function ea(e){const{annotations:t,context:o,defaultOffset:n=Oi,notePadding:r=Wi,markPadding:i=ji,edgePadding:a=Yi,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Gi,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:g}=e,y=o.width||0,b=o.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,k=!!p&&x>=y,w=k&&!1!==v.preferShortText?t.map(Xi):t,S=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=k&&!f?v.responsive??{minWidth:x}:f,M=k&&!m?v.cohesion:m;if(0===w.length||0>=y||0>=b)return w.slice();const _=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let R=!1;const L=w.map((e,t)=>{if(!qi(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const n=e.pointId??e.nodeId;if(null!=n&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?ui(e,t,o):{x:e.x,y:e.y}}(e,t,o);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...Ui("string"==typeof e.title?e.title:void 0,t),...Ui("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return _.push(Zi(Ki(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(n)){const t=Ji(Ki(i.x,i.y,e.dx,e.dy,u),e,_,P,y,b,r,a);f>t&&(h=e,f=t)}if(!h)return e;const p=Zi(Ki(i.x,i.y,h.dx,h.dy,u),r);_.push(p);const m=Math.hypot(h.dx,h.dy),g=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),T=R?L:w.slice();let $=T;if(h){let e=!1;const t=T.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});$=e?t:T}{let e=!1;const t=$.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?Vi[t.source]??t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!n)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,n].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return o!==t&&(e=!0),o});$=e?t:$}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(g),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Hi(y,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=Hi(o,n,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,Bi(o))};var o}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>Fi(e.annotation)),c=s.filter(e=>!Fi(e.annotation)).sort((e,t)=>zi(t.annotation)-zi(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of a)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:$,width:y,height:b,...o});for(const e of n)I.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of $)qi(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of $)!0===e?.defensive&&I.delete(e);let N;return N=0===I.size?$:A?$.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):$.filter(e=>!I.has(e)),M?function(e,t){let o=!1;const n=e.map(e=>qi(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}(N,M):N}import{useSyncExternalStore as ta}from"react";var oa={positions:new Map},na=new Set;function ra(){for(const e of na)e()}function ia(e,t){const o=oa.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(oa.positions);n.delete(e),oa={positions:n},ra()}function aa(e,t){const o=oa.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(oa.positions);n.delete(e),oa={positions:n},ra()}function sa(){return oa}function la(e){return na.add(e),()=>na.delete(e)}var ca={positions:new Map};function ua(){return()=>{}}function da(){return ca}function ha(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,a=n instanceof Date?n.getTime():n,s=r instanceof Date?r.getTime():r;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?s:a+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}function fa(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function pa(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function ma(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function ga(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ya(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+n;for(let e=0;i>e;e++){const o=8*(e+1);a+=`L${Math.min(8*e+4,t)},${n+4*r}`,a+=`L${Math.min(o,t)},${n}`}return a}const n="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(o/8);let a=`M${n},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${n+4*r},${Math.min(8*e+4,o)}`,a+=`L${n},${Math.min(t,o)}`}return a}import{Fragment as ba,jsx as va,jsxs as xa}from"react/jsx-runtime";function ka(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,f=mr(()=>{if(!a)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||u||wa,n=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===h?Math.max(2,r):Math.min(r,n),s=e?.tickValues??ha(a.x,i,h),c=s.map(e=>e.valueOf()),d=s.map((e,t)=>({value:e,pixel:a.x(e),label:o(e,t,c)})),f=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Sa(d,Math.max(55,f+8))},[a,l,u,t,h]),p=mr(()=>{if(!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||wa,n=Math.max(2,Math.floor(o/30)),r=e?.ticks??5,i="exact"===h?Math.max(2,r):Math.min(r,n);return Sa((e?.tickValues??ha(a.y,i,h)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[a,l,d,o,h]),m=c&&a,g=s&&a;if(!m&&!g)return null;const y=l?.find(e=>"bottom"===e.orient),b=l?.find(e=>"left"===e.orient),v=g&&(!y||!1!==y.baseline),x=g&&(!b||!1!==b.baseline),k=y?.jaggedBase||!1,w=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return va("svg",{width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:xa("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(()=>{const e=ga(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=ga(l?.find(e=>"left"===e.orient)?.gridStyle);return xa("g",{className:"stream-grid",children:[f.map((t,n)=>va("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),p.map((e,o)=>va("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),v&&!k&&va("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),k&&va("path",{d:ya("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!w&&va("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),w&&va("path",{d:ya("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function wa(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Sa(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function Aa(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:f,axisExtent:p,showGrid:m,title:g,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:_,annotations:P,onAnnotationActivate:R,onObservation:L,chartId:T,chartType:$,autoPlaceAnnotations:I,svgAnnotationRules:N,xAccessor:D,yAccessor:E,annotationData:B,pointNodes:F,curve:H,underlayRendered:z,canvasObscuresUnderlay:O=!0,linkedCrosshairName:W,linkedCrosshairSourceId:j,children:Y}=e,G=wi({onAnnotationActivate:R,onObservation:L,chartId:T,chartType:$}),V=mr(()=>{if(!s||!a)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||h||wa,n=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,n),c=e?.tickValues??ha(a.x,i,p),u=c.map(e=>e.valueOf()),d=c.map((e,t)=>({value:e,pixel:a.x(e),label:o(e,t,u)})),f=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),m=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let g=Sa(d,m);if(g.length>1&&(g=g.filter((e,t)=>0===t||e.label+""!=g[t-1].label+"")),e?.includeMax&&g.length>0&&"exact"!==p&&!e?.tickValues){const e=a.x.domain()[1],t=a.x(e),n=g[g.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e,g.length,u);m>t-n&&g.length>1&&(g=g.slice(0,-1)),g.push({value:e,pixel:t,label:r})}}return g},[s,a,l,h,t,p]),X=mr(()=>{if(!s||!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||wa,n=Math.max(2,Math.floor(o/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,n);let c=Sa((e?.tickValues??ha(a.y,i,p)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=a.y.domain()[1],o=a.y(e),n=c[c.length-1].pixel;if(Math.abs(o-n)>1){const r=t(e);22>Math.abs(o-n)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:o,label:r})}}return c},[s,a,l,f,o,p]),q=mr(()=>{if(!s||!a)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||wa,n=Math.max(2,Math.floor(o/30)),r=e.ticks??5;return Sa((e.tickValues??ha(a.y,"exact"===p?Math.max(2,r):Math.min(r,n),p)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[s,a,l,f,o,p]),U=gr(new Map),K=gr(P?.length??0),Z=P?.length??0;K.current!==Z&&(K.current=Z,U.current=new Map);const Q=mr(()=>{if(!P||0===P.length)return null;const e=Di(0,G),n={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:D,yAccessor:E,width:t,height:o,data:B,frameType:"xy",pointNodes:F,curve:H,stickyPositionCache:U.current};return Ni(I?ea({annotations:P,context:n,..."object"==typeof I?I:{}}):P,e,N,n)},[P,I,N,t,o,D,E,B,a,F,H,G]),J=function(e){const t=ta(e?la:ua,e?sa:da,e?sa:da);return e?t.positions.get(e)??null:null}(W);return yr(()=>{if(!J?.locked||!W)return;const e=e=>{"Escape"===e.key&&aa(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[J?.locked,W]),s||g||y||A||C||Q&&Q.length>0||m||Y||J?xa("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[va("title",{children:"string"==typeof g?g:"XY Chart"}),va("desc",{children:"string"==typeof g?g+" — XY data visualization":"XY data visualization"}),xa("g",{transform:`translate(${i.left},${i.top})`,children:[m&&a&&(!z||O)&&(()=>{const e=ga(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=ga(l?.find(e=>"left"===e.orient)?.gridStyle);return xa("g",{className:"stream-grid",children:[V.map((t,n)=>va("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),X.map((e,o)=>va("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),s&&a&&(()=>{const e=l?.find(e=>"left"===e.orient),n=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,a=!n||!1!==n.baseline,s=e?.jaggedBase||!1,h=n?.jaggedBase||!1,f=n?.landmarkTicks,p=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",b=!!n?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v=b?12:18,x=o+(b?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=n?.tickAnchor,C=e?.tickAnchor,M=ma(V),_=ma(X);return xa("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[xa("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!z||O)&&a&&!h&&va("line",{x1:0,y1:o,x2:t,y2:o,stroke:m,strokeWidth:1}),(!z||O)&&h&&va("path",{d:ya("bottom",t,o),fill:"none",stroke:m,strokeWidth:1}),V.map((e,t)=>{const n=!!f&&("function"==typeof f?f(e.value,t):tn(e.value,t>0?V[t-1].value:void 0));return xa("g",{transform:`translate(${e.pixel},${o})`,children:[va("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?va("text",{y:v,textAnchor:b?"end":fa(A,e.pixel===M.min,e.pixel===M.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},transform:b?"rotate(-45)":void 0,children:e.label}):va("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:va("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&va("text",{x:t/2,y:x,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),xa("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!z||O)&&r&&!s&&va("line",{x1:0,y1:0,x2:0,y2:o,stroke:m,strokeWidth:1}),(!z||O)&&s&&va("path",{d:ya("left",t,o),fill:"none",stroke:m,strokeWidth:1}),X.map((e,t)=>{const o=!!p&&("function"==typeof p?p(e.value,t):tn(e.value,t>0?X[t-1].value:void 0));return xa("g",{transform:`translate(0,${e.pixel})`,children:[va("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?va("text",{x:-8,textAnchor:"end",dominantBaseline:pa(C,e.pixel===_.min,e.pixel===_.max),fontWeight:o?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):va("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:va("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?va("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===q.length)return null;const n=!1!==e.baseline,r=e.landmarkTicks,a=e.label||d,s=e.tickAnchor,c=ma(q);return xa("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&va("line",{x1:t,y1:0,x2:t,y2:o,stroke:m,strokeWidth:1}),q.map((e,o)=>{const n=!!r&&("function"==typeof r?r(e.value,o):tn(e.value,o>0?q[o-1].value:void 0));return xa("g",{transform:`translate(${t},${e.pixel})`,children:[va("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?va("text",{x:8,textAnchor:"start",dominantBaseline:pa(s,e.pixel===c.min,e.pixel===c.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):va("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:va("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+o)}),a&&va("text",{x:t+i.right-15,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${t+i.right-15}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:a})]})})()]})})(),Q,C&&a&&M&&_&&xa(ba,{children:[C.top&&va("g",{transform:"translate(0, 0)",children:va(Er,{orient:"top",config:Dr(C.top),values:M,scale:a.x,size:i.top,length:t})}),C.bottom&&va("g",{transform:`translate(0, ${o})`,children:va(Er,{orient:"bottom",config:Dr(C.bottom),values:M,scale:a.x,size:i.bottom,length:t})}),C.left&&va("g",{transform:"translate(0, 0)",children:va(Er,{orient:"left",config:Dr(C.left),values:_,scale:a.y,size:i.left,length:o})}),C.right&&va("g",{transform:`translate(${t}, 0)`,children:va(Er,{orient:"right",config:Dr(C.right),values:_,scale:a.y,size:i.right,length:o})})]}),A,J&&J.sourceId!==j&&a?.x&&(()=>{const e=a.x(J.xValue);if(null==e||0>e||e>t)return null;const n=J.locked;return va("line",{x1:e,y1:0,x2:e,y2:o,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),g&&"string"==typeof g?va("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:g}):g?va("foreignObject",{x:0,y:0,width:n,height:i.top,children:g}):null,Lr({legend:y,totalWidth:n,totalHeight:r,margin:i,legendPosition:w,title:g,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k})]}):null}import*as Ca from"react";import{arc as Ma}from"d3-shape";function _a(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Pa(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(e??0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}var Ra=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function La(e){const{innerRadius:t,outerRadius:o,startAngle:n,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=Ra(o,n),t=Ra(o,r);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${r-n>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Ra(o,n),a=Ra(o,r),s=Ra(t,r),l=Ra(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===a)return La({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,o-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return La({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?s:0),p=r-(h?s:0),m=n+(d?l:0),g=r-(h?l:0),y=Ra(o,f),b=Ra(o,p),v=(o-a)*Math.cos(s),x=Ra(v,n),k=Ra(v,r),w=i?null:Ra(t,g),S=i?null:Ra(t,m),A=i?0:(t+a)*Math.cos(l),C=i?null:Ra(A,n),M=i?null:Ra(A,r),_=p-f>Math.PI?1:0,P=i?0:g-m>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${a},${a} 0 0 1 ${y.x},${y.y}`;else{const e=Ra(o,n);R+=`M${e.x},${e.y}`}if(h)R+=` A${o},${o} 0 ${_} 1 ${b.x},${b.y}`,R+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=Ra(o,r);R+=` A${o},${o} 0 ${_} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${M.x},${M.y}`,R+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=Ra(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${P} 0 ${S.x},${S.y}`,R+=` A${a},${a} 0 0 1 ${C.x},${C.y}`;else{const e=Ra(t,n);R+=` A${t},${t} 0 ${P} 0 ${e.x},${e.y}`}}return R+=" Z",R}function Ta(e){const t=La({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let r=0;n.length>r;r++)o.push({d:La({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}import{jsx as $a,jsxs as Ia}from"react/jsx-runtime";var Na={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Da(e,t="#4e79a7"){return Mn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function Ea(e,t,o){const n=$t(e.symbolType,e.size,e.path);return $a("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Da(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}function Ba(e,t,o,n){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=an(r,e.size);if(0>=i.scale)return null;const a=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=un(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Fa(n+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((o,n)=>{const r=t?"none"===o.fill?void 0:t:sn(o.fill,s,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:sn(o.stroke??"none",s,e.accent);return r||i?$a("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return Ia("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&$a("clipPath",{id:c,children:$a("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?$a("g",{children:d(e.ghostColor)}):null,l&&c?$a("g",{clipPath:`url(#${c})`,children:d()}):d()]},n)}function Fa(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Ha="undefined"==typeof window||"undefined"==typeof document;import{useEffect as za,useLayoutEffect as Oa,useRef as Wa,useState as ja,useSyncExternalStore as Ya}from"react";var Ga="undefined"!=typeof window?Oa:za;function Va(){const[e,t]=ja(!1);return Ga(()=>{t(!0)},[]),e}var Xa=()=>()=>{},qa=()=>!1,Ua=()=>!0;function Ka(){const e=Ya(Xa,qa,Ua);return Wa(e).current}import{useRef as Za}from"react";function Qa(e){const t=Za(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return es(e,t);if(!ts(e)||!ts(t))return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],r=t[n];if(!Object.is(o,r))if(Array.isArray(o)&&Array.isArray(r)){if(!es(o,r))return!1}else{if(!ts(o)||!ts(r))return!1;if(!Ja(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function Ja(e,t){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function es(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function ts(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function os(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:a=0,width:s,height:l}=t;if("transparent"===o)return!1;if(n)return!1;const c=o||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=xn(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,a,s,l),!0)}var ns={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function rs(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],r=o[3];return`#${e}${e}${n}${n}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}import*as is from"react";import*as as from"react";import{jsx as ss}from"react/jsx-runtime";var ls=as.createContext(null);function cs({children:e}){const[t,o]=as.useState(!1),n=as.useCallback(()=>o(e=>!e),[]),r=as.useMemo(()=>({visible:t,setVisible:o,toggle:n}),[t,n]);return ss(ls.Provider,{value:r,children:e})}function us(){return as.useContext(ls)}import{jsx as ds}from"react/jsx-runtime";var hs={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function fs({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return ds("div",{"aria-live":"polite","aria-atomic":"true",style:hs,children:t})}function ps(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}function ms(e){return e&&"object"==typeof e?e:{}}function gs(e){return ms(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as ys,jsxs as bs}from"react/jsx-runtime";function vs(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of a)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}function xs(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}var ks=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ws="semiotic-accessible-data-table",Ss=ws+" semiotic-accessible-data-table-hidden",As=ws+" semiotic-accessible-data-table-visible",Cs=As+" semiotic-accessible-data-table-network",Ms={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},_s={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ps={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Rs={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ls={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Ts={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},$s={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Is={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Ns({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=is.useState(!1),[a,s]=is.useState(5),l=us(),c=l?.visible??!1,u=r||c,d=is.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;is.useEffect(()=>{u||s(5)},[u]);const f=is.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=is.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?ys("span",{id:o,tabIndex:-1,style:hs}):null;if(!u)return ys("div",{id:o,className:Ss,tabIndex:-1,onFocus:f,style:hs,role:"region","aria-label":h,children:bs("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:ps(gs(n))});break;case"line":case"area":{const e=gs(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:ps(e)});break}case"rect":{const e=gs(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,a=ps(o);null==a.category&&""!==r&&(a.category=r+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=ps(gs(n));null==e.value&&"number"==typeof n.value&&Number.isFinite(n.value)&&(e.value=n.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=gs(n),o=ps(e);if(null==o.category){const t=ms(e),n=t.category??t.label;null!=n&&(o.category=n+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:ps(gs(n))});break;case"arc":t.push({label:"Arc",values:ps(gs(n))});break;case"candlestick":t.push({label:"Candlestick",values:ps(gs(n))});break;case"geoarea":{const e=ms(gs(n)),o=ps(e);if(null==o.name){const t=ms(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${ks(e.min)} to ${ks(e.max)}, mean ${ks(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,g),b=Math.min(a,m.length),v=m.slice(0,b),x=m.length-b,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return bs("div",{ref:d,id:o,className:As,tabIndex:-1,onBlur:p,style:Ms,role:"region","aria-label":h,children:[ys("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Ps,children:"×"}),ys("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:_s,children:y}),bs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Rs,children:[ys("caption",{className:"semiotic-accessible-data-table-caption",style:$s,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),ys("thead",{children:bs("tr",{children:[ys("th",{style:Ls,children:"type"}),w.map(e=>ys("th",{style:Ls,children:e},e))]})}),ys("tbody",{children:v.map((e,t)=>bs("tr",{children:[ys("td",{style:Ts,children:e.label}),w.map(t=>{return ys("td",{style:Ts,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ks(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&bs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Is,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Ds({nodes:e,edges:t,chartType:o,tableId:n,chartTitle:r}){const[i,a]=is.useState(!1),[s,l]=is.useState(5),c=us(),u=c?.visible??!1,d=i||u,h=r?"Data summary for "+r:n?`Data summary for ${o} ${n}`:"Data summary for "+o,f=is.useRef(null);is.useEffect(()=>{d||l(5)},[d]);const p=is.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),m=is.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return n?ys("span",{id:n,tabIndex:-1,style:hs}):null;if(!d)return ys("div",{id:n,className:Ss,tabIndex:-1,onFocus:p,style:hs,role:"region","aria-label":h,children:bs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const g=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,v=new Map,x=new Map,k=new Map;for(const e of y){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},o="object"==typeof t.source?t.source?.id:t.source,n="object"==typeof t.target?t.target?.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+r)}if(null!=n&&""!==n){const e=n+"";b.set(e,(b.get(e)??0)+1),x.set(e,(x.get(e)??0)+r)}}const w=[];for(let e=0;g.length>e;e++){const t=g[e];if(!t||"object"!=typeof t)continue;const o=t.datum?.id??t.id,n=null!=o?o+"":"node-"+e,r=b.get(n)??0,i=v.get(n)??0,a=x.get(n)??0,s=k.get(n)??0;w.push({id:n,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}w.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>A&&(A=t.degree);S=e/w.length}const C=y.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${y.length} edges.`];w.length>0&&M.push(`Mean degree: ${ks(S)}, max degree: ${A}.`);const _=Math.min(s,w.length),P=w.slice(0,_),R=w.length-_;return bs("div",{ref:f,id:n,className:Cs,tabIndex:-1,onBlur:m,style:Ms,role:"region","aria-label":h,children:[ys("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ps,children:"×"}),ys("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:_s,children:M.join(" ")}),bs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:Rs,children:[ys("caption",{className:"semiotic-accessible-data-table-caption",style:$s,children:R>0?`Top ${_} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),ys("thead",{children:bs("tr",{children:[ys("th",{style:Ls,children:"id"}),ys("th",{style:Ls,children:"degree"}),ys("th",{style:Ls,children:"in"}),ys("th",{style:Ls,children:"out"}),C&&ys("th",{style:Ls,children:"w. degree"}),C&&ys("th",{style:Ls,children:"w. in"}),C&&ys("th",{style:Ls,children:"w. out"})]})}),ys("tbody",{children:P.map((e,t)=>bs("tr",{children:[ys("td",{style:Ts,children:e.id}),ys("td",{style:Ts,children:e.degree}),ys("td",{style:Ts,children:e.inDeg}),ys("td",{style:Ts,children:e.outDeg}),C&&ys("td",{style:Ts,children:ks(e.wDegree)}),C&&ys("td",{style:Ts,children:ks(e.wInDeg)}),C&&ys("td",{style:Ts,children:ks(e.wOutDeg)})]},t))})]}),R>0&&bs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:Is,children:["Show ",Math.min(25,R)," more"," ",1===R?"node":"nodes"," (",R," remaining)"]})]})}function Es({summary:e}){return e?ys("div",{role:"note",style:hs,children:e}):null}function Bs({tableId:e}){return ys("a",{href:"#"+e,style:hs,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,hs)},children:"Skip to data table"})}import{jsx as Fs}from"react/jsx-runtime";var Hs="var(--semiotic-focus, #005fcc)";function zs({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==r&&"path"!==r||!s)if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=Fs("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Hs,strokeWidth:2,strokeDasharray:"4,2"})}else u=Fs("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Hs,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Hs,strokeWidth:2,strokeDasharray:"4,2"});else u=Fs("g",{transform:`translate(${o.left},${o.top})`,children:Fs("path",{d:s,fill:"none",stroke:Hs,strokeWidth:2.5,strokeDasharray:"6,3"})});return Fs("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Os from"react";function Ws(e,t){return"touch"===t?Math.max(e,24):e}function js(e){return Array.isArray(e)?e[0]:e}function Ys(e,t,o,n){return{data:js(e),x:t,y:o,__semioticHoverData:!0,...n}}var Gs=["name","label","title"],Vs=["type","kind","category","group","class","status","role","shape"],Xs=["value","amount","total","count","weight","score"],qs=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Us(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function Ks(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,n=!1!==t.skipPositional,r=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(n&&qs.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:o})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Gs.includes(e.lower));const a=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=Us(l,Vs),u=Us(l,Xs),d=new Set(Vs),h=new Set(Xs),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}import{jsx as Zs,jsxs as Qs}from"react/jsx-runtime";var Js={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function el(e,t){return"function"==typeof t?t(e):e[t]}function tl(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function ol(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(o){const t=el(e,o);a=tl(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const a=el(e,r);s.push({label:o,value:tl(a,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){a=tl(e[o],n);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=tl(e[t[0]],n))}}const l={...Js,...r};return Qs("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&Zs("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Qs("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Qs("span",{children:[e.label,": "]}),e.value]},t))]})}}function nl(e={}){const{fields:t=[],title:o,format:n,style:r={},className:i="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=el(e,o);l.push({value:tl(t,n)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=tl(el(e,r),i);l.push({label:a?o:void 0,value:s})});else{const t=Ks(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:tl(t.title,n),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:tl(e.value,n)})})}const c={...Js,...r};return Array.isArray(l)&&0!==l.length?Zs("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>Qs("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&Qs("strong",{children:[e.label,s]}),e.value]},t))}):null}}function rl(){return e=>{const t=e.allSeries;if(!t||0===t.length)return Zs("div",{className:"semiotic-tooltip",style:Js,children:Zs("div",{children:tl(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return Qs("div",{className:"semiotic-tooltip",style:Js,children:[null!=o&&Zs("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:tl(o)}),t.map((e,t)=>Qs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[Zs("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),Zs("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),Zs("span",{style:{fontWeight:500,fontSize:"0.85em"},children:tl(e.value)})]},t))]})}}function il(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=js(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!o)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof o?.x0&&"number"==typeof o?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof o?.sankeyWidth)&&o.data&&"object"==typeof o.data&&(o=o.data),!o)return null;const n=t(o);return null==n?null:Zs("div",{className:"semiotic-tooltip",style:Js,children:n})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ol(e):ol())}}import{jsx as al}from"react/jsx-runtime";function sl({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Os.useRef(null),[u,d]=Os.useState(null);Os.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[a,o,n,l]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>n-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*n>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Os.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background&&"transparent"!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor&&"transparent"!==n.backgroundColor)return!0}return!1}(i),p=f?null:Js;return l?al("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as ll from"react";import{useCallback as cl,useEffect as ul,useLayoutEffect as dl,useMemo as hl,useRef as fl}from"react";import{useState as pl,useEffect as ml}from"react";function gl(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}import{useRef as yl,useState as bl,useEffect as vl}from"react";function xl(e,t,o){const n=yl(null),[r,i]=bl(null);return vl(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}var kl=()=>"undefined"!=typeof performance?performance.now():Date.now();function wl(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function Sl(e,t){const o=e();return Number.isFinite(o)?o:t}var Al=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??kl,this.lastWallTime=Sl(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Sl(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??kl;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Sl(t,this.lastWallTime))}setRandomSource(e,t){const o=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&o===this.seedValue||(this.randomInput=e,this.seedValue=o,this.randomSource=e??(void 0===o?Math.random:wl(o)))}},Cl="undefined"==typeof window?ul:dl,Ml={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function _l(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Pl(e){const t=function(){const[e,t]=pl(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return ml(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),gl(e,e=>t(e.matches))},[]),e}(),o=fl(t);o.current=t;const[n,r]=xl(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,a=!!e.legend&&"top"===e.legendPosition,s=hl(()=>function(e,t,o=!1){const n=o?t?58:34:t?36:0;return n>e.top?{...e,top:n}:e}({...e.marginDefault,...e.userMargin},i,a),[e.marginDefault,e.userMargin,i,a]),l=r[0]-s.left-s.right,c=r[1]-s.top-s.bottom,u=_l(e.foregroundGraphics,r,s),d=_l(e.backgroundGraphics,r,s),h=K(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+ll.useId(),g=fl(null);if(!g.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;g.current=new Al({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const y=g.current;y.configure({clock:e.clock,random:e.random,seed:e.seed});const b=fl(null),v=fl(e.frameScheduler??Ml);v.current=e.frameScheduler??Ml;const x=fl(null),k=fl(!1),w=fl(()=>{}),S=cl(()=>{if(null!==b.current||k.current)return;const e=v.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(k.current=!0),b.current=null,x.current=null;try{w.current()}finally{e&&(k.current=!1)}});o=!0,t||(b.current=n,x.current=e)},[]),A=cl(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);Cl(()=>{y.setPaused(!0===e.paused)},[y,e.paused]),ul(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void y.setVisible(!0);const t=()=>y.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[y,e.suspendWhenHidden]),ul(()=>()=>{A()},[A]);const C=fl(()=>{}),M=fl(()=>{}),_=fl(null),P=fl(null),R=fl(null),L=cl(()=>{const e=_.current;_.current=null,e&&C.current(e)},[]),T=cl(e=>{if(_.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===P.current){const e=v.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,P.current=null,R.current=null,L()});t||(P.current=o,R.current=e)}},[L]),$=cl(()=>{_.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null),M.current()},[]);ul(()=>()=>{_.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null)},[]);const I=e.themeDirtyRef;return Cl(()=>{I&&(gn++,I.current=!0,S())},[h,S,I]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:s,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:y,rafRef:b,renderFnRef:w,scheduleRender:S,cancelRender:A,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:T,onPointerLeave:$}}import{useEffect as Rl,useRef as Ll}from"react";import{jsx as Tl}from"react/jsx-runtime";function $l(e,t){return function(e){const{cancelRender:t,dirtyRef:o,frameRuntime:n,manageFrameRuntime:r,scheduleRender:i}=e,a=Ll(null),s=Ll(null),l=Ll(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:a,cleanup:s}=e;Ga(()=>{t&&o&&n.current?.cancelIntroAnimation?.(),r.current=!0,a?.(),i.current()},[t,o]);const l=Wa(s);l.current=s,za(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),Rl(()=>{if(!1!==r)return n.subscribe(()=>{n.isActive?(o.current=!0,i()):t()})},[t,o,n,r,i]),Rl(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:s}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function Il({children:e,size:t,margin:o,overflowVisible:n=!1}){return e?Tl("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:n?"visible":void 0},children:Tl("g",{transform:`translate(${o.left},${o.top})`,children:e})}):null}function Nl(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!i&&e.hasActivePulsesAt(t),s=!(o||i||!a&&!r)&&e.refreshPulse(t);return n.current=a,{changed:s,pending:a}}function Dl(e,t,o,n){return"function"==typeof e?e({size:t,margin:o,scales:n}):e}function El(e,t,o,n){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*n),a=Math.round(t[1]*n),s=i/t[0],l=a/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(s,0,0,l,0,0),r.translate(o.left,o.top),r}function Bl(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}import{useCallback as Fl,useRef as Hl}from"react";function zl(e,t,o,n){const r=Hl({accessor:t,onChange:o,readData:n}),i=Hl([]);return r.current={accessor:t,onChange:o,readData:n},Fl(()=>{const{accessor:t,onChange:o,readData:n}=r.current;if(!o||!t)return;const a=function(e,t){if(!t)return[];const o=new Set,n=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),n.push(i))}return n}(e.current?n(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(a,i.current)||(i.current=a,o(a))},[e])}function Ol(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function Wl(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let r=!1;const i=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!n&&!i)return o;r=!0;const a={...o};return n&&(a[e.key]=e.fn(o)),i&&(a[t.key]=t.fn(o)),a});return r?i:n}}var jl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Yl=3156e7;function Gl(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Yl>t?e=>{const t=new Date(e);return`${jl[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Yl>t?e=>{const t=new Date(e);return`${jl[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Vl(e){if(!e)return;const t=[];for(const o of e)if("point"===o.type)t.push(o);else if("symbol"===o.type)t.push({pointId:o.pointId,x:o.x,y:o.y,r:It(o.size)});else if("glyph"===o.type){const e=dn(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}import{line as Xl}from"d3-shape";function ql(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function Ul(e,t,o,n,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(o*o+n*n))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=i;for(let o=0;t.length-1>o;o++){const n=(a[o]+a[o+1])/2;let i=r;l>n&&(i*=n/l),l>s-n&&(i*=(s-n)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}var Kl=(e,t,o,n)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,n.width*o,n.height),e.clip());const r=t.style.stroke||"#007bff",i=xn(e,r)||r,a=t.style.strokeWidth||2,s=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=a,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Ul(e,t.path,i,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=On(t.curve),u=s&&s.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const o=t.style.opacity??1;for(let n=0;t.path.length-1>n;n++)e.globalAlpha=.5*(d[n]+d[n+1])*o,e.beginPath(),e.moveTo(t.path[n][0],t.path[n][1]),e.lineTo(t.path[n+1][0],t.path[n+1][1]),e.stroke()}else if(u){let o=function(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),d=!0},n=function(){d&&(e.stroke(),d=!1)},r=null,a=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=ql(p,s,i);if(null!==r&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of s){const o=e.value;(c>o||o>p)&&(o>c||p>o)||c===o||p===o||t.push({t:(o-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(h-r)*l.t,u=a+(f-a)*l.t,d=ql(c+(p-c)*Math.min(l.t+1e-4,1),s,i);e.lineTo(t,u),n(),o(d,t,u)}e.lineTo(h,f)}r=h,a=f,c=p,u=m}else o(m,h,f),r=h,a=f,c=p,u=m}n()}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?Gn(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)Xl().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Wn(e,t.style.fill,t.style.fill),c&&!u)Xl().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}const o=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],n.height),e.lineTo(o,n.height),e.closePath(),e.fill()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Zl(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ql(e,t,o=.3){Zl(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Jl(e,t,o=.6){if(!Zl(t))return;const n=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,n,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function ec(e,t,o,n=.35){Zl(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}import{area as tc,line as oc}from"d3-shape";function nc(e,t){const o=On(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=tc().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}var rc=(e,t,o,n)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,n.width*r,n.height),e.clip());const i=Wn(e,t.style.fill,"#4e79a7"),a=t._decayOpacities;if(a&&a.length===t.topPath.length){const o=t.style.fillOpacity??.7;e.fillStyle=i;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(a[n]+a[n+1])*o,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(a[o]+a[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const s=t.style.opacity??1;if(nc(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const r=Yn(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,n);e.fillStyle=r||i,e.globalAlpha=s}else e.globalAlpha=(t.style.fillOpacity??.7)*s,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(nc(e,t),ec(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=s;const o=t.strokeGradient&&t.topPath.length>=2?Gn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=On(t.curve);if(e.beginPath(),n)oc().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),o&&e.restore(),e.globalAlpha=1}},ic=(e,t,o,n)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const o of r)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=Wn(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Wn(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),Jl(e,o)}finally{e.restore()}}},ac=new Map;function sc(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=ac.get(t);return o||(o=new Path2D($t(e.symbolType,e.size)),ac.size>256&&ac.clear(),ac.set(t,o)),o}catch{return null}}var lc=(e,t)=>{const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=sc(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle=Wn(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Wn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=o};function cc(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=an(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const o=Wn(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,n),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=r*s*(t.style.fillOpacity??1);const u=un(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&hn(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),hn(e,i,c,t.accent,void 0,l),e.restore()}var uc=(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&cc(e,n,n.x,n.y,o);e.globalAlpha=o};function dc(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:a,tr:s,br:l,bl:c}=Pa(t);e.beginPath(),e.moveTo(o+a,n),e.lineTo(o+r-s,n),s>0&&e.arcTo(o+r,n,o+r,n+s,s),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+a),a>0&&e.arcTo(o,n,o+a,n,a),e.closePath()}function hc(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var fc=(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)pc(e,t);else if(t.cornerRadii&&_a(t.cornerRadii)){const o=Wn(e,t.style.fill,xn(e,"var(--semiotic-primary, #007bff)")),n=hc(t),r=t.fillGradient&&"string"==typeof o?Yn(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,dc(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=Wn(e,t.style.fill,xn(e,"var(--semiotic-primary, #007bff)")),n=hc(t),r=t.fillGradient&&"string"==typeof o?Yn(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+i,s),e.arcTo(a,s,a,s+i,i),e.lineTo(a,s+c-i),e.arcTo(a,s+c,a+i,s+c,i),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a+i,s+c),e.arcTo(a,s+c,a,s+c-i,i);break;default:e.moveTo(a,s+c),e.lineTo(a,s+i),e.arcTo(a,s,a+i,s,i),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Wn(e,t.style.fill,xn(e,"var(--semiotic-primary, #007bff)")),n=hc(t),r=t.fillGradient&&"string"==typeof o?Yn(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Ql(e,t),e.globalAlpha=1}};function pc(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+n,a=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,a,n,r,r)}else{const i=r+n,a=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,a,r,r)}e.restore()}function mc(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>128?"#000":"#fff"}function gc(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var yc=(e,t,o,n)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const o=t.style;if(null!=o?.opacity&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=xn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Ql(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):gc(t.value),n=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=mc(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,r,i)}}}finally{e.restore()}},bc=(e,t,o,n)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=xn(e,t.wickColor)||t.wickColor,a=60>n.height,s=a?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=s,e.stroke()};if(a||l(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=xn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}a&&l(),e.restore()}},vc={line:[rc,Kl,ic],area:[rc,ic],stackedarea:[rc,ic],scatter:[ic,lc],bubble:[ic,lc],heatmap:[yc],bar:[fc],swarm:[ic],waterfall:[(e,t,o,n)=>{fc(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,a=i?._connectorStroke;if(a){e.save(),e.strokeStyle=xn(e,a)||a,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const n=r[t],i=r[t+1],a=n.datum,s=i.datum;if(null==a?.cumEnd||null==s?.baseline)continue;const l=o.y(a.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[bc],mixed:[rc,Kl,ic],custom:[rc,fc,yc,Kl,ic,lc,uc,bc]},xc=new Set;function kc(e,t){const o="function"==typeof e?e(t.datum??null,t):e;return(n=o)&&"object"==typeof n&&"string"==typeof n.id&&"function"==typeof n.cacheKey&&"function"==typeof n.drawCanvas&&"function"==typeof n.renderStaticSVG?o:void 0;var n}function wc(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const o=`${e}:${t}`;xc.has(o)||(xc.add(o),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Sc(e){const{context:t,nodes:o,renderMode:n,pixelRatio:r,paintBuiltIn:i}=e;if(!n||"sketchy"===n)return void i(o);let a=[];const s=()=>{a.length&&(i(a),a=[])};for(const e of o){const o=kc(n,e);if(!o){a.push(e);continue}let l;s(),t.save();try{l=o.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(wc(o.id,e.type??"unknown"),i([e]))}s()}function Ac(e){const{node:t,index:o,renderMode:n,fallback:r}=e,i=kc(n,t);if(!i)return r();const a=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${o}`});return null!=a?a:(wc(i.id,t.type??"unknown"),r())}import{jsx as Cc,jsxs as Mc}from"react/jsx-runtime";function _c(e){return"string"==typeof e?e:"value"}function Pc(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Rc(e,t){if(!t)return Pc(e);try{const o=t(e);return null==o?Pc(e):o}catch{return Pc(e)}}function Lc(e,t){return"function"==typeof t?t(e):e[t]}function Tc(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";o.push({label:r,accessor:e=>e.bands?.[n]?.y0??(0===n?e.band?.y0:void 0),format:t}),o.push({label:i,accessor:e=>e.bands?.[n]?.y1??(0===n?e.band?.y1:void 0),format:t})}),o}function $c(e){const t=e.find(e=>"title"===e.role),o=e.filter(e=>"title"!==e.role);return e=>{const n=e.data;if(!n)return null;const r=t?Rc(Lc(n,t.accessor),t.format):null;return Mc("div",{className:"semiotic-tooltip",style:Js,children:[null!=r&&Cc("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((e,t)=>{const o=Rc(Lc(n,e.accessor),e.format);return Mc("div",{style:t>0?{marginTop:2}:void 0,children:[Mc("span",{style:{opacity:.7},children:[e.label,": "]}),Cc("span",{children:o})]},t)})]})}}function Ic({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return a=>{const s=r?a.data?.[0]||a.data||a:a.data||a,l=Lc(s,e),c=Lc(s,t),u=o?Lc(s,o):void 0;return Mc("div",{className:"semiotic-tooltip",style:Js,children:[Cc("div",{style:{fontWeight:"bold"},children:Pc(l)}),Cc("div",{style:{marginTop:4},children:Rc(c,i)}),null!=u&&Mc("div",{style:{marginTop:2,opacity:.8},children:[n||_c(o),": ",Pc(u)]})]})}}import{jsx as Nc,jsxs as Dc}from"react/jsx-runtime";function Ec(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Bc({hover:e}){const t=e.data??{},o=t.y??t.value,n=t.x??t.time;if(void 0===o&&void 0===n){const e=Ks(t);if(null!=e.title||e.entries.length>0)return Dc("div",{className:"semiotic-tooltip",style:Js,children:[null!=e.title&&Nc("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>Dc("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",Nc("span",{style:{fontWeight:600},children:Ec(e.value)})]},e.key))]})}return Dc("div",{className:"semiotic-tooltip",style:Js,children:[Nc("div",{style:{fontWeight:600,marginBottom:2},children:Ec(o)}),Nc("div",{style:{opacity:.7,fontSize:11},children:Ec(n)})]})}function Fc(e){return"touch"===e?"touch":"pointer"}function Hc(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function zc(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(o?(t({type:"hover",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:o,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"hover-end",timestamp:l,chartType:i,chartId:a}))}function Oc(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(o?(t({type:"click",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:o,inputType:s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"click-end",timestamp:l,chartType:i,chartId:a}))}Bc.ownsChrome=!0;import{useCallback as Wc}from"react";function jc({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n,chartType:r}){return{customHoverBehavior:Wc((t,i)=>{e?.(t,i),zc({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:n,context:i})},[n,r,e,o]),customClickBehavior:Wc((e,i)=>{t?.(e,i),Oc({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:n,context:i})},[n,r,t,o]),hasClickBehavior:!(!t&&!o)}}import{useCallback as Yc,useRef as Gc}from"react";function Vc(e){const t=new Map;for(const o of e){const e=o.group??"_default";let n=t.get(e);n||(n=[],t.set(e,n)),n.push(o)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(t.keys()).sort((e,o)=>{const n=t.get(e),r=t.get(o);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;const t=n[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:n,groups:o,byGroup:t,idToIdx:r}}function Xc(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[o];return{flatIndex:o,group:n.group??"_default",indexInGroup:n._groupIndex??0}}function qc(e,t,o){const{group:n,indexInGroup:r}=t,i=o.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Uc(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Uc(o,o.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function Uc(e,t,o){const n=e.byGroup.get(t);let r=0,i=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);i>t&&(i=t,r=e)}return n[r]._flatIndex}function Kc(e){const t=[];for(const o of e)switch(o.type){case"point":t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=o.size)break;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=o.size||null==o.datum)break;const e=dn(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=o,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.path.length>o&&n.length>o;o++)t.push({x:e.path[o][0],y:e.path[o][1],datum:n[o],shape:"circle",group:r});break}case"area":{const e=o,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.topPath.length>o&&n.length>o;o++)t.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:n[o],shape:"circle",group:r});break}case"rect":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??"_default"});break;case"heatcell":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function Zc(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=dn(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,n=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*n,y:o.cy+Math.sin(e)*n,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function Qc(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Jc(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function eu({storeRef:e,hoverRef:t,hoveredNodeRef:o,setHoverPoint:n,customHoverBehavior:r,customClickBehavior:i,scheduleRender:a,extractPoints:s,toHover:l}){const c=Gc(-1),u=Gc(null),d=Gc(null),h=Yc(h=>{if(Hc(h))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,o&&(o.current=null),n(null),r(null),a()};if(0===f.scene.length)return void(0>c.current||p());let m;if(d.current?.version===f.version)m=d.current.graph;else{const e=s(f.scene);if(0===e.length)return void(0>c.current||p());m=Vc(e),d.current={version:f.version,graph:m}}let g=c.current;if(m.flat.length>g||(p(),g=-1),("Enter"===h.key||" "===h.key)&&g>=0)return h.preventDefault(),void i(l(m.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=m.flat[0];u.current=e;const o=l(e,f);return t.current=o,n(o),r(o,{type:"focus",inputType:"keyboard"}),void a()}const y=qc(h.key,Xc(m,g),m);if(null===y)return;if(h.preventDefault(),0>y)return void p();c.current=y;const b=m.flat[y];u.current=b;const v=l(b,f);t.current=v,n(v),r(v,{type:"focus",inputType:"keyboard"}),a()},[i,r,s,t,o,a,n,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}import{jsx as tu,jsxs as ou}from"react/jsx-runtime";var nu={top:20,right:20,bottom:30,left:40},ru=ns;function iu(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var au=p(f(function(e,t){const{chartType:o,runtimeMode:n,data:r,chunkThreshold:f,chunkSize:p,xAccessor:m,yAccessor:g,accessorRevision:y,colorAccessor:b,sizeAccessor:v,symbolAccessor:x,symbolMap:k,groupAccessor:w,lineDataAccessor:S,curve:A,normalize:C,baseline:M,stackOrder:_,binSize:P,valueAccessor:L,arrowOfTime:I="right",windowMode:N="sliding",windowSize:D=200,timeAccessor:E,xExtent:B,yExtent:F,extentPadding:H=.1,scalePadding:z,sizeRange:O,size:j=[500,300],responsiveWidth:Y,responsiveHeight:G,margin:V,className:X,background:q,renderMode:U,lineStyle:K,pointStyle:Z,areaStyle:Q,barStyle:J,waterfallStyle:ee,swarmStyle:te,barColors:oe,colorScheme:ne,boundsAccessor:re,boundsStyle:ie,y0Accessor:ae,band:se,gradientFill:le,lineGradient:ce,areaGroups:ue,openAccessor:de,highAccessor:he,lowAccessor:fe,closeAccessor:pe,candlestickStyle:me,showAxes:ge=!0,axes:ye,xLabel:be,yLabel:ve,yLabelRight:xe,xFormat:ke,yFormat:we,axisExtent:Se,tickFormatTime:Ae,tickFormatValue:Ce,hoverAnnotation:Me,tooltipContent:_e,customHoverBehavior:Pe,customClickBehavior:Re,onObservation:Le,annotationObservationCallback:Te,chartId:$e,enableHover:Ie,hoverRadius:Ne=30,tooltipMode:De,annotations:Ee,onAnnotationActivate:Be,autoPlaceAnnotations:Fe,svgAnnotationRules:He,showGrid:ze,legend:Oe,legendHoverBehavior:We,legendClickBehavior:je,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:Ve,legendLayout:Xe,legendCategoryAccessor:qe,onCategoriesChange:Ue,backgroundGraphics:Ke,foregroundGraphics:Ze,canvasPreRenderers:Qe,svgPreRenderers:Je,title:et,categoryAccessor:tt,brush:ot,onBrush:nt,decay:rt,pulse:it,transition:at,animate:st,staleness:lt,frameScheduler:ct,clock:ut,random:dt,seed:ht,paused:ft=!1,suspendWhenHidden:pt=!0,heatmapAggregation:mt,heatmapXBins:gt,heatmapYBins:bt,showValues:vt,heatmapValueFormat:xt,marginalGraphics:kt,pointIdAccessor:wt,xScaleType:St,yScaleType:At,accessibleTable:Ct=!0,description:Mt,summary:_t,linkedCrosshairName:Pt,linkedCrosshairSourceId:Rt,customLayout:Lt,onLayoutError:Tt,layoutConfig:$t,layoutSelection:It}=e,{customHoverBehavior:Nt,customClickBehavior:Dt,hasClickBehavior:Et}=jc({customHoverBehavior:Pe,customClickBehavior:Re,onObservation:Le,chartId:$e,chartType:"StreamXYFrame"}),Bt=h().replace(/:/g,""),Ft=a(!1),Ht=a({w:-1,h:-1}),zt=a(!1),Ot=Pl({sizeProp:j,responsiveWidth:Y,responsiveHeight:G,userMargin:V,marginDefault:nu,title:et,legend:Oe,legendPosition:Ve,animate:st,transitionProp:at,frameScheduler:ct,clock:ut,random:dt,seed:ht,paused:ft,suspendWhenHidden:pt,themeDirtyRef:Ft}),Wt=Va(),jt=Ka(),{reducedMotionRef:Yt,responsiveRef:Gt,size:Vt,currentTheme:Xt,transition:qt,introEnabled:Ut,tableId:Kt,rafRef:Zt,renderFnRef:Qt,scheduleRender:Jt,frameRuntime:eo}=Ot;let to=Ot.margin;if(kt){const e=60,t={...Ot.margin};kt.top&&e>t.top&&(t.top=e),kt.bottom&&e>t.bottom&&(t.bottom=e),kt.left&&e>t.left&&(t.left=e),kt.right&&e>t.right&&(t.right=e),to=t}const oo=Vt[0]-to.left-to.right,no=Vt[1]-to.top-to.bottom,ro=c(()=>T(r),[r]),io=Me??Ie,[ao,so]=s(0),lo=a(0),[co,uo]=s(null),ho=Dl(Ze,Vt,to,co),fo=Dl(Ke,Vt,to,co),po=a(null),mo=a(null),go=a(void 0),[yo,bo]=s(null),vo=a(ru.primary),xo=a(function(){let e=-1,t=ns;return{resolve(o){if(!o)return ns;const n=gn;return n===e||(t=function(e){if(!e)return ns;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),a=n||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return a||s||o||i?{axisStroke:l||ns.axisStroke,tickText:a||ns.tickText,crosshair:a?rs(a,"66"):ns.crosshair,hoverFill:c?rs(c,"4D"):ns.hoverFill,hoverStroke:a?rs(a,"99"):ns.hoverStroke,pointRing:c||ns.pointRing,primary:i||ns.primary,background:c||ns.background}:ns}(o),e=n),t},invalidate(){e=-1}}}()),ko=a(!1),wo=Bo("StreamXYFrame"),[So,Ao]=s(!1),[Co,Mo]=s([]),[Po,Ro]=s([]),Lo="streaming"===n||["bar","swarm","waterfall"].includes(o),To=Qa(c(()=>({chartType:o,runtimeMode:Lo?"streaming":"bounded",windowSize:D,windowMode:N,arrowOfTime:Lo?I:"right",extentPadding:H,scalePadding:z,axisExtent:Se,xAccessor:m,yAccessor:g,accessorRevision:y,timeAccessor:Lo?E:void 0,valueAccessor:L,colorAccessor:b,sizeAccessor:v,symbolAccessor:x,symbolMap:k,groupAccessor:w||(S?"_lineGroup":void 0),categoryAccessor:tt,lineDataAccessor:S,xScaleType:St,yScaleType:At,xExtent:B,yExtent:F,sizeRange:O,binSize:P,normalize:C,baseline:M,stackOrder:_,boundsAccessor:re,boundsStyle:ie,y0Accessor:ae,band:se,gradientFill:!0===le?{topOpacity:.8,bottomOpacity:.05}:!1===le?void 0:le,areaGroups:ue?new Set(ue):void 0,lineGradient:ce,openAccessor:de,highAccessor:he,lowAccessor:fe,closeAccessor:pe,candlestickStyle:me,lineStyle:K,pointStyle:Z,areaStyle:Q,swarmStyle:te,waterfallStyle:ee,colorScheme:ne,barColors:oe,barStyle:J,annotations:Ee,decay:rt,pulse:it,transition:qt,introAnimation:Ut,staleness:lt,clock:eo.now,heatmapAggregation:mt,heatmapXBins:gt,heatmapYBins:bt,showValues:vt,heatmapValueFormat:xt,pointIdAccessor:wt,curve:A,themeCategorical:Xt?.colors?.categorical,themeSemantic:W(Xt),themeSequential:Xt?.colors?.sequential,themeDiverging:Xt?.colors?.diverging,customLayout:Lt,onLayoutError:Tt,layoutConfig:$t,layoutMargin:to}),[o,Lo,D,N,I,H,z,Se,m,g,y,E,L,b,v,x,k,w,S,tt,St,At,B,F,O,P,C,M,_,re,ie,ae,se,le,ue,ce,de,he,fe,pe,me,K,Z,Q,te,ee,ne,oe,J,Ee,rt,it,qt,Ut,lt,eo.now,mt,gt,bt,vt,xt,wt,A,Xt,Lt,Tt,$t,to])),$o=a(null);$o.current||($o.current=new _o(To));const Io=zl($o,qe,Ue,e=>e.getData());Ko($o,To,Ft,Jt),Zo($o,It,Ft,Jt);const No=a(null);No.current||(No.current=new $(e=>{const t=$o.current;t&&t.ingest(e)&&(Ft.current=!0,Jt())},{chunkThreshold:f,chunkSize:p})),l(()=>{No.current?.updateChunkOptions({chunkThreshold:f,chunkSize:p})},[f,p]);const Do=u(e=>{No.current?.push(e)},[]),Eo=u(e=>{No.current?.pushMany(e)},[]),Ho=u(()=>{No.current?.clear(),$o.current?.clear(),Ft.current=!0,Jt()},[Jt]);d(t,()=>({push:Do,pushMany:Eo,remove:e=>{No.current?.flush();const t=$o.current?.remove(e)??[];return t.length>0&&(po.current&&t.some(e=>e===po.current?.data)&&(po.current=null,bo(null)),Ft.current=!0,Jt()),t},update:(e,t)=>{No.current?.flush();const o=$o.current?.update(e,t)??[];return o.length>0&&(Ft.current=!0,Jt()),o},clear:Ho,getData:()=>(No.current?.flush(),$o.current?.getData()??[]),getScales:()=>$o.current?.scales??null,getExtents:()=>$o.current?.getExtents()??null,getCustomLayout:()=>$o.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>$o.current?.lastCustomLayoutFailure??null}),[Do,Eo,Ho,Jt]),l(()=>{if(r){if(S&&ro.length>0&&"object"==typeof ro[0]&&null!==ro[0]){const e="string"==typeof S?S:"coordinates";if(Array.isArray(ro[0][e])){const t=[];for(const o of ro){const n=o[e];if(Array.isArray(n)){const e=o.label||o.id||o.key;if(null!=e)for(const o of n)t.push({...o,_lineGroup:e});else for(const e of n)t.push(e)}}return void No.current?.setBoundedData(t)}}No.current?.setBoundedData(ro)}},[r,ro,S]);const{canvasRef:Oo,interactionCanvasRef:Wo}=$l(Ot,{storeRef:$o,dirtyRef:Ft,hydrated:Wt,wasHydratingFromSSR:jt,cleanup:()=>No.current?.clear(),canvasPaintDependencies:[o,oo,no,ge,q,Ke,K,U,Qe,Jt]}),{hoverHandlerRef:jo,hoverLeaveRef:Yo,onPointerMove:Go,onPointerLeave:Vo}=Ot;jo.current=e=>{if(!io)return;const t=Oo.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-to.left,i=e.clientY-n.top-to.top;if(0>r||r>oo||0>i||i>no)return void(po.current&&(po.current=null,mo.current=null,bo(null),Nt&&(Nt(null),Ft.current=!0),Jt()));const a=$o.current;if(!a||0===a.scene.length)return;const s=Ws(Ne,e.pointerType),l=Un(a.scene,r,i,s,a.quadtree,a.maxPointRadius),c="multi"===De,u=()=>{po.current&&(po.current=null,mo.current=null,bo(null),Nt&&Nt(null),Jt())};if(!l&&!c)return void u();const d=c||!l?r:l.x,h=c||!l?i:l.y,f=l?.datum?yt(l.datum,a.resolvedRibbons):{},p=a.scales?.x?.invert,g="function"==typeof p?p(d):void 0;let y=Ys(f,d,h,null!=g?{xValue:g,xPx:d}:void 0);if(c&&a.scene.length>0&&a.scales){const e=function(e,t,o=30){const n=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=Kn(qn(e.path,e.curve),t,o);if(null===i)continue;const a=ar(e.path,t);n.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=qn(e.topPath,e.curve),a=qn(e.bottomPath,e.curve),s=Kn(i,t,o);if(null===s)continue;const l=Kn(a,t,o),c=ar(e.topPath,t);n.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:s,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(a.scene,d,Math.max(s,oo));if(e.length>0){const t=a.scales.y.invert,n=vo.current,r=p?p(d):d;if(l)y.xValue=r,y.xPx=d;else{const e={xValue:r};"string"==typeof m&&(e[m]=r),y=Ys(e,d,h,{xValue:r,xPx:d})}y.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===o&&null!=i?r-i:r,valuePx:e.y,color:e.color||n,datum:yt(e.datum,a.resolvedRibbons)}})}}l||y.allSeries?.length?(po.current=y,mo.current=l?.node??null,bo(y),Nt&&(Nt(y),Ft.current=!0),Jt()):u()},Yo.current=()=>{po.current&&(po.current=null,mo.current=null,bo(null),Nt&&(Nt(null),Ft.current=!0),Jt())};const qo=a(()=>{});qo.current=e=>{if(Ci(e.target))return;if(!Dt)return;const t=Oo.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-to.left,r=e.clientY-o.top-to.top;if(0>n||n>oo||0>r||r>no)return void Dt(null);const i=$o.current;if(!i||0===i.scene.length)return void Dt(null);const a=Ws(Ne,go.current),s=Un(i.scene,n,r,a,i.quadtree,i.maxPointRadius);if(!s)return void Dt(null);const l=s.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(s.x):void 0;Dt(Ys(l,s.x,s.y,null!=u?{xValue:u,xPx:s.x}:void 0),{type:"activate",inputType:Fc(go.current)})};const Uo=u(e=>qo.current(e),[]),{kbFocusIndexRef:Qo,focusedNavPointRef:Jo,onKeyDown:en}=(tn={storeRef:$o,hoverRef:po,hoveredNodeRef:mo,setHoverPoint:bo,customHoverBehavior:Nt,customClickBehavior:Dt,scheduleRender:Jt},eu({...tn,extractPoints:Kc,toHover:(e,t)=>Jc({...e,datum:yt(e.datum,t.resolvedRibbons)})}));var tn;const on=u(e=>{go.current=e.pointerType,Qo.current=-1,Jo.current=null,Go(e)},[Jo,Qo,Go]),nn=u(e=>{go.current="mouse",Qo.current=-1,Jo.current=null,Go({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Jo,Qo,Go]),rn=u(e=>{go.current=e.pointerType},[]);Qt.current=()=>{if(Zt.current=null,!eo.isActive)return;const e=Oo.current,t=Wo.current;if(!e||!t)return;const n=$o.current;if(!n)return;const r=eo.now(),i=n.advanceTransition(Yt.current?r+1e6:r),a=!Yt.current&&i,s=Ht.current.w!==oo||Ht.current.h!==no,l=Ft.current||i||s,c=n.consumeStylePaintPending();let u=!1;const d=n.getLastUpdateResult(),h=wo.current.beforeCompute(d,a);!l||a&&!s||(n.computeScene({width:oo,height:no}),Ht.current={w:oo,h:no},u=!0,Io()),wo.current.afterCompute(h,u,s);const f=Nl(n,r,u,zt),p=Bl(),y=xo.current.resolve(e);vo.current=y.primary;const b=dr(lt,n.lastIngestTime>0?r-n.lastIngestTime:0),v=lt&&b.isStale;if(l||c||f.changed){const t=El(e,Vt,to,p);if(t){if(t.clearRect(-to.left,-to.top,Vt[0],Vt[1]),lt&&1>b.alpha&&(t.globalAlpha=b.alpha),os(t,{background:q,hasBackgroundGraphics:!!Ke,themeBackground:y.background,x:-to.left,y:-to.top,width:Vt[0],height:Vt[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,oo,no),t.clip()),Qe&&n.scales)for(const e of Qe)t.save(),e(t,n.scene,n.scales,{width:oo,height:no}),t.restore();const e=Lt?vc.custom:vc[o];Sc({context:t,nodes:n.scene,renderMode:U,pixelRatio:p,paintBuiltIn:o=>{if(e&&n.scales)for(const r of e)r(t,o,n.scales,{width:oo,height:no})}}),t.restore(),lt&&1>b.alpha&&(t.globalAlpha=1)}}const x=!!(io&&po.current&&n.scales),k=!!(mo.current&&Array.isArray(Me)&&Me.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=x||k;if(w||ko.current){const e=El(t,Vt,to,p);if(e&&(e.clearRect(-to.left,-to.top,Vt[0],Vt[1]),x&&po.current&&function(e,t,o,n,r,i,a){if(!1===r.crosshair)return;const s=t.allSeries,l=s&&s.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||a.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,n),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=a.pointRing;for(const t of s)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||a.primary,e.fill(),e.stroke())}else{const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(i)||a.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,po.current,oo,no,"object"==typeof io?io:{},mo.current,y),k&&mo.current&&Array.isArray(Me))){const t=Me.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,r){if(!o)return;const i="group"in o?o.group:void 0;if(void 0!==i)for(const o of t){if("line"!==o.type)continue;if(o.group!==i)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,n.scene,mo.current,t,y)}ko.current=w}l&&e&&e.setAttribute("aria-label",vs(n.scene,o+" chart"));const S=Ft.current;if(Ft.current=S&&a&&!u,S&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!co||e(co.x.domain()[0])!==e(n.scales.x.domain()[0])||e(co.x.domain()[1])!==e(n.scales.x.domain()[1])||e(co.y.domain()[0])!==e(n.scales.y.domain()[0])||e(co.y.domain()[1])!==e(n.scales.y.domain()[1])||co.x.range()[0]!==n.scales.x.range()[0]||co.x.range()[1]!==n.scales.x.range()[1]||co.y.range()[0]!==n.scales.y.range()[0]||co.y.range()[1]!==n.scales.y.range()[1])&&uo(n.scales),kt){const e=n.getData(),t="function"==typeof m?m:e=>e[m||"x"],o="function"==typeof g?g:e=>e[g||"y"];Mo(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Ro(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Ee&&Ee.length>0||Lt)&&(u||a))||!u&&33>r-lo.current||(so(e=>e+1),lo.current=r),lt?.showBadge&&Ao(!!v),(a||null!=n.activeTransition||f.pending)&&Jt()},hr(lt,$o,Ft,Jt,So,Ao);const an=c(()=>{if(ke||Ae)return;const e=$o.current;return e?.xIsDate&&co?Gl(co.x.domain()):void 0},[ke,Ae,co]),sn=ke||Ae||an,ln=io&&yo?_e?_e(yo):tu(Bc,{hover:yo}):null,cn=ln?tu(sl,{x:yo.x,y:yo.y,containerWidth:oo,containerHeight:no,margin:to,className:"stream-frame-tooltip",children:ln}):null,un=Jo.current,dn=tu(zs,{active:Qo.current>=0,hoverPoint:yo,margin:to,size:Vt,shape:un?.shape,width:un?.w,height:un?.h}),hn=Ol(m,E,"__semiotic_resolvedX","__semiotic_resolvedTime"),fn=Ol(g,L,"__semiotic_resolvedY","__semiotic_resolvedValue"),pn=hn.key,mn=fn.key,yn=Wl(hn,fn,Ee&&Ee.length>0||!1);if(Ha||!Wt&&jt){const e=$o.current;e&&r&&(e.ingest({inserts:ro,bounded:!0}),e.computeScene({width:oo,height:no}));const t=e?.scene??[],o=e?.scales??null,n=Dl(Ze,Vt,to,o),a=Dl(Ke,Vt,to,o),s=sn||(()=>{if(e?.xIsDate&&o)return Gl(o.x.domain())})();return ou("div",{ref:Gt,className:"stream-xy-frame"+(X?" "+X:""),role:"img","aria-label":Mt||("string"==typeof et?et:"XY chart"),style:{position:"relative",width:Y?"100%":Vt[0],height:G?"100%":Vt[1]},children:[tu(Es,{summary:_t}),ou("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vt[0],height:Vt[1],style:{position:"absolute",left:0,top:0},children:[tu("g",{transform:`translate(${to.left},${to.top})`,children:a}),ou("g",{transform:`translate(${to.left},${to.top})`,children:[q&&tu("rect",{x:0,y:0,width:oo,height:no,fill:q}),Je&&o&&Je.map((e,n)=>tu(i.Fragment,{children:e(t,o,{width:oo,height:no})},"svgpre-"+n)),t.map((e,t)=>Ac({node:e,index:t,renderMode:U,fallback:()=>function(e,t,o){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const n="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return $a("path",{d:n,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+t)}case"area":{const n=e;if(0===n.topPath.length)return null;const r=`M${n.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...n.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`,i=`${o?o+"-":""}area-${t}-hatch`,a=Mn(n.style.fill)?Ln(n.style.fill,i):void 0,s=a?`url(#${i})`:Da(n.style.fill);if(n.clipRect){const e=`${o?o+"-":""}area-clip-${t}`;return Ia("g",{children:[Ia("defs",{children:[a,$a("clipPath",{id:e,children:$a("rect",{x:n.clipRect.x,y:n.clipRect.y,width:n.clipRect.width,height:n.clipRect.height})})]}),$a("path",{d:r,fill:s,fillOpacity:n.style.fillOpacity??n.style.opacity??.7,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return Ia(Ca.Fragment,{children:[a&&$a("defs",{children:a}),$a("path",{d:r,fill:s,fillOpacity:n.style.fillOpacity??n.style.opacity??.7,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"area-"+t)}case"point":{const n=e,r=`${o?o+"-":""}point-${t}-hatch`,i=Mn(n.style.fill)?Ln(n.style.fill,r):void 0;return Ia(Ca.Fragment,{children:[i&&$a("defs",{children:i}),$a("circle",{cx:n.x,cy:n.y,r:n.r,fill:i?`url(#${r})`:Da(n.style.fill),opacity:n.style.opacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"point-"+t)}case"symbol":return Ea(e,t);case"glyph":return Ba(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const n=e,r=`${o?o+"-":""}xyrect-${t}-hatch`,i=Mn(n.style.fill)?Ln(n.style.fill,r):void 0;return Ia(Ca.Fragment,{children:[i&&$a("defs",{children:i}),$a("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:i?`url(#${r})`:Da(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const o=e;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const e=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[n,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),a=.299*n+.587*r+.114*i>128?"#000":"#fff",s=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return Ia("g",{children:[$a("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),$a("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:s+"px",children:e})]},"heatcell-"+t)}return $a("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+t)}case"candlestick":{const o=e,n=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),i=o.isUp?o.upColor:o.downColor;return Ia("g",{children:[$a("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),$a("rect",{x:o.x-o.bodyWidth/2,y:n,width:o.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Bt)})).filter(Boolean)]})]}),tu(Aa,{width:oo,height:no,totalWidth:Vt[0],totalHeight:Vt[1],margin:to,scales:o,showAxes:ge,axes:ye,xLabel:be,yLabel:ve,yLabelRight:xe,xFormat:s,yFormat:we||Ce,axisExtent:Se,showGrid:ze,title:et,legend:Oe,legendHoverBehavior:We,legendClickBehavior:je,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:Ve,legendLayout:Xe,foregroundGraphics:zo(n,Xo($o.current?.customLayoutOverlays,It??null)),marginalGraphics:kt,xValues:[],yValues:[],annotations:Ee,onAnnotationActivate:Be,onObservation:Te??Le,chartId:$e,chartType:"StreamXYFrame",autoPlaceAnnotations:Fe,svgAnnotationRules:He,annotationFrame:0,xAccessor:pn,yAccessor:mn,annotationData:yn($o.current?.getData()),pointNodes:Vl($o.current?.scene),curve:"string"==typeof A?A:void 0,linkedCrosshairName:Pt,linkedCrosshairSourceId:Rt})]})}return ou("div",{ref:Gt,className:"stream-xy-frame"+(X?" "+X:""),role:"group","aria-label":Mt||("string"==typeof et?et:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Vt[0],height:G?"100%":Vt[1],overflow:"visible",touchAction:iu(ot)},onKeyDown:en,children:["production"!==process.env.NODE_ENV&&$o.current&&tu(Fo,{store:$o.current,diagnostics:wo.current}),Ct&&tu(Bs,{tableId:Kt}),Ct&&tu(Ns,{scene:$o.current?.scene??[],chartType:o+" chart",tableId:Kt,chartTitle:"string"==typeof et?et:void 0}),tu(Es,{summary:_t}),tu(fs,{hoverPoint:yo}),ou("div",{role:"img","aria-label":Mt||("string"==typeof et?et:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:io?on:void 0,onMouseMove:io?nn:void 0,onPointerLeave:io?Vo:void 0,onMouseLeave:io?Vo:void 0,onPointerDown:io||Et?rn:void 0,onClick:Et?Uo:void 0,children:[tu(Il,{size:Vt,margin:to,children:fo}),tu(ka,{width:oo,height:no,totalWidth:Vt[0],totalHeight:Vt[1],margin:to,scales:co,showAxes:ge,axes:ye,showGrid:ze,xFormat:sn,yFormat:we||Ce,axisExtent:Se}),tu("canvas",{ref:Oo,"aria-label":vs($o.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),tu("canvas",{ref:Wo,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),tu(Aa,{width:oo,height:no,totalWidth:Vt[0],totalHeight:Vt[1],margin:to,scales:co,showAxes:ge,axes:ye,xLabel:be,yLabel:ve,yLabelRight:xe,xFormat:sn,yFormat:we||Ce,axisExtent:Se,showGrid:ze,title:et,legend:Oe,legendHoverBehavior:We,legendClickBehavior:je,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:Ve,legendLayout:Xe,foregroundGraphics:zo(ho,Xo($o.current?.customLayoutOverlays,It??null)),marginalGraphics:kt,xValues:Co,yValues:Po,annotations:Ee,onAnnotationActivate:Be,onObservation:Te??Le,chartId:$e,chartType:"StreamXYFrame",autoPlaceAnnotations:Fe,svgAnnotationRules:He,annotationFrame:ao,xAccessor:pn,yAccessor:mn,annotationData:yn($o.current?.getData()),pointNodes:Vl($o.current?.scene),curve:"string"==typeof A?A:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==q&&!Ke,linkedCrosshairName:Pt,linkedCrosshairSourceId:Rt}),(ot||nt)&&tu(R,{width:oo,height:no,totalWidth:Vt[0],totalHeight:Vt[1],margin:to,dimension:ot?.dimension??"xy",scales:co,onBrush:nt??(()=>{}),binSize:P,snap:ot?.snap,binBoundaries:ot?.binBoundaries??("bar"===o?$o.current?.getBinBoundaries():void 0),snapDuring:ot?.snapDuring,streaming:"streaming"===n}),lt?.showBadge&&tu(pr,{isStale:So,position:lt.badgePosition}),dn,cn]})]})}));au.displayName="StreamXYFrame";var su=au;import{useRef as lu,useState as cu,useEffect as uu,useMemo as du,useCallback as hu,useImperativeHandle as fu,forwardRef as pu,memo as mu}from"react";import{scaleBand as gu,scaleLinear as yu}from"d3-scale";var bu=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,o){if(t&&"function"==typeof e.pieceStyle){const n=e.pieceStyle(t,o);return n&&!n.fill&&o?{...n,fill:this.getColorFromScheme(e,o)}:n}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&o?{fill:e.barColors[o]||"#007bff"}:{fill:o?this.getColorFromScheme(e,o):"#007bff"}}resolveSummaryStyle(e,t,o){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,o):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const o=this.colorSchemeMap.get(t);if(o)return o;const n=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||De,r=n[this.colorSchemeIndex%n.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function vu(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,n=new Map;let r=0;return e=>{const i=t(e)+"",a=o?.[i];if(a)return a;let s=n.get(i);return s||(s=Tt[r%Tt.length],r++,n.set(i,s)),s}}function xu(e,t,o,n,r,i,a){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:a,datum:o}:{type:"point",x:n,y:r,r:i,style:a,datum:o})}function ku(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(n.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,p=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,m=r(t.pieceData[0],t.name),g=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:h,endAngle:p,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:m,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:g,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}import{quantile as wu}from"d3-array";function Su(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:wu(e,.25)??o,median:wu(e,.5)??(o+n)/2,q3:wu(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as Au}from"d3-scale";var Cu={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,p=[];if(a){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=a(o);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=a?a(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of p){const c=t.get(i);if(!c)continue;let p=c.total;f&&o>0&&(p/=o);const m=s(c.pieces[0],a?i:e.name),g={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>p?r:n+p),o=0>p?l(r+p)-l(r):l(n)-l(n+p);u.push(ut(e.x,t,e.width,Math.abs(o),m,g,i)),0>p?r+=p:n+=p}else if(h){const t=l(0>p?r+p:n),o=0>p?l(r)-l(r+p):l(n+p)-l(n);u.push(ut(t,e.x,Math.abs(o),e.width,m,g,i)),0>p?r+=p:n+=p}}}const m="vertical"===c,g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(g>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=g),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=g)}}return u},clusterbar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=a?a(t):"_default";f.has(e)||(f.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(n)){const t=e.width/p,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),f=s(r,h[a]);if(d){const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(ut(i,Math.min(s,d),n,Math.abs(s-d),f,r,h[a]))}else{const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(ut(Math.min(s,d),i,Math.abs(d-s),n,f,r,h[a]))}}}}const m=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=vu(e),p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||s,g=a(t,e.name),y=g.r||5;let b,v;if(d){const t=m+(e.pctStart+e.pct/2)*p,o=l(n);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(n)):(b=l(n),v=e.middle);xu(c,f,t,b,v,y,g)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="vertical"===s,u=vu(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],s=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;xu(l,u,n,c?e.middle+f:a(s),c?a(s):e.middle+f,h,d)}}return l},pie:ku,donut:ku,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const n=o[0],r=o[o.length-1],l=wu(o,.25)??n,h=wu(o,.5)??(n+r)/2,f=wu(o,.75)??r,p=f-l,m=l-1.5*p,g=f+1.5*p,y=o.find(e=>e>=m)??n,b=[...o].reverse().find(e=>g>=e)??r,v=a(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(m>o||o>g){const n=u?t.middle:s(o),r=u?s(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:s(y),q1Pos:s(l),medianPos:s(h),q3Pos:s(f),maxPos:s(b),stats:{n:o.length,min:y,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,o){const{scales:n,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=i.bins||20,f=!1!==i.showIQR;for(const e of Object.values(r)){const o=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>o.length)continue;const n=o[0],r=o[o.length-1],i=(r-n)/h||1,c=Array(h).fill(0);for(const e of o)c[Math.min(Math.floor((e-n)/i),h-1)]++;const p=t(c,1),m=e.width/2*.9;let g;if(d){g=`M ${e.middle} ${l(n)}`;for(let t=0;h>t;t++){const o=l(n+(t+.5)*i);g+=` L ${e.middle+c[t]/p*m} ${o}`}g+=` L ${e.middle} ${l(r)}`;for(let t=h-1;t>=0;t--){const o=l(n+(t+.5)*i);g+=` L ${e.middle-c[t]/p*m} ${o}`}g+=" Z"}else{g=`M ${l(n)} ${e.middle}`;for(let t=0;h>t;t++)g+=` L ${l(n+(t+.5)*i)} ${e.middle-c[t]/p*m}`;g+=` L ${l(r)} ${e.middle}`;for(let t=h-1;t>=0;t--)g+=` L ${l(n+(t+.5)*i)} ${e.middle+c[t]/p*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let b;if(f&&o.length>=4){const t=wu(o,.25)??n,i=wu(o,.5)??(n+r)/2,a=wu(o,.75)??r;b={q1Pos:l(t),medianPos:l(i),q3Pos:l(a),centerPos:e.middle,isVertical:d}}const v=d?{x:e.x,y:Math.min(l(r),l(n)),width:e.width,height:Math.abs(l(r)-l(n))}:{x:Math.min(l(n),l(r)),y:e.x,width:Math.abs(l(r)-l(n)),height:e.width};u.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:v,iqrLine:b,stats:Su(o),style:y,datum:e.pieceData,category:e.name})}return u},histogram:function(e,o){const{scales:r,columns:i,config:a,getR:s,resolveSummaryStyle:l}=e,{r:c}=r,u=[],d=a.bins||25,h=a.normalize,f=c.domain?.(),p=f?+f[0]:void 0,m=f?+f[1]:void 0;for(const e of Object.values(i)){const o=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===o.length)continue;const[r,i]=n(o),a=null!=p&&isFinite(p)?p:r,f=null!=m&&isFinite(m)?m:i,g=(f-a)/d||1,y=Array(d).fill(0);for(const e of o)a>e||e>f||y[Math.min(Math.floor((e-a)/g),d-1)]++;const b=o.length,v=t(y,1),x=l(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===y[t])continue;const o=(h?y[t]/b:y[t]/v)*e.width*.9,n=c(a+t*g),r=c(a+(t+1)*g);u.push(ut(Math.min(n,r),e.x+e.width-o,Math.abs(r-n),o,x,{bin:t,count:y[t],range:[a+t*g,a+(t+1)*g],category:e.name},e.name))}}return u},ridgeline:function(e,o){const{scales:n,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=n,u=[],d=i.bins||20,h="horizontal"===c,f=i.amplitude||1.5;for(const e of Object.values(r)){const o=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>o.length)continue;const n=o[0],r=o[o.length-1],i=(r-n)/d||1,c=Array(d).fill(0);for(const e of o)n>e||e>r||c[Math.min(Math.floor((e-n)/i),d-1)]++;const p=t(c,1),m=s(e.pieceData[0],e.name),g=e.width*f;let y;if(h){const t=e.x+e.width;y=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(n+(e+.5)*i)} ${t-c[e]/p*g}`;y+=` L ${l(r)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*i);y+=` L ${t+c[e]/p*g} ${o}`}y+=` L ${t} ${l(r)} Z`}const b=h?{x:Math.min(l(n),l(r)),y:e.x,width:Math.abs(l(r)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(r),l(n)),width:e.width,height:Math.abs(l(r)-l(n))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:b,stats:Su(o),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="horizontal"===s;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,s]=o,u=i(t,e.name);if(c){const o=a(Math.min(n,s)),r=a(Math.max(n,s));l.push(ut(o,e.x,r-o,e.width,u,t,e.name))}else{const o=a(Math.max(n,s)),r=a(Math.min(n,s));l.push(ut(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,a=[],s=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return a;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let p=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=n(i);a.total+=s,a.pieces.push(i),o+=s}f.push({col:e,groups:t,stepTotal:o}),h||o>p&&(p=o)}if(h)for(const e of f){let t=0,o=0;for(let n=0;u.length>n;n++){const r=e.groups.get(u[n]);r&&(n%2==0?t+=r.total:o+=r.total)}const n=Math.max(t,o);n>p&&(p=n)}if(0===p)return a;const m=new Map;for(const e of u){const t=f[0].groups.get(e);m.set(e,t?.total??0)}const g=f[0].stepTotal,y=h?.95*s:.9*t.width,b=Au().domain([0,p]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const o=f[t],n=o.col,r=0===t,c=n.width,d=.55*c,p=n.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=s,c=s;for(let h=0;u.length>h;h++){const f=u[h],g=o.groups.get(f);if(!g)continue;const v=b(g.total),x=h%2==0,k=x?t:c-v;x?t+=v:c-=v;const w=i(g.pieces[0],f),S=m.get(f)??g.total,A={...g.pieces[0],__funnelValue:g.total,__funnelPercent:S>0?g.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:g.total,__pieceCount:g.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=s,A.__funnelStepLabelY=p,A.__funnelRowWidth=e),A.__funnelValueLabelX=k+v/2,A.__funnelValueLabelY=p,A.__funnelBarW=v),a.push(ut(k,p,v,d,w,A,f)),y.set(f,{x:k,y:p,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=s-t/2,h=u[0],f="_default"!==h,m=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(m,v),k=g>0?e/g*100:0,w={...m,__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=s,w.__funnelStepLabelY=p,w.__funnelRowWidth=t,w.__funnelValueLabelX=s,w.__funnelValueLabelY=p,w.__funnelBarW=t),a.push(ut(c,p,t,d,x,w,v)),y.set(h,{x:c,y:p,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),s=y.get(r);if(!t||!s)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};a.push(c)}}x=y}return a},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:a}=e,s=[],l=a.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return s;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=n(i);a.total+=s,a.pieces.push(i),o+=s}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const p=a.r,m=d?c.length:1,g=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,n=0===e,r=e>0?h[e-1]:null,a=o.width/m,l=a*g,u=a-l;for(let e=0;c.length>e;e++){const h=c[e],m=t.groups.get(h);if(!m)continue;const g=m.total,y=f.get(h)??g,b=y>0?g/y*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??g)-g),k=o.x+e*a+l/2,w=p(g),S=p(0)-w,A=i(m.pieces[0],d?h:o.name),C={...m.pieces[0],__barFunnelValue:g,__barFunnelPercent:b,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:k+u/2,__barFunnelLabelY:p(g+x)};if(s.push(ut(k,w,u,S,A,C,d?h:o.name)),x>0){const e=p(g+x),t=w-e,n={...A},r={...m.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};s.push(ut(k,e,u,t,n,r,d?h:o.name))}}}return s},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=s.range(),i=Math.min(o,r),a=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?ut(i,o.x,a,o.width,n,null,"__track__"):ut(o.x,i,o.width,a,n,null,"__track__");c.push(r)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=a(o,l);let p;if(u){const r=s(t),i=s(t+n);p=ut(r,e.x,i-r,e.width,f,o,l)}else{const r=s(t+n),i=s(t);p=ut(e.x,r,e.width,i-r,f,o,l)}d&&(p.fillGradient=d,p.roundedEdge=h),c.push(p),t+=n}if(p>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},n.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},n.cornerRadii={tl:p,tr:p})}}return c}};function Mu(e,t,o){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Ie[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function _u(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&He(o,e)||"#4e79a7":t=>{if(o){const e=He(o,t);if(e)return e}let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return e[Math.abs(n)%e.length]??"#4e79a7"}}var Pu=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ru=["scene-style","data-paint","accessibility","evidence"],Lu=(e,t)=>({retainedData:e,invalidations:t}),Tu=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],$u=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Iu=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Nu=["scene-geometry","data-paint","accessibility","evidence"],Du=["scene-style","data-paint","accessibility","evidence"],Eu=[],Bu={chartType:Lu("rebuild",Tu),runtimeMode:Lu("rebuild",Tu),categoryAccessor:Lu("rebuild",Tu),valueAccessor:Lu("rebuild",Tu),oAccessor:Lu("rebuild",Tu),rAccessor:Lu("rebuild",Tu),stackBy:Lu("rebuild",Tu),groupBy:Lu("rebuild",Tu),timeAccessor:Lu("rebuild",Tu),accessorRevision:Lu("rebuild",Tu),colorAccessor:Lu("rebuild",Du),symbolAccessor:Lu("rebuild",Nu),connectorAccessor:Lu("rebuild",Nu),dataIdAccessor:Lu("rebuild",Nu),projection:Lu("preserve",$u),extentPadding:Lu("preserve",$u),axisExtent:Lu("preserve",$u),rExtent:Lu("preserve",$u),oExtent:Lu("preserve",$u),multiAxis:Lu("preserve",$u),normalize:Lu("preserve",$u),bins:Lu("preserve",$u),oSort:Lu("preserve",Iu),barPadding:Lu("preserve",Iu),roundedTop:Lu("preserve",Iu),baselinePadding:Lu("preserve",Iu),innerRadius:Lu("preserve",Iu),cornerRadius:Lu("preserve",Iu),startAngle:Lu("preserve",Iu),sweepAngle:Lu("preserve",Iu),trackFill:Lu("preserve",Iu),showOutliers:Lu("preserve",Iu),showIQR:Lu("preserve",Iu),amplitude:Lu("preserve",Iu),connectorOpacity:Lu("preserve",Iu),showLabels:Lu("preserve",Iu),dynamicColumnWidth:Lu("rebuild",Iu),customLayout:Lu("preserve",Iu),layoutConfig:Lu("preserve",Iu),layoutMargin:Lu("preserve",Iu),symbolMap:Lu("preserve",Nu),pieceStyle:Lu("preserve",Du),summaryStyle:Lu("preserve",Du),connectorStyle:Lu("preserve",Du),gradientFill:Lu("preserve",Du),colorScheme:Lu("preserve",Du),themeCategorical:Lu("preserve",Du),themeSemantic:Lu("preserve",Du),themeSequential:Lu("preserve",Du),themeDiverging:Lu("preserve",Du),barColors:Lu("preserve",Du),decay:Lu("preserve",Du),pulse:Lu("preserve",Du),staleness:Lu("preserve",Du),layoutSelection:Lu("preserve",Du),windowSize:Lu("preserve",Eu),windowMode:Lu("preserve",Eu),clock:Lu("preserve",Eu),transition:Lu("preserve",Eu),introAnimation:Lu("preserve",Eu),onLayoutError:Lu("preserve",Eu)},Fu=Lu("preserve",Iu),Hu=class{constructor(){this.tracker=new co}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}},Pu)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Ru):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Bu[n]??Fu;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};import{quadtree as zu}from"d3-quadtree";var Ou=class{constructor(e){this.rExtent=new Q,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Hu,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new bu,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new Z(e.windowSize),this.getO=oe(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Q)):(this.getR=ee(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=oe(e.stackBy),this.getGroup=oe(e.groupBy),this.getColor=oe(e.colorAccessor),this.getSymbol=oe(e.symbolAccessor),this.getConnector=oe(e.connectorAccessor),this.getDataId=oe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Z(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=this.currentTime(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:Ut(t,n):null)}currentTime(){return this.config.clock?.()??Ge()}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),qt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Kt(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=Kt(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,n=this.scales,r=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const a=this.getBufferArray(),s=t.projection||"vertical",l=t.oExtent||this.resolveCategories(a),c=this.computeValueDomain(a,l),u="horizontal"===s,d="radial"===s,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let f,p;if(d){f=gu().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;p=yu().domain(c).range([n,o])}else u?(f=gu().domain(l).range([0,e.height]).padding(h),p=yu().domain(c).range([0,e.width])):(f=gu().domain(l).range([0,e.width]).padding(h),p=yu().domain(c).range([e.height,0]));this.scales={o:f,r:p,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[a,s]=i.extent;a===1/0&&(a=0,s=1);const l=s-a,c=l>0?l*(t.extentPadding??.05):1;return a-=c,s+=c,a>0&&(a=0),u?yu().domain([a,s]).range([0,e.width]):yu().domain([a,s]).range([e.height,0])}):[];let m=a;this.rAccessors.length>1&&(m=a.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(m,l,f,s,e),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(m,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=g,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:a=.05,baselinePadding:s,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=a;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let p=0,m=0;if("bar"===o&&d&&r)p=0,m=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>m&&(m=t);for(const e of o.values())p>e&&(p=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t),p>t&&(p=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>m&&(m=t),p>t&&(p=t)}else{const e=h[0],t=h[1];e!==1/0&&(p=e),t!==-1/0&&(m=t)}i&&(null!=i[0]&&(p=i[0]),null!=i[1]&&(m=i[1]));const g="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(g&&null==i?.[0]&&null==i?.[1]&&(p>0&&(p=0),0>m&&(m=0)),"bar-funnel"!==o&&"exact"!==l){const e=m-p,t=e>0?e*f:1,n=g&&!s&&0===p,r=g&&!s&&0===m||"swimlane"===o;null!=i?.[0]||n||(p-=t),null!=i?.[1]||r||(m+=t)}return[p,m]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:a,getO:s,getR:l}=e,c={},u=new Map;for(const e of t){const t=s(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(a&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof a?o.reduce((e,t)=>e+(Number(t[a])||0),0):a(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,p=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,a;h?(i=p,a=h.get(e)||n.bandwidth(),p+=a+n.padding()*n.step()):(i=n(e)??0,a=n.bandwidth()),c[e]={name:e,x:i,y:0,width:a,middle:i+a/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let n;try{n=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Ht("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return Et({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),n=Cu[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const a=[],{projection:s}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,a;"point"===e.type?(n=e.x,a=e.y):(n=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:a,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],s="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:s,datum:r.datum,group:t})}}return a}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=Mu(o.colorScheme,o.themeCategorical,De),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:n,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:_u(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?Je(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=et(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,n=o?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const a=e[i],s=o?t(a):a[n],l=r.get(s);l?l.push(i):r.set(s,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:zu().x(e=>e.x).y(e=>e.y).addAll(n)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=n.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const a=e.color??"rgba(255,255,255,0.6)",s=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const a of r(t)??[]){const t=o.get(a);null!=t&&(n=Math.max(n,tt(e,t,i)))}l=ot(c,n,a)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=ot(c,null==u?0:tt(e,u,i),a,s)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&nt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],a=this.getNodeKey(i,e);a&&("rect"===i.type?this.prevPositionMap.set(a,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(a,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(a,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const a=this.prevPositionMap.get(i);if("point"===r.type)a?(o.add(i),r._targetOpacity=r.style.opacity??1,(a.x!==r.x||a.y!==r.y||void 0!==a.r&&a.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=a.x,r.y=a.y,void 0!==a.r&&(r.r=a.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)a?(o.add(i),r._targetOpacity=r.style.opacity??1,a.x===r.x&&a.y===r.y&&a.w===r.w&&a.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=a.x,r.y=a.y,r.w=a.w??r.w,r.h=a.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(a)o.add(i),r._targetOpacity=r.style.opacity??1,a.startAngle===r.startAngle&&a.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=a.startAngle,r.endAngle=a.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=je(e,this.activeTransition),o=We(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Ye(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Ye(n.x,e._targetX,o),e.y=Ye(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=Ye(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Ye(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Ye(n.x,e._targetX,o),e.y=Ye(n.y,e._targetY,o),void 0!==n.w&&(e.w=Ye(n.w,e._targetW,o),e.h=Ye(n.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style={...e.style,opacity:Ye(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=Ye(n.startAngle,e._targetStartAngle,o),e.endAngle=Ye(n.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ae(e),o=this.getDataId,n=e=>t.has(o(e));Zt(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=ae(e),n=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!J(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!J(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!J(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let n=!1;("categoryAccessor"in e||"oAccessor"in e)&&(J(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=oe(this.config.categoryAccessor||this.config.oAccessor,"category"),n=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,n=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(r=n.length!==i.length||n.some((e,t)=>!J(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Q)):(this.getR=ee(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!J(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?oe(this.config.stackBy):void 0),"groupBy"in e&&!J(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?oe(this.config.groupBy):void 0),"colorAccessor"in e&&!J(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!J(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?oe(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!J(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?oe(this.config.connectorAccessor):void 0),(n||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function Wu(e,t,o,n=30,r,i=0){let a=null;if(r){const e=fn(r,t,o,n,i);e&&(a={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=ju(i,t,o);break;case"point":if(r)break;e=Yu(i,t,o,n);break;case"symbol":e=Gu(i,t,o,n);break;case"glyph":e=Vu(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=Xu(i,t,o);break;case"boxplot":e=qu(i,t,o);break;case"violin":e=Uu(i,t,o)}e&&n>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function ju(e,t,o){const n=Qo(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Yu(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>Jo(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Gu(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>Jo(It(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Vu(e,t,o,n=30){if(null==e.datum)return null;const r=dn(e.glyph,e.size),i=e.x+r.centerDx,a=e.y+r.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>Jo(r.radius,n)?null:{datum:e.datum,x:i,y:a,distance:c}}function Xu(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=on(Math.atan2(r,n)),s=on(e.startAngle),l=on(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function qu(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Uu(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:a}=e.bounds;return n>t||t>n+i||r>o||o>r+a?null:{datum:e.datum,x:n+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}io(Ou);import{useMemo as Ku,useRef as Zu}from"react";import{Fragment as Qu,jsx as Ju,jsxs as ed}from"react/jsx-runtime";function td(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===a?.projection,f="horizontal"===a?.projection,p=Ku(()=>!a||h?[]:(u||ha(a.r,5,d)).map(e=>({value:e,pixel:a.r(e),label:(c||od)(e)})),[a,c,h,u,d]),m=l&&a&&!h,g=s&&a&&!h;return m||g?Ju("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:ed("g",{transform:`translate(${i.left},${i.top})`,children:[m&&Ju("g",{className:"ordinal-grid",children:p.map((e,n)=>Ju("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&Ju(Qu,{children:ed(Qu,f?{children:[Ju("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Ju("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[Ju("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Ju("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function od(e){return Math.round(100*e)/100+""}function nd(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:p,legend:m,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:k,foregroundGraphics:w,annotations:S,onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_,autoPlaceAnnotations:P,svgAnnotationRules:R,xAccessor:L,yAccessor:T,annotationData:$,underlayRendered:I,canvasObscuresUnderlay:N=!0,children:D}=e,E=wi({onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_}),B="radial"===a?.projection,F="horizontal"===a?.projection,H=!1!==l,z=!I||N,O=Ku(()=>{if(!s||!H||!a||B)return[];const e=a.o.bandwidth(),t=a.o.domain().map((t,o)=>({value:t,pixel:(a.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e,n=t.map(e=>{return t=e.label,F?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=F?0:6;if(n.every((e,t)=>0===t||o>=(n[t-1]+e)/2+r))return t;const i=Math.max(...n)+r,l=Math.max(1,Math.ceil(i/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[s,H,a,d,B,F]),W=e.rTickValues,j=e.tickLabelEdgeAlign,Y=e.axisExtent,G=Ku(()=>s&&a&&!B?(W||ha(a.r,5,Y)).map(e=>({value:e,pixel:a.r(e),label:(h||od)(e)})):[],[s,a,h,B,W,Y]),V=Zu(new Map),X=Zu(S?.length??0),q=S?.length??0;X.current!==q&&(X.current=q,V.current=new Map);const U=Ku(()=>{if(!S||0===S.length)return null;const e=Di(0,E),n="horizontal"===a?.projection,r=a?.o?e=>(a.o(e)??0)+a.o.bandwidth()/2:null,i={scales:a?{x:n?a.r:r||a.r,y:n&&r||a.r,time:a.r,value:a.r,o:a.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:t,height:o,data:$,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:V.current};return Ni(P?ea({annotations:S,context:i,..."object"==typeof P?P:{}}):S,e,R,i)},[S,P,R,t,o,a,L,T,$,E]);return s||p||m||w||U&&U.length>0||f||D?ed("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Ju("title",{children:"string"==typeof p?p:"Ordinal Chart"}),Ju("desc",{children:"string"==typeof p?p+" — ordinal data visualization":"Ordinal data visualization"}),ed("g",{transform:`translate(${i.left},${i.top})`,children:[f&&a&&!B&&z&&Ju("g",{className:"ordinal-grid",children:G.map((e,n)=>Ju("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),s&&a&&!B&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return Ju("g",{className:"ordinal-axes",children:ed(Qu,F?{children:[ed("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[z&&Ju("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),O.map((t,o)=>ed("g",{transform:`translate(0,${t.pixel})`,children:[Ju("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Ju("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Ju("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Ju("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&Ju("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),ed("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[z&&Ju("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z&&a?.r&&(()=>{const e=a.r(0);return e>1&&t-1>e?Ju("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((t,n)=>{const r=j?0===n?"start":n===G.length-1?"end":"middle":"middle";return ed("g",{transform:`translate(${t.pixel},${o})`,children:[Ju("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Ju("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&Ju("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[ed("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[z&&(()=>{const e=a?.r?a.r(0):o,n=0>e||e>o?o:e;return Ju("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),O.map((t,n)=>ed("g",{transform:`translate(${t.pixel},${o})`,children:[Ju("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Ju("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Ju("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Ju("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&Ju("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),ed("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[z&&Ju("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((t,o)=>ed("g",{transform:`translate(0,${t.pixel})`,children:[Ju("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Ju("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&Ju("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),U,w,D]}),p&&"string"==typeof p?Ju("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:p}):p?Ju("foreignObject",{x:0,y:0,width:n,height:i.top,children:p}):null,Lr({legend:m,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:p,legendLayout:k,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}import{useRef as rd,useEffect as id}from"react";import{select as ad}from"d3-selection";import{brushX as sd,brushY as ld}from"d3-brush";import{jsx as cd,jsxs as ud}from"react/jsx-runtime";function dd({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:a}){const s=rd(null),l=rd(null),c=rd(a);c.current=a;const u=rd(i);u.current=i;const d=rd(!1),h=rd(null),f="horizontal"===i?.projection,p=rd(f);p.current=f;const m=S({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!s.current)return;const n=ad(s.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!p.current)return;const r=t.r.domain(),[i,a]=[Math.min(...r),Math.max(...r)],f=(a-i)/20,m=h.current?.r??[i+.4*(a-i),i+.6*(a-i)],g="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=m;if(e.resize)0>g?y=Math.max(i,y-f):b=Math.min(a,b+f);else{const e=b-y;y=Math.max(i,Math.min(a-e,y+g*f)),b=y+e}const v={r:[y,b]};d.current=!0,n.call(o.move,p.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return id(()=>{if(!s.current)return;const o=ad(s.current).select(".brush-g"),n=f?sd():ld();return n.extent([[0,0],[e,t]]),n.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,n]=e.selection;let r;r=p.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};h.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,f]),id(()=>{if(!i||!l.current||!h.current)return;if(!s.current)return;const e=h.current,t=ad(s.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,f]),ud("svg",{ref:s,width:o,height:n,...m.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[cd("title",{children:m.svgProps["aria-label"]}),cd("desc",{id:m.descriptionId,children:m.description}),cd("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}import{arc as hd}from"d3-shape";function fd(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=Ta({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(n);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=xn(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function pd(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function md(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=hd().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var gd=(e,t,o,n)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)fd(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(pd(e,t),ec(e,t)),e.globalAlpha=1;else{if(e.fillStyle=Wn(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=La({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),md(e,t)):(pd(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(pd(e,t),ec(e,t)),e.globalAlpha=1}},yd=(e,t,o,n)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,n="vertical"===t.projection,r=xn(e,"var(--semiotic-primary, #007bff)"),i=xn(e,"var(--semiotic-text, #333)"),a=Wn(e,t.style.fill,r),s=t.style.stroke,l="string"==typeof s?xn(e,s)||s:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=u,e.fillStyle=a,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},bd=(e,t,o,n)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=Wn(e,t.style.fill,"#007bff"),e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},vd=(e,t,o,n)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=jn(e,o.fill)??"#999",e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=xn(e,o.style.stroke)||Wn(e,o.style.fill,"")||xn(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},xd=(e,t,o,n)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=jn(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function kd(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function wd(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Sd=new Map;function Ad(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Sd.get(o);if(void 0!==n)return n;const r=Sn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Sd.set(o,r),r}function Cd(e,t,o,n,r,i){e.moveTo(t+i,o),e.lineTo(t+n-i,o),e.quadraticCurveTo(t+n,o,t+n,o+i),e.lineTo(t+n,o+r-i),e.quadraticCurveTo(t+n,o+r,t+n-i,o+r),e.lineTo(t+i,o+r),e.quadraticCurveTo(t,o+r,t,o+r-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Md(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function _d(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function Pd(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Rd(e){return(t,o,n,r)=>{e(t,o.filter(Pd),{x:n.r,y:n.r},r)}}var Ld=Rd(fc),Td=Rd(ic),$d=Rd(lc),Id=Rd(uc),Nd=e=>[vd,...e],Dd={bar:Nd([Ld]),clusterbar:Nd([Ld]),point:Nd([Td,$d]),swarm:Nd([Td,$d]),pie:[gd],donut:[gd],boxplot:Nd([yd,Td]),violin:Nd([bd]),histogram:Nd([Ld]),ridgeline:Nd([bd]),timeline:Nd([Ld]),funnel:[Ld,xd,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,a=!0===o.__funnelIsFirstStep;let s;if(s=a?kd(r):null!=i?`${kd(r)} (${wd(i)})`:kd(r),e.measureText(s).width+16>n){if(a||null==i)continue;if(s=kd(r),e.measureText(s).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(s,l,c),e.fillStyle="#fff",e.fillText(s,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ld,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||xn(e,"var(--semiotic-border, #999)"),n=Ad(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[o,n,r]=kn(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,xn(e,"var(--semiotic-text, #333)")),a=i?"#1f2937":"#ffffff",s=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?_d(r):"",d=Md(n);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,p=Math.max(h,f)+12,m=i?32:17,g=o.__barFunnelLabelX,y=g-p/2,b=o.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),Cd(e,y,b,p,m,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),Cd(e,y,b,p,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,g,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,g,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,g,b+3))}e.lineWidth=1}],swimlane:Nd([Ld]),custom:Nd([Ld,Td,$d,Id,gd,yd,bd,xd])};import{jsx as Ed,jsxs as Bd}from"react/jsx-runtime";function Fd(e){const t=Ks(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:Bd("div",{className:"semiotic-tooltip",style:Js,children:[null!=t.title&&Ed("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>Bd("div",{children:[Bd("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Hd({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return Bd("div",{className:"semiotic-tooltip",style:Js,children:[e&&Ed("div",{style:{fontWeight:"bold"},children:e+""}),Bd("div",{children:["n = ",o.n]}),Bd("div",{children:["Min: ",o.min.toLocaleString()]}),Bd("div",{children:["Q1: ",o.q1.toLocaleString()]}),Bd("div",{children:["Median: ",o.median.toLocaleString()]}),Bd("div",{children:["Q3: ",o.q3.toLocaleString()]}),Bd("div",{children:["Max: ",o.max.toLocaleString()]}),Bd("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return Bd("div",{className:"semiotic-tooltip",style:Js,children:[e&&Ed("div",{style:{fontWeight:"bold"},children:e+""}),Bd("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return Bd("div",{className:"semiotic-tooltip",style:Js,children:[t.category&&Ed("div",{style:{fontWeight:"bold"},children:t.category+""}),Bd("div",{children:["Count: ",t.count]}),2===e.length&&Bd("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,a=e.__chartType;if("swarm"===a||"point"===a)return Fd(t);const s=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return s||""!==l?Bd("div",{className:"semiotic-tooltip",style:Js,children:[s&&Ed("div",{style:{fontWeight:"bold"},children:s+""}),""!==l&&Ed("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Fd(t)}Hd.ownsChrome=!0;import{jsx as zd,jsxs as Od}from"react/jsx-runtime";var Wd={top:50,right:40,bottom:60,left:70},jd=mu(pu(function(e,t){const{chartType:o,runtimeMode:n,data:r,oAccessor:i="category",rAccessor:a="value",colorAccessor:s,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:p,categoryAccessor:m,accessorRevision:g,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:k,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:_,cornerRadius:P,normalize:R,startAngle:L,sweepAngle:I,dynamicColumnWidth:N,bins:D,showOutliers:E,showIQR:B,amplitude:F,connectorOpacity:H,showLabels:z,connectorAccessor:O,connectorStyle:j,dataIdAccessor:Y,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:q,windowMode:U="sliding",windowSize:K=200,pieceStyle:Z,summaryStyle:Q,renderMode:J,colorScheme:ee,barColors:te,showAxes:oe=!0,showCategoryTicks:ne,categoryLabel:re,valueLabel:ie,categoryFormat:ae,valueFormat:se,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:pe,enableHover:me=!0,hoverAnnotation:ge,tooltipContent:ye,customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,annotationObservationCallback:ke,chartId:we,annotations:Se,onAnnotationActivate:Ae,autoPlaceAnnotations:Ce,svgAnnotationRules:Me,showGrid:_e=!1,legend:Pe,legendHoverBehavior:Re,legendClickBehavior:Le,legendHighlightedCategory:Te,legendIsolatedCategories:$e,legendPosition:Ie,legendLayout:Ne,legendCategoryAccessor:De,onCategoriesChange:Ee,backgroundGraphics:Be,foregroundGraphics:Fe,title:He,className:ze,background:Oe,centerContent:We,decay:je,pulse:Ye,transition:Ge,animate:Ve,staleness:Xe,frameScheduler:qe,clock:Ue,random:Ke,seed:Ze,paused:Qe=!1,suspendWhenHidden:Je=!0,brush:et,onBrush:tt,accessibleTable:ot=!0,description:nt,summary:rt,customLayout:it,onLayoutError:at,layoutConfig:st,layoutSelection:lt}=e,{customHoverBehavior:ct,customClickBehavior:ut,hasClickBehavior:dt}=jc({customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,chartId:we,chartType:"StreamOrdinalFrame"}),ht=m??i,ft=p??a,pt=lu(!0),mt=Pl({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:k,marginDefault:Wd,title:He,legend:Pe,legendPosition:Ie,animate:Ve,transitionProp:Ge,frameScheduler:qe,clock:Ue,random:Ke,seed:Ze,paused:Qe,suspendWhenHidden:Je,themeDirtyRef:pt}),{reducedMotionRef:gt,responsiveRef:yt,size:bt,margin:vt,adjustedWidth:xt,adjustedHeight:kt,currentTheme:wt,transition:St,introEnabled:At,tableId:Ct,rafRef:Mt,renderFnRef:_t,scheduleRender:Pt,frameRuntime:Rt}=mt,Lt=Va(),Tt=Ka(),$t=du(()=>T(r),[r]),It=re??le,Nt=ie??ce,Dt=ae??ue,Et=se??de,Bt=lu(null),[Ft,Ht]=cu(null),[zt,Ot]=cu(null),Wt=Dl(Fe,bt,vt,zt),jt=Dl(Be,bt,vt,zt),Yt=Be||"transparent"===Oe?null:zd("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-vt.left,y:-vt.top,width:bt[0],height:bt[1],fill:Oe||"var(--semiotic-bg, transparent)"}),[Gt,Vt]=cu(0),Xt=lu(0),[qt,Ut]=cu(!1),Kt=lu({w:-1,h:-1}),Zt=lu(!1),Qt=Bo("StreamOrdinalFrame"),Jt=me||ge,eo="streaming"===n,to=Qa(du(()=>({chartType:o,runtimeMode:eo?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:X,projection:y,oAccessor:eo?void 0:ht,rAccessor:eo?void 0:ft,accessorRevision:g,colorAccessor:s,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:eo?f:void 0,valueAccessor:eo?p||("string"==typeof ft||"function"==typeof ft?ft:void 0):void 0,categoryAccessor:eo?ht:void 0,rExtent:G,oExtent:V,axisExtent:pe,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:_,cornerRadius:P,normalize:R,startAngle:L,sweepAngle:I,dynamicColumnWidth:N,bins:D,showOutliers:E,showIQR:B,amplitude:F,connectorOpacity:H,showLabels:z,connectorAccessor:O,connectorStyle:j,dataIdAccessor:Y,oSort:q,pieceStyle:Z,summaryStyle:Q,colorScheme:ee,themeCategorical:wt?.colors?.categorical,themeSemantic:W(wt),themeSequential:wt?.colors?.sequential,themeDiverging:wt?.colors?.diverging,barColors:te,decay:je,pulse:Ye,transition:St,introAnimation:At,staleness:Xe,clock:Rt.now,customLayout:it,onLayoutError:at,layoutConfig:st,layoutMargin:vt}),[o,eo,K,U,X,y,ht,ft,g,s,l,c,u,d,h,f,p,G,V,pe,w,S,A,C,M,_,P,R,L,I,N,D,E,B,F,H,z,O,j,Y,q,Z,Q,ee,wt,te,je,Ye,St,At,Xe,Rt.now,it,at,st,vt])),oo=lu(null);oo.current||(oo.current=new Ou(to));const no=zl(oo,De,Ee,e=>e.getData());Ko(oo,to,pt,Pt),Zo(oo,lt,pt,Pt);const ro=lu(null);ro.current||(ro.current=new $(e=>{const t=oo.current;t&&t.ingest(e)&&(pt.current=!0,Pt())}));const io=hu(e=>{ro.current?.push(e)},[]),ao=hu(e=>{ro.current?.pushMany(e)},[]),so=hu(()=>{ro.current?.clear(),oo.current?.clear(),pt.current=!0,Pt()},[Pt]),lo=hu(e=>{ro.current?.clearLastData(),ro.current?.setReplacementData(e)},[]);fu(t,()=>({push:io,pushMany:ao,replace:lo,remove:e=>{ro.current?.flush();const t=oo.current?.remove(e)??[];if(t.length>0){const e=Bt.current?.data;!!Bt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Bt.current=null,Ht(null)),pt.current=!0,Pt()}return t},update:(e,t)=>{ro.current?.flush();const o=oo.current?.update(e,t)??[];return o.length>0&&(pt.current=!0,Pt()),o},clear:so,getData:()=>(ro.current?.flush(),oo.current?.getData()??[]),getScales:()=>oo.current?.scales??null,getCustomLayout:()=>oo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>oo.current?.lastCustomLayoutFailure??null}),[io,ao,lo,so,Pt]),uu(()=>{r&&ro.current?.setBoundedData($t)},[r,$t]);const{canvasRef:co}=$l(mt,{storeRef:oo,dirtyRef:pt,hydrated:Lt,wasHydratingFromSSR:Tt,cleanup:()=>ro.current?.clear(),canvasPaintDependencies:[o,xt,kt,oe,Oe,Be,J,Pt]}),{hoverHandlerRef:uo,hoverLeaveRef:ho,onPointerMove:fo,onPointerLeave:po}=mt;uo.current=e=>{if(!Jt)return;const t=co.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return void(Bt.current&&(Bt.current=null,Ht(null),ct&&ct(null),Pt()));const a=oo.current;if(!a||0===a.scene.length)return;const s="radial"===y,l=Wu(a.scene,s?r-xt/2:r,s?i-kt/2:i,30,a.pointQuadtree,a.maxPointRadius);if(!l)return void(Bt.current&&(Bt.current=null,Ht(null),ct&&ct(null),Pt()));const c=Ys(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ht?ht:void 0,__rAccessor:"string"==typeof ft?ft:void 0,__chartType:o});Bt.current=c,Ht(c),ct&&(ct(c),pt.current=!0),Pt()},ho.current=()=>{Bt.current&&(Bt.current=null,Ht(null),ct&&(ct(null),pt.current=!0),Pt())};const mo=hu(e=>{if(Ci(e.target))return;if(!ut)return;const t=co.current;if(!t)return ut(null),pt.current=!0,void Pt();const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return ut(null),pt.current=!0,void Pt();const a=oo.current;if(!a||0===a.scene.length)return ut(null),pt.current=!0,void Pt();const s="radial"===y,l=Wu(a.scene,s?r-xt/2:r,s?i-kt/2:i,30,a.pointQuadtree,a.maxPointRadius);if(!l)return ut(null),pt.current=!0,void Pt();ut(Ys(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ht?ht:void 0,__rAccessor:"string"==typeof ft?ft:void 0,__chartType:o}),{type:"activate",inputType:Fc(e.nativeEvent.pointerType)}),pt.current=!0,Pt()},[ut,co,vt.left,vt.top,xt,kt,y,ht,ft,o,Pt]),{kbFocusIndexRef:go,focusedNavPointRef:yo,onKeyDown:bo}=function({chartType:e,oAccessor:t,rAccessor:o,...n}){return eu({...n,extractPoints:Zc,toHover:n=>({...Jc(n),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof o?o:void 0,__chartType:e})})}({storeRef:oo,hoverRef:Bt,setHoverPoint:Ht,customHoverBehavior:ct,customClickBehavior:ut,scheduleRender:Pt,chartType:o,oAccessor:ht,rAccessor:ft}),vo=hu(e=>{go.current=-1,yo.current=null,fo(e)},[yo,go,fo]);_t.current=()=>{if(Mt.current=null,!Rt.isActive)return;const e=co.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=oo.current;if(!n)return;const r=Rt.now(),i=n.advanceTransition(gt.current?r+1e6:r),a=!gt.current&&i,s=Kt.current.w!==xt||Kt.current.h!==kt,l=pt.current;let c=!1;const u=Qt.current.beforeCompute(n.getLastUpdateResult(),a);!l&&!s||a&&!s||(n.computeScene({width:xt,height:kt}),Kt.current={w:xt,h:kt},c=!0,no()),Qt.current.afterCompute(u,c,s),pt.current=l&&a&&!c;const d=Nl(n,r,c,Zt);(c||a)&&e.setAttribute("aria-label",vs(n.scene,o+" chart"));const h=Bl(),f=bt[0]*h,p=bt[1]*h;e.width===f&&e.height===p||(e.width=f,e.height=p,e.style.width=bt[0]+"px",e.style.height=bt[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,bt[0],bt[1]);const m=Xe&&n.lastIngestTime>0&&r-n.lastIngestTime>(Xe?.threshold??5e3);m&&(t.globalAlpha=Xe?.dimOpacity??.5);const g="radial"===y;t.save(),t.beginPath(),t.rect(vt.left,vt.top,xt,kt),t.clip(),g?(t.save(),t.translate(vt.left+xt/2,vt.top+kt/2)):t.translate(vt.left,vt.top);const b=it?Dd.custom:Dd[o]||[],v={width:xt,height:kt},x=n.scales;x&&Sc({context:t,nodes:n.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const o of b)o(t,e,x,v)}}),g&&t.restore(),t.restore(),m&&(t.globalAlpha=1),c&&n.scales?(Ot(n.scales),Vt(e=>e+1),Xt.current=r):a&&n.scales&&r-Xt.current>=33&&(Vt(e=>e+1),Xt.current=r),Xe?.showBadge&&Ut(!!m),(a||null!=n.activeTransition||d.pending)&&Pt()},hr(Xe,oo,pt,Pt,qt,Ut);const xo=Jt&&Ft?ye?ye(Ft):zd(Hd,{hover:Ft}):null,ko="radial"===y,wo=xo?zd(sl,{x:Ft?ko?Ft.x+xt/2:Ft.x:0,y:Ft?ko?Ft.y+kt/2:Ft.y:0,containerWidth:xt,containerHeight:kt,margin:vt,className:"stream-ordinal-tooltip",children:xo}):null,So="horizontal"===y?ht:ft,Ao=Ol("horizontal"===y?ft:ht,void 0,"__semiotic_resolvedO",""),Co=Ol(So,void 0,"__semiotic_resolvedR",""),Mo=Ao.key,_o=Co.key,Po=Wl(Ao,Co,Se&&Se.length>0||!1);if(Ha||!Lt&&Tt){const e=oo.current;e&&r&&(e.ingest({inserts:$t,bounded:!0}),e.computeScene({width:xt,height:kt}));const t=e?.scene??[],o=e?.scales??null,n=Dl(Fe,bt,vt,o),i=Dl(Be,bt,vt,o),a="radial"===y,s=a?vt.left+xt/2:vt.left,l=a?vt.top+kt/2:vt.top;return Od("div",{ref:yt,className:"stream-ordinal-frame"+(ze?" "+ze:""),role:"img","aria-label":nt||("string"==typeof He?He:"Ordinal chart"),style:{position:"relative",width:v?"100%":bt[0],height:x?"100%":bt[1]},children:[zd(Es,{summary:rt}),Od("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0},children:[i&&zd("g",{transform:`translate(${vt.left},${vt.top})`,children:i}),Od("g",{transform:`translate(${s},${l})`,children:[Oe&&zd("rect",{x:0,y:0,width:xt,height:kt,fill:Oe}),t.map((e,t)=>Ac({node:e,index:t,renderMode:J,fallback:()=>function(e,t,o){const n=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=o=>`ord-${e.type}-${n}-${t}-${o}`,i=`ord-${e.type}-${n}-${t}`;switch(e.type){case"rect":{const t=e,o=Fa(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o)return null;let n=e.x,r=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,a=e.y);const s=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)s.push($a("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=Da(e.style.fill);s.push($a("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),s.push($a("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return $a("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:a,children:s})}(t,o);let r,a;if(n)a=`url(#${o})`;else if(Mn(t.style.fill)){const e=Fa(i)+"-hatch";r=Ln(t.style.fill,e),a=`url(#${e})`}else a=Da(t.style.fill);const s=n||r?Ia("defs",{children:[n,r]}):null;if(t.cornerRadii&&_a(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:a,br:s,bl:l}=Pa(e);let c=`M${t+i},${o}`;return c+=` L${t+n-a},${o}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n},${o+a}`),c+=` L${t+n},${o+r-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n-s},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return Ia(Ca.Fragment,{children:[s,$a("path",{d:e,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:n,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o},${n+l} Z`;break;case"left":c=`M${o+r},${n} L${o+e},${n} A${e},${e} 0 0 0 ${o},${n+e} L${o},${n+l-e} A${e},${e} 0 0 0 ${o+e},${n+l} L${o+r},${n+l} Z`;break;case"bottom":c=`M${o},${n} L${o+r},${n} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o+e},${n+l} A${e},${e} 0 0 1 ${o},${n+l-e} Z`;break;default:c=`M${o},${n+l} L${o},${n+e} A${e},${e} 0 0 1 ${o+e},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l} Z`}return Ia(Ca.Fragment,{children:[s,$a("path",{d:c,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return Ia(Ca.Fragment,{children:[s,$a("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return $a("circle",{cx:t.x,cy:t.y,r:t.r,fill:Da(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return Ea(e,t,o);case"glyph":return Ba(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const n=e;if(n._gradientBand&&n._gradientBand.colors.length>0){const e=Fa(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:a}=Ta({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return Ia("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[$a("defs",{children:$a("clipPath",{id:e,children:$a("path",{d:r})})}),$a("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>$a("path",{d:e.d,fill:Da(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&$a("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=La({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=Ma().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(Na)||""}return $a("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:Da(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return Ia("g","vertical"===t.projection?{children:[$a("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:Da(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),$a("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[$a("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:Da(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),$a("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),$a("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[$a("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Da(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push($a("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),$a("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push($a("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),$a("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return $a("g",{children:o},i)}case"connector":return $a("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return $a("polygon",{points:o,fill:Da(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Ct)})).filter(Boolean)]})]}),zd(nd,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:o,showAxes:oe,showCategoryTicks:ne,oLabel:It,rLabel:Nt,oFormat:Dt,rFormat:Et,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:pe,showGrid:_e,title:He,legend:Pe,legendHoverBehavior:Re,legendClickBehavior:Le,legendHighlightedCategory:Te,legendIsolatedCategories:$e,legendPosition:Ie,legendLayout:Ne,foregroundGraphics:zo(n,Xo(oo.current?.customLayoutOverlays,lt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:ke??xe,chartId:we,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:Me,annotationFrame:0,xAccessor:Mo,yAccessor:_o,annotationData:Po(e?.getData())}),We&&"radial"===y&&zd("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:We})]})}return Od("div",{ref:yt,className:"stream-ordinal-frame"+(ze?" "+ze:""),role:"group","aria-label":nt||("string"==typeof He?He:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":bt[0],height:x?"100%":bt[1],overflow:"visible"},onKeyDown:bo,children:["production"!==process.env.NODE_ENV&&oo.current&&zd(Fo,{store:oo.current,diagnostics:Qt.current}),ot&&zd(Bs,{tableId:Ct}),ot&&zd(Ns,{scene:oo.current?.scene??[],chartType:o+" chart",tableId:Ct,chartTitle:"string"==typeof He?He:void 0}),zd(Es,{summary:rt}),zd(fs,{hoverPoint:Ft}),Od("div",{role:"img","aria-label":nt||("string"==typeof He?He:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?vo:void 0,onMouseLeave:Jt?po:void 0,onClick:dt?mo:void 0,children:[Od(Il,{size:bt,margin:vt,children:[Yt,jt]}),zd(td,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:zt,showAxes:oe,showGrid:_e,rFormat:Et,rTickValues:he,axisExtent:pe}),zd("canvas",{ref:co,"aria-label":vs(oo.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),zd(nd,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:zt,showAxes:oe,showCategoryTicks:ne,oLabel:It,rLabel:Nt,oFormat:Dt,rFormat:Et,rTickValues:he,axisExtent:pe,showGrid:_e,title:He,legend:Pe,legendHoverBehavior:Re,legendClickBehavior:Le,legendHighlightedCategory:Te,legendIsolatedCategories:$e,legendPosition:Ie,legendLayout:Ne,foregroundGraphics:zo(Wt,Xo(oo.current?.customLayoutOverlays,lt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:ke??xe,chartId:we,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:Me,annotationFrame:Gt,xAccessor:Mo,yAccessor:_o,annotationData:Po(oo.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(et||tt)&&"radial"!==y&&zd(dd,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:zt,onBrush:tt||(()=>{})}),We&&"radial"===y&&zd("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:We}),Xe?.showBadge&&zd(pr,{isStale:qt,position:Xe.badgePosition}),zd(zs,{active:go.current>=0,hoverPoint:Ft,margin:vt,size:bt,shape:yo.current?.shape,width:yo.current?.w,height:yo.current?.h}),wo]})]})}));jd.displayName="StreamOrdinalFrame";var Yd=jd;import{useRef as Gd,useState as Vd,useEffect as Xd,useMemo as qd,useCallback as Ud,useImperativeHandle as Kd,forwardRef as Zd,memo as Qd}from"react";var Jd={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},eh={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},th=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 o=this._freeIndices.pop();if(void 0===o)return null;const n=this.particles[o];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,o,n){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=o[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?oh(a.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(r))):(i.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function oh(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,r){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),l=a-s,[c,u,d,h]=e[s];nh(c,u,d,h,l,r);const f=h.x-c.x,p=h.y-c.y,m=Math.sqrt(f*f+p*p);if(m>.001){const e=f/m;r.x+=-p/m*o*n*2,r.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[r,i,a,s]=e.points;nh(r,i,a,s,t,n);const l=s.x-r.x,c=s.y-r.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function nh(e,t,o,n,r,i){const a=1-r,s=a*a,l=s*a,c=r*r,u=c*r;i.x=l*e.x+3*s*r*t.x+3*a*c*o.x+u*n.x,i.y=l*e.y+3*s*r*t.y+3*a*c*o.y+u*n.y}function rh(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function ih(e,t){var o,n=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,n,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===o?(u(o,r),d=!0):i[n]||(d=c(n));if(d)l(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 r.pop(),d}function u(e,o){var r=[].concat(o).concat(e);t?t(r):n.push(r)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function f(t){var l=[t],c=[t];for(o[t]=n[t]=u,r[t]=!0,u+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>i[t]){for(var p=i[t];f.length>p;++p){var m=f[p];if(0>o[m]){o[m]=n[m]=u,r[m]=!0,u+=1,l.push(m),c.push(m);break}r[m]&&(n[t]=0|Math.min(n[t],n[m])),0>a[m]||s[t].push(a[m])}i[t]=p}else{if(n[t]===o[t]){var g=[],y=[],b=0;for(p=l.length-1;p>=0;--p){var v=l[p];if(r[v]=!1,g.push(v),y.push(s[v]),b+=s[v].length,a[v]=d.length,v===t){l.length=p;break}}d.push(g);var x=Array(b);for(p=0;y.length>p;p++)for(var k=0;y[p].length>k;k++)x[--b]=y[p][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&f(l);for(l=0;h.length>l;l++){var p=h[l];if(0!==p.length){p.sort(function(e,t){return e-t}),c=[p[0]];for(var m=1;p.length>m;m++)p[m]!==p[m-1]&&c.push(p[m]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],o=a);var l=r[o];return!!l&&{leastVertex:i,adjList:e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})})}}o=0;for(var h=e.length;h>o;){var f=d(o);if(o=f.leastVertex,s=f.adjList){for(var p=0;s.length>p;p++)for(var m=0;s[p].length>m;m++){var g=s[p][m];i[+g]=!1,a[g]={}}c(o),o+=1}else o=h}return t?void 0:n}function ah(e){return e.y0-e.y1>0?"up":"down"}function sh(e,t){return t(e.source)==t(e.target)}function lh(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function ch(e){return e.target.x0-e.source.x1}function uh(e,t){var o=hh(e),n=ch(t)/Math.tan(o);return"up"==ah(e)?e.y1-n:e.y1+n}function dh(e,t){var o=hh(e),n=ch(t)/Math.tan(o);return"up"==ah(e)?e.y1+n:e.y1-n}function hh(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function fh(e,t){return t(e)}function ph(e){return gh(e.source)}function mh(e){return gh(e.target)}function gh(e){return(e.y0+e.y1)/2}function yh(e){return e.virtual?0:e.value}function bh(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!sh(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!sh(e,t)?n+1:n}),o+n}function vh(e){return e.target.depth}function xh(e,t){return e.sourceLinks.length?e.depth:t-1}function kh(e,t){return e.y0-t.y0}function wh(e,t){return t.y0-e.y0}function Sh(e,t){return e.y1-t.y1}function Ah(e,t){return t.y1-e.y1}function Ch(e,t){return _h(e.source,t.source)||e.index-t.index}function Mh(e,t){return _h(e.target,t.target)||e.index-t.index}function _h(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Ph(e,t){return Rh(e)==Rh(t)?"bottom"==e.circularLinkType?wh(e,t):kh(e,t):Rh(t)-Rh(e)}function Rh(e){return e.target.column-e.source.column}function Lh(e,t){return Th(e)==Th(t)}function Th(e){return e.y0-e.y1>0?"up":"down"}import{min as $h}from"d3-array";function Ih(e,t,o,n,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=$h(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Nh(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Nh(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),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,sh(e,t)&&lh(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+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?wh:kh);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ah:Sh),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,r=e.y1,i=(t+n)/2;return"M"+t+","+o+"C"+i+","+o+" "+i+","+r+" "+n+","+r}(e)}),i}function Nh(e,t,o){e.sort(Ph);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(sh(e,t)&&lh(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&&Dh(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Dh(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as Eh,max as Bh,sum as Fh,mean as Hh,group as zh,groups as Oh}from"d3-array";function Wh(e){return function(){return e}}function jh(e){return e.index}function Yh(e){return e.nodes}function Gh(e){return e.links}function Vh(e,t,o){var n=Oh(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(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var o,n,r,i=(n=0,r=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=gh(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=gh(e.target)*t,n+=t}}),n>0?r/n:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var o=s.get(e),n=s.get(t),r=o.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(r)||isNaN(i)?isNaN(r)?isNaN(i)?o.idx-n.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?bh(t,o)-bh(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==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==bh(t,o)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function Xh(e,t,o,n,r,i){var a=Oh(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,o),u();function c(t,o){var n=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&bh(r,o)>0){var l=Hh(r.sourceLinks,mh),c=Hh(r.targetLinks,ph),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-gh(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==n-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=Hh(r.sourceLinks,mh),f=Hh(r.targetLinks,ph),p=((h&&f?(h+f)/2:h||f)-gh(r))*t;r.y0+=p,r.y1+=p}})})}function u(){a.forEach(function(o){var i,a,s,l=e.y0,c=o.length;for(o.sort(t||_h),s=0;c>s;++s)(a=l-(i=o[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+n;if((a=l-n-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=o[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function qh(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Mh),e.targetLinks.sort(Ch)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,r=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=r-e.width/2,r-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Uh(){var e=0,t=0,o=1,n=1,r=24,i=8,a=null,s=jh,l=xh,c=void 0,u=32,d=2,h=Yh,f=Gh;function p(){var p={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return zh(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,r=e.target;"object"!=typeof n&&(n=e.source=rh(o,n)),"object"!=typeof r&&(r=e.target=rh(o,r)),n.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var o=0;if(null==t){for(var n=[],r=0;e.links.length>r;r++){var i=e.links[r],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 l=ih(n);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:n>o?"top":"bottom","top"==r.circularLinkType?o++:n++,e.nodes.forEach(function(e){fh(e,t)!=fh(r.source,t)&&fh(e,t)!=fh(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),sh(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(Fh(e.sourceLinks,yh),Fh(e.targetLinks,yh)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,r,i;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-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,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(n=e.nodes,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,i):e.column})}(h,c,l);var f=i;if(null!==a){var p=Oh(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),m=Bh(p,function(e){return e.length});m>1&&(f=Math.max(1,(n-t)*a/(m-1)))}(function(e,t,o){var n=Oh(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=Eh(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/Fh(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=Bh(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/i),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,f,r),Vh(h,c,s),Xh(h,c,s,f,f,u),qh(h),Ih(h,s,d,10,8),Vh(h,c,s),Xh(h,c,s,f,f,u),qh(h),Ih(h,s,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return fh(o.source,t)==fh(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Lh(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=uh(t,e);return e.y1-o}if(t.target.column>e.target.column)return uh(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,o){if("bottom"==t.circularLinkType){for(var i=o+1,a=0;r>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return fh(o.target,t)==fh(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Lh(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=dh(t,e);return e.y0-o}if(t.source.column>e.source.column)return dh(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,o){if("bottom"==t.circularLinkType){for(var i=o+1,a=0;r>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,o=e.links,n=!1,r=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==n||0==r){let n=function(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0};var i=Eh(t,function(e){return e.y0}),a=Bh(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)}),o.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,o=n(e.y0)-e.y0;e.y0=n(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),Ih(h,s,d,10,8)}(p),p}return p.update=function(e){return qh(e),Ih(e,s,d,10,8),e},p.nodeWidth=function(e){return arguments.length?(r=+e,p):r},p.nodePadding=function(e){return arguments.length?(i=+e,p):i},p.nodePaddingRatio=function(e){return arguments.length?(a=+e,p):a},p.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Wh(e),p):h},p.links=function(e){return arguments.length?(f="function"==typeof e?e:Wh(e),p):f},p.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Wh(e),p):s},p.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Wh(e),p):l},p.nodeSort=function(e){return arguments.length?(c=e,p):c},p.iterations=function(e){return arguments.length?(u=+e,p):u},p.circularLinkGap=function(e){return arguments.length?(d=+e,p):d},p.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],o=+r[1][0],n=+r[1][1],p):[[e,t],[o,n]]},p.size=function(r){return arguments.length?(e=t=0,o=+r[0],n=+r[1],p):[o-e,n-t]},p}import{interpolateNumber as Kh}from"d3-interpolate";import{line as Zh,curveLinearClosed as Qh}from"d3-shape";function Jh(e){const{sx:t,sTop:o,sBot:n,tx:r,tTop:i,tBot:a,cp1X:s,cp2X:l}=e,c=(o+n)/2,u=(i+a)/2;return{pathD:[`M${t},${o}`,`C${s},${o} ${l},${i} ${r},${i}`,`L${r},${a}`,`C${l},${a} ${s},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:u},{x:r,y:u}],halfWidth:(n-o)/2}}}var ef=e=>{let t,o,n,r,i,a,s,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=Kh(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${a}L${n},${a}C${n},${c} ${r},${l} ${r},${i}Z`;const u=e.sankeyWidth/2,d=Kh(e.source.x1,e.target.x0),{pathD:h}=Jh({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 tf(e){const t=e.sankeyWidth/2,o=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const o=n.sourceX,r=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-o))),l=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${o},${r-t}L${o+s},${r-t}L${o+s},${r+t}L${o},${r+t}ZM${i},${a-t}L${i-l},${a-t}L${i-l},${a+t}L${i},${a+t}Z`}const r=n.sourceX,i=n.sourceY,a=n.targetX,s=n.targetY,l=n.rightFullExtent,c=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(o,15));return`M${r},${i-d*t}L${l},${i-d*t}L${l+o},${i-d*t+d*h}L${l+o},${u+d*o-d*h}L${l+o-h},${u+d*o}L${c-o+h},${u+d*o}L${c-o},${u+d*o-d*h}L${c-o},${s-d*t+d*h}L${c-o+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${c+o},${s+d*t}L${c+o},${u-d*o}L${l-o},${u-d*o}L${l-o},${i+d*t}L${r},${i+d*t}Z`}var of=new Set,nf=new WeakMap;function rf(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=nf.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,nf.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;of.has(e)||(of.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}var af={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(vh))-1:0},justify:xh};function sf(e){return"string"==typeof e?e:e.id}var lf={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r="vertical"===o.orientation?"down":"right",i=o.nodeAlign||"justify",a=o.nodeWidth??15,s=o.nodePaddingRatio??.05,l=o.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===r?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const h=Uh().extent(d).links(u).nodes(c).nodeAlign(af[i]||xh).nodeId(e=>e.id).nodeWidth(a).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(s),h();{let e=1/0,t=-1/0,o=1/0,r=-1/0;for(const n of c)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>r&&(r=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),o>i.verticalFullExtent-a&&(o=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-o,s=n[0],l=n[1];if(i>0&&a>0&&(0>e||0>o||t>s||r>l)){const t=Math.min(s/i,l/a),n=-e*t+(s-i*t)/2,r=-o*t+(l-a*t)/2;for(const e of c)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of u)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+r,o.targetY=o.targetY*t+r,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+r,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+r,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+r,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of c){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 p=new Map;for(const e of t)p.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of u){const t=sf(e.source),o=sf(e.target),n=p.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);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=r;const i=f.get(t),a=f.get(o);i&&(n.source=i),a&&(n.target=a)}}},buildScene(e,t,o,n){const r="vertical"===o.orientation?"down":"right",i=o.nodeStyle,a=o.edgeStyle,s=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:de,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const d=[],h=[],f=[],p=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=i?i(rf(t,"nodeStyle")):{},a={fill:n.fill||u.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};p.set(t.id,("string"==typeof a.fill?a.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===r?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:a,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:a,datum:t,id:t.id,label:t.id})}const m=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of m){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 r=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";r="function"==typeof l?l(e)||r:"target"===l?p.get(n.id)||u.get(n.id)||r:p.get(t.id)||u.get(t.id)||r;const i=a?a(rf(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),a=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=i.fill||r;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:l,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-o}L${t.targetX-a},${t.targetY-o}L${t.targetX-a},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,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 c;(c=e.circular&&e.circularPathData?tf(e):ef(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||r,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==o.showLabels){const t=(g=o.nodeLabel)?"function"==typeof g?g:e=>e[g]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const a=t?t(o):o.id;if(!a)continue;let s,l,c;"down"===r?(s=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,c="end"):(s=o.x1+6,c="start"),l=o.y0+i/2),f.push({x:s,y:l,text:a+"",anchor:"down"===r?"middle":c,baseline:"middle",fontSize:11})}}var g;return{sceneNodes:d,sceneEdges:h,labels:f}}};import{forceSimulation as cf,forceCenter as uf,forceX as df,forceY as hf,forceLink as ff,forceManyBody as pf,forceCollide as mf}from"d3-force";import{scaleLinear as gf}from"d3-scale";var yf={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r=o.forceStrength??.1,i=n[0]/2,a=n[1]/2,s=o.__previousPositions;let l=0;const c=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=s?.get(t.id);e?l++:o?(t.x=o.x,t.y=o.y,l++):c.push(t)}const u=l>0&&.3>=(e.length>0?c.length/e.length:1);if(u){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of c){const n=bf(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=vf(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/n.length+a*Math.cos(i),e.y=o/n.length+a*Math.sin(i)}else{const t=vf(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=i+n*Math.cos(o),e.y=a+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),r=o*t;n.x=i+e*Math.cos(r),n.y=a+e*Math.sin(r)}}}const d=o.__skipForceSimulation||0===o.iterations?0:u?40:o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),h=xf(o.nodeSize,o.nodeSizeRange,e),f=e=>h(e);if(d>0){const n=new Map,s=new Map;for(const t of e)n.set(t.id,0),s.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id;n.set(t,(n.get(t)??0)+1),n.set(o,(n.get(o)??0)+1)}const l=ff().strength(e=>{const t=e.weight,o="string"==typeof e.target?e.target:e.target.id,i=Math.max(1,Math.min(n.get("string"==typeof e.source?e.source:e.source.id)??1,n.get(o)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*r/(.1*i))}).distance(e=>{const t="string"==typeof e.source?s.get(e.source):e.source,o="string"==typeof e.target?s.get(e.target):e.target,n=(t?f(t):0)+(o?f(o):0)+12;return Math.max(40,n)}).id(e=>e.id),c=cf();if(void 0===o.random&&void 0===o.seed||c.randomSource(o.random??wl(o.seed)),c.force("charge",pf().strength(e=>{const t=n.get(e.id)??0;return-15*f(e)*Math.sqrt(t+1)})).force("collide",mf(e=>f(e)+3).strength(.9).iterations(2)).force("center",uf(i,a).strength(.8)).force("x",df(i).strength(.06)).force("y",hf(a).strength(.06)),c.nodes(e),t.length>0){const e=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));l.links(e),c.force("link",l)}u?c.alpha(.3):.1>c.alpha()&&c.alpha(1),c.stop();for(let e=0;d>e;++e)c.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=f(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const 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,o,n){const r=o.nodeStyle,i=o.edgeStyle,a=xf(o.nodeSize,o.nodeSizeRange,e),s=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:de,l=new Map;e.forEach((e,t)=>{l.set(e.id,s[t%s.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=a(rf(t,"nodeSize")),n=r?r(rf(t,"nodeStyle")):{},i={fill:n.fill||l.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};c.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 r=i?i(rf(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:r.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6},datum:e})}if(!1!==o.showLabels){const t=(f=o.nodeLabel)?"function"==typeof f?f:e=>e[f]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=a(rf(o,"nodeSize"));d.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:c,sceneEdges:u,labels:d}}};function bf(e,t,o){const n=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=o.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function vf(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function xf(e,t,o){if(o.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 r=t||[5,20],i=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&i.push(o)}if(0===i.length)return()=>r[0];const[a,s]=n(i);if(a===s)return()=>(r[0]+r[1])/2;const l=gf().domain([a,s]).range(r).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?r[0]:l(o)}}import{chord as kf,ribbon as wf}from"d3-chord";import{arc as Sf}from"d3-shape";var Af=de,Cf={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=o,s=Math.min(n[0],n[1])/2,l=s-i,c=n[0]/2,u=n[1]/2,d=(h=o.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 p=e.length,m=Array.from({length:p},()=>Array.from({length:p},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=f.get("string"==typeof e.source?e.source:e.source.id),n=f.get(t);if(void 0===o||void 0===n)continue;const r=d(e);m[o][n]=r}const g=kf().padAngle(r);a&&g.sortGroups(a);const y=g(m),b=y.groups,v=Sf().innerRadius(l).outerRadius(s);for(const t of b){const o=e[t.index],n=v.centroid({innerRadius:l,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of y){const o=e[t.source.index].id,n=e[t.target.index].id,r=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);r&&(r.__chordData=t)}},buildScene(e,t,o,n){const{groupWidth:r=20,edgeOpacity:i=.5}=o,a=Math.min(n[0],n[1])/2,s=a-r,l=n[0]/2,c=n[1]/2,u=o.nodeStyle,d=o.edgeStyle,h=o.edgeColorBy||"source",f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Af,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const m=wf().radius(s),g=[],y=[],b=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=u?u(rf(o,"nodeStyle")).fill||p.get(o.id)||f[t%f.length]:p.get(o.id)||f[t%f.length];const i=u?u(rf(o,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:s,outerR:a,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:r,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=m(t);if(!n)continue;const r=Mf(n,l,c);let a=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)a=d(rf(e,"edgeStyle")).fill||a;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?a=p.get(o.id)||a:t&&(a=p.get(t.id)||a)}const s=d?d(rf(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:r,style:{fill:a,fillOpacity:s.fillOpacity??i,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null,n=a+12;for(const o of e){const e=o.__arcData;if(!e)continue;const r=t?t(o):o.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;b.push({x:l+Math.cos(a)*n,y:c+Math.sin(a)*n,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var v;return{sceneNodes:g,sceneEdges:y,labels:b}}};function Mf(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const r=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("C"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("Q"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("A"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&(r.push(Number(n[i])+t+""),i++),n.length>i&&(r.push(Number(n[i])+o+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(n[i]),i++)}return r.join(" ")}import{hierarchy as _f,tree as Pf,cluster as Rf,treemap as Lf,pack as Tf,partition as $f,treemapBinary as If}from"d3-hierarchy";var Nf=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Df(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>150?"#222":"#fff"}function Ef(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Bf(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 Ff(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Nf}function Hf(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 zf(e,t,o,n,r){if("horizontal"===r){const r=(e+o)/2;return`M ${e},${t} C ${r},${t} ${r},${n} ${o},${n}`}if("radial"===r){const r=(e+o)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+n)/2} T ${o},${n}`}{const r=(t+n)/2;return`M ${e},${t} C ${e},${r} ${o},${r} ${o},${n}`}}var Of={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;if(!r)return;const i=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),s=o.hierarchySum,l="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,c=_f(r,a);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=Pf();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"cluster":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=Rf();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"treemap":!function(e,t,o,n){const r=t.padding??4,i=t.paddingTop??0,a=Lf().size([o,n]).tile(If).padding(r);i>0&&a.paddingTop(i),a(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,n){const r=t.padding??4;Tf().size([o,n]).padding(r)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,n){$f().size([o,n]).padding(t.padding??1)(e)}(c,o,u,d)}const h=c.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const n=h[t],r={id:Ef(n,o,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?Wf(r,n,o):"treemap"===i||"partition"===i?jf(r,n):"circlepack"===i&&Yf(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const r=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,r,i){const a=[],s=[],l=[],c=o.treeOrientation||"vertical",u="radial"===c,d=n[0]/2,h=n[1]/2,f="number"==typeof(p=o.nodeSize)?p:5;var p;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=r(rf(t,"nodeStyle"));let s=i.fill||Hf(o);if(o.colorByDepth&&void 0!==t.depth){const e=Ff(o);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:n,r:f,style:{fill:s,stroke:i.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const m=o.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 r=t.x,a=t.y,l=n.x,f=n.y;u&&(r+=d,a+=h,l+=d,f+=h);const p=zf(r,a,l,f,c),g=i(rf(e,"edgeStyle"));s.push({type:"curved",pathD:p,style:{fill:"none",stroke:g.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??m},datum:e})}if(!1!==o.showLabels){const t=Bf(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,r,i,a=o.x,s=o.y;if(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,o=Math.sqrt(e*e+t*t);o>0?(n=a+e/o*10,r=s+t/o*10,i=0>e?"end":"start"):(n=a,r=s-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(n=a-f-6,i="end"):(n=a+f+6,i="start"),r=s):(n=a,r=s+f+14,i="middle");l.push({x:n,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:l}}(e,t,o,n,r,i);case"treemap":case"partition":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const a=n(rf(o,"nodeStyle"));let s=a.fill||Hf(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ff(t);s=e[o.depth%e.length]}r.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Bf(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,l=s.y1-s.y0;if(0>=e||0>=l)continue;const c=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===r&&!c)continue;if("parent"===r&&c)continue}const u=o?o(s):s.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=n(rf(s,"nodeStyle")).fill||Hf(t);if(t.colorByDepth&&void 0!==s.depth){const e=Ff(t);d=e[s.depth%e.length]}const h="string"==typeof d?Df(d):t.themeSemantic?.text??"#000";i.push(c?{x:s.x0+e/2,y:s.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/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:r,sceneEdges:[],labels:i}}(e,o,0,r);case"circlepack":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.__radius??5;if(0>=e)continue;const i=n(rf(o,"nodeStyle"));let a=i.fill||Hf(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ff(t);a=e[o.depth%e.length]}r.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:a,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Bf(t.nodeLabel);for(const r of e){const e=r.__radius??5,a=o?o(r):r.id;if(!a)continue;if(15>e)continue;const s=!(r.data?.children&&r.data.children.length>0);let l=n(rf(r,"nodeStyle")).fill||Hf(t);if(t.colorByDepth&&void 0!==r.depth){const e=Ff(t);l=e[r.depth%e.length]}if(s){const o="string"==typeof l?Df(l):t.themeSemantic?.text??"#000";i.push({x:r.x,y:r.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else i.push({x:r.x,y:r.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:r,sceneEdges:[],labels:i}}(e,o,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Wf(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function jf(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 Yf(e,t){const o=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}import{pie as Gf}from"d3-shape";function Vf(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Xf={sankey:lf,force:yf,chord:Cf,tree:Of,cluster:Of,treemap:Of,circlepack:Of,partition:Of,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;r&&function(e,t,o,n,r){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),s=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),l=o.orbitSize??2.95,c=o.orbitEccentricity??1,u="number"==typeof l?()=>l:l,d="number"==typeof c?()=>c:c,h=Vf(o);h.metaMap.clear(),n.length=0,r.length=0;const f=new Map;function p(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const m=t[0]/2,g=t[1]/2,y=Math.min(t[0],t[1])/2*.85,b=p(a(e));n.push({id:b,x:m,y:g,x0:m,x1:m,y0:g,y1:g,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(b,{ring:y,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,l,c,f,m,g){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,k=0;for(;b>x;)x+=s[Math.min(k,s.length-1)],k++,v++;let w=0;for(let b=0;v>b;b++){const x=s[Math.min(b,s.length-1)],k=y.slice(w,w+x);if(!k.length)break;const S=(b+1)/v,A={id:o,depth:m,data:t,parentId:o},C=g?f/u(A)*S:f*S,M=Gf().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),_=d(A);for(let t=0;k.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,s=k[t],u=p(a(s)),d=l+C*Math.sin(i),f=c+C*Math.cos(i)*_;n.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:m,data:s}),h.metaMap.set(u,{ring:C,angle:i,depth:m,parentId:o,eccentricity:_}),r.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(s,u,d,f,C,m+1,!0)}w+=x}}(e,b,m,g,y,1,!1)}(r,n,o,e,t)},buildScene(e,t,o,n){const r=o.nodeStyle,i=o.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=Vf(o),n=new Map;for(const t of e)n.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;r.has(o)||r.set(o,{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:o,ecc:n}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,c=(r+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(s),y1:t+o*Math.cos(s)*n,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=a(rf(t,"nodeSize")),n=r?r(rf(t,"nodeStyle")):{};s.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||o.themeSemantic?.primary||"#6366f1",stroke:n.stroke||o.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),o="object"==typeof e.target?e.target:u.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=a(rf(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t?o.data?.[t]??o.id:o.id;c.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:l,labels:c}},tick:(e,t,o,n,r)=>!1!==o.orbitAnimated&&(function(e,t){const o=Vf(t),n=t.orbitSpeed??.25,r=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())-o.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=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=s.get(e.parentId);if(!n)continue;const l=e.angle+i*a*r({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(l),t.y=n.y+e.ring*Math.cos(l)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)}};function qf(e){return Xf[e]}import{quadtree as Uf}from"d3-quadtree";function Kf(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 Zf(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(!Qf(e))return!1;return!0}return Qf(t.points)}function Qf(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 Jf}from"d3-interpolate";var ep="rgba(34, 197, 94, 0.7)",tp=2e3,op=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],np=["scene-style","data-paint","accessibility","evidence"],rp=(e,t)=>({retainedData:e,invalidations:t}),ip=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ap=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],sp=["scene-geometry","data-paint","overlay","accessibility","evidence"],lp=["scene-style","data-paint","accessibility","evidence"],cp=["scene-geometry","data-paint","overlay","accessibility","evidence"],up=[],dp={chartType:rp("rebuild",ip),nodeIDAccessor:rp("rebuild",ip),sourceAccessor:rp("rebuild",ip),targetAccessor:rp("rebuild",ip),valueAccessor:rp("rebuild",ip),edgeIdAccessor:rp("rebuild",ip),childrenAccessor:rp("rebuild",ip),hierarchySum:rp("rebuild",ip),orientation:rp("preserve",ap),nodeAlign:rp("preserve",ap),nodePaddingRatio:rp("preserve",ap),nodeWidth:rp("preserve",ap),edgeSort:rp("preserve",ap),iterations:rp("preserve",ap),forceStrength:rp("preserve",ap),padAngle:rp("preserve",ap),groupWidth:rp("preserve",ap),sortGroups:rp("preserve",ap),treeOrientation:rp("preserve",ap),edgeType:rp("preserve",ap),padding:rp("preserve",ap),paddingTop:rp("preserve",ap),orbitMode:rp("preserve",ap),orbitSize:rp("preserve",ap),orbitSpeed:rp("preserve",ap),orbitRevolution:rp("preserve",ap),orbitRevolutionStyle:rp("preserve",ap),orbitEccentricity:rp("preserve",ap),orbitShowRings:rp("preserve",ap),orbitAnimated:rp("preserve",ap),customNetworkLayout:rp("preserve",ap),layoutConfig:rp("preserve",ap),nodeSize:rp("preserve",sp),nodeSizeRange:rp("preserve",sp),colorByDepth:rp("preserve",sp),nodeLabel:rp("preserve",cp),showLabels:rp("preserve",cp),labelMode:rp("preserve",cp),nodeStyle:rp("preserve",lp),edgeStyle:rp("preserve",lp),colorBy:rp("preserve",lp),colorScheme:rp("preserve",lp),themeCategorical:rp("preserve",lp),themeSemantic:rp("preserve",lp),edgeColorBy:rp("preserve",lp),edgeOpacity:rp("preserve",lp),showParticles:rp("preserve",lp),particleStyle:rp("preserve",lp),decay:rp("preserve",lp),pulse:rp("preserve",lp),thresholds:rp("preserve",lp),staleness:rp("preserve",lp),layoutSelection:rp("preserve",lp),clock:rp("preserve",up),random:rp("preserve",up),seed:rp("preserve",up),tensionConfig:rp("preserve",up),transition:rp("preserve",up),introAnimation:rp("preserve",up),onLayoutError:rp("preserve",up),__skipForceSimulation:rp("preserve",up),__hierarchyRoot:rp("preserve",up),__orbitState:rp("preserve",up),__previousPositions:rp("preserve",up)},hp=rp("preserve",ap),fp=class{constructor(){this.tracker=new co}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}},op)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},np):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=dp[n]??hp;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},pp=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 fp,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={...Jd,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new th(2e3))}currentTime(){return this.config.clock?.()??Ge()}updateConfig(e){const t=this.config,o={...t,...e};t.__orbitState&&(o.__orbitState=t.__orbitState),t.__hierarchyRoot&&(o.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(o.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(o)])].filter(e=>t[e]!==o[e]);this.config=o,this.tensionConfig={...Jd,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new th(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,o,n){const{nodeIDAccessor:r="id",sourceAccessor:i="source",targetAccessor:a="target",valueAccessor:s="value"}=this.config,l="function"==typeof r?r:e=>e[r],c="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=l(t)+"";this.nodes.set(e,{...Kf(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",r=u(o)+"",i=d(o),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(n)||this.nodes.set(n,{...Kf(n),data:o}),this.nodes.has(r)||this.nodes.set(r,{...Kf(r),data:o});const l=`${n}\0${r}\0${e}`,h={source:n,target:r,value:s,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&Zf(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}n?.deferLayout||this.runLayout(o),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,o,n){return this.ingestBounded(e,t,o,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,o]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=o.x,e.y=o.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:o,value:n}=e,r=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,Kf(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,Kf(o)),this.nodeTimestamps.set(o,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,o),l=this.edges.get(s);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0);const u=r||i||c||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=qf(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===o.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of o)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,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(o,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of o)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,o=Array.from(this.nodes.values())}this.finalizeLayout();const r=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||r.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=r,this.saveTargetPositions();const i=o.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&&o.length>0&&a>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime: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:o,restyleEdge:n,baseStyles:r,selection:i}){const a=!(!o&&!n);if(o)for(const t of e){const e=r.get(t)??t.style,n=o(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=r.get(e)??e.style,o=n(e,i);e.style=o?{...t,...o}: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:o,nodes:n,edges:r,previousResult:i,revision:a}){const s=Mu(e.colorScheme,e.themeCategorical,de),l={nodes:n,edges:r,dimensions:{width:o[0],height:o[1],plot:{x:0,y:0,width:o[0],height:o[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...s]},resolveColor:_u(s,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==i,n=Ht("network",t,o,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:o}}}({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 o=t.result;return this.sceneNodes=o.sceneNodes??[],this.sceneEdges=o.sceneEdges??[],this.labels=o.labels??[],this.customLayoutOverlays=o.overlays??null,this.customLayoutHtmlMarks=o.htmlMarks??[],this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=o.restyle,this._customRestyleEdge=o.restyleEdge,this.hasCustomRestyle=!(!o.restyle&&!o.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const o=new WeakMap;for(const t of e)o.set(t,t.style);for(const e of t)o.set(e,e.style);return o}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void Et({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=qf(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(o,n,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let r=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[r++]=e);this._nodeQuadtree=Uf().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=qf(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=qf(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,r,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=je(e,this.transition),o=We(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ye(e._prevX0,e._targetX0,o),e.x1=Ye(e._prevX1,e._targetX1,o),e.y0=Ye(e._prevY0,e._targetY0,o),e.y1=Ye(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Ye(e._prevY0,e._targetY0,o),e.y1=Ye(e._prevY1,e._targetY1,o),e.sankeyWidth=Ye(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const n="string"==typeof e.source?t.get(e.source):e.source,r="string"==typeof e.target?t.get(e.target):e.target;!n||!r||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const r=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],i=o.x-t.x,a=o.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},o])}return{circular:!0,segments:r,halfWidth:t}}(e):function(e,t,o,n=.5){const r=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,a=o.x0,s=Jf(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:r}}const i=t.x1,a=o.x0,s=Jf(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:r}}(e,n,r,o))}(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 o=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",r=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 l=i-s;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=r)}for(const t of e.sceneEdges){const r=t.datum;if(!r)continue;const a="object"==typeof r.source?r.source?.id:r.source,s="object"==typeof r.target?r.target?.id:r.target;if(!a||!s)continue;const l=e.edgeTimestamps.get(`${a}\0${s}`);if(!l)continue;const c=i-l;o>c&&(t._pulseIntensity=1-c/o,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 o=e.nodeTimestamps.size;if(1>=o)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 o=0;e.cache.sortedNodes.length>o;o++)t.set(e.cache.sortedNodes[o][0],o);e.cache.ageMap=t}const n=e.cache.ageMap;for(const r of e.sceneNodes){const e=r.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const a=Je(t,i,o);r.style={...r.style,opacity:(r.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===ep&&(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>=tp)return;const o=1-t/tp;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=ep,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&tp>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",r=!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 l=t.metric(s);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=n,c&&(i.style={...i.style,fill:c},r&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=c,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 o of e){const e=t.metric(o);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 o=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>o-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 o=this.nodes.get(e);if(!o)return this.updateResults.recordNoop("update"),null;const n=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,o){const n=this.config.valueAccessor,r="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=o(n.data??{});const e=r(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,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>e?.[t];for(const[t,r]of this.edges)r.data&&n(r.data)===e&&o.push(t)}else for(const[n,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o.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")}};pp.QUADTREE_THRESHOLD=500;var mp=pp;io(mp);import*as gp from"react";import{Fragment as yp,jsx as bp,jsxs as vp}from"react/jsx-runtime";function xp(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,labels:a,title:s,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:p,foregroundGraphics:m,sceneNodes:g,annotations:y,onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k,autoPlaceAnnotations:w,svgAnnotationRules:S}=e,A=wi({onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k}),C=gp.useMemo(()=>{const e=(g||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,o=e.cy??e.y;if("number"!=typeof t||"number"!=typeof o)return null;const n=dn(e.glyph,e.size);return{x:t+n.centerDx,y:o+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),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,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,It(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=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:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:g}},[o,g,t]),M=gp.useMemo(()=>y&&w?ea({annotations:y,context:C,..."object"==typeof w?w:{}}):y,[y,w,C]),_=gp.useMemo(()=>Di(),[]),P=M?Ni(M.filter(e=>"widget"!==e.type),_,S,C):null,R=!0===M?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return vp(yp,{children:[R&&bp("style",{children:pi},"annotation-widget-disclosure-style"),vp("svg",{role:"img",width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[bp("title",{children:"string"==typeof s?s:"Network Chart"}),bp("desc",{children:"string"==typeof s?s+" — network data visualization":"Network data visualization"}),vp("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>bp("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,m]}),s&&"string"==typeof s?bp("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:s}):s?bp("foreignObject",{x:0,y:0,width:n,height:i.top,children:s}):null,Lr({legend:l,totalWidth:n,totalHeight:r,margin:i,legendPosition:f,title:s,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),M?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const o=!0===e._annotationDeferred,n=g.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 r=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,l=e.dy??-16,c=e.width??32,u=e.height??32,d=e.content??bp("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return bp("div",{...Ai(e,A),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:r+s-c/2,top:a+l-u/2,width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}xp.displayName="NetworkSVGOverlay";import*as kp from"react";import{jsx as wp}from"react/jsx-runtime";var Sp={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ap({marks:e,margin:t,selection:o=null,overscan:n=400}){const r=kp.useRef(null),i=function(e,t,o){const[n,r]=kp.useState(null);return kp.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void r(null);let n=0;const i=()=>{n=0;const t=o.getBoundingClientRect(),i=e.getBoundingClientRect();r(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(),o.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",a),s.disconnect()}},[t,e,o]),kp.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:r,originY:i}=n,a=t.left-o,s=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=r+e.x,o=i+e.y;return!(a>t+e.width||t>s||l>o+e.height||o>c)})},[e,n,o])}(e,r,n);if(!e||0===e.length)return null;const a=wp("div",{className:"semiotic-network-html-marks",ref:r,style:{...Sp,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>wp("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!=o?wp(Go,{value:o,children:a}):a}import{jsx as Cp,jsxs as Mp}from"react/jsx-runtime";function _p({props:e,store:t,responsiveRef:o,size:n,margin:r,adjustedWidth:i,adjustedHeight:a,resolvedBackground:s,resolvedForeground:l}){const{chartType:c,nodes:u,edges:d,data:h,className:f,description:p,title:m,responsiveWidth:g,responsiveHeight:y,summary:b,background:v,renderMode:x,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,layoutSelection:P,annotations:R,onAnnotationActivate:L,annotationObservationCallback:$,onObservation:I,chartId:N,autoPlaceAnnotations:D,svgAnnotationRules:E}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?h||(Array.isArray(d)?void 0:d):void 0;if(e&&o)t.ingestHierarchy(o,[i,a]),t.buildScene([i,a]);else{const e=T(u),o=Array.isArray(d)?T(d):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[i,a]),t.buildScene([i,a]))}}const B=t?.sceneNodes??[],F=t?.sceneEdges??[],H=t?.labels??[];return Mp("div",{ref:o,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:g?"100%":n[0],height:y?"100%":n[1]},children:[Cp(Es,{summary:b}),Mp("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[s&&Cp("g",{transform:`translate(${r.left},${r.top})`,children:s}),Mp("g",{transform:`translate(${r.left},${r.top})`,children:[v&&Cp("rect",{x:0,y:0,width:i,height:a,fill:v}),F.map((e,t)=>Ac({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"line":return $a("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const o=e;return $a("path",{d:o.pathD,fill:Da(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"ribbon":{const o=e;return $a("path",{d:o.pathD,fill:Da(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"curved":{const o=e;return $a("path",{d:o.pathD,fill:Da(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+t)}default:return null}}(e,t)})).filter(Boolean),B.map((e,t)=>Ac({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"circle":{const o=e,n=Mn(o.style.fill)?Ln(o.style.fill,`net-circle-${t}-hatch`):void 0;return Ia(Ca.Fragment,{children:[n&&$a("defs",{children:n}),$a("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:n?`url(#net-circle-${t}-hatch)`:Da(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-circle-"+t)}case"rect":{const o=e,n=Mn(o.style.fill)?Ln(o.style.fill,`net-rect-${t}-hatch`):void 0;return Ia(Ca.Fragment,{children:[n&&$a("defs",{children:n}),$a("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:n?`url(#net-rect-${t}-hatch)`:Da(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-rect-"+t)}case"arc":{const o=e,n=Ma().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Na)||"",r=Mn(o.style.fill)?Ln(o.style.fill,`net-arc-${t}-hatch`):void 0;return Ia(Ca.Fragment,{children:[r&&$a("defs",{children:r}),$a("path",{d:n,transform:`translate(${o.cx},${o.cy})`,fill:r?`url(#net-arc-${t}-hatch)`:Da(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-arc-"+t)}case"symbol":{const o=e,n=$t(o.symbolType,o.size,o.path);return $a("path",{d:n,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?Da(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return Ba(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)})).filter(Boolean),H.map((e,t)=>function(e,t){return $a("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),Cp(xp,{width:i,height:a,totalWidth:n[0],totalHeight:n[1],margin:r,labels:H,sceneNodes:B,title:m,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,foregroundGraphics:zo(l,Xo(t?.customLayoutOverlays,P??null)),annotations:R,onAnnotationActivate:L,onObservation:$??I,chartId:N,chartType:"StreamNetworkFrame",autoPlaceAnnotations:D,svgAnnotationRules:E,annotationFrame:0}),Cp(Ap,{marks:t?.customLayoutHtmlMarks,margin:r,selection:P??null})]})}import*as Pp from"react";import{jsx as Rp,jsxs as Lp}from"react/jsx-runtime";function Tp({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return Rp("div",{role:"alert",style:{width:n,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Lp("div",{style:{textAlign:"center",maxWidth:400},children:[Rp("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Rp("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&Rp("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}import{jsx as $p}from"react/jsx-runtime";var Ip=class extends Pp.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:$p(Tp,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Np}from"react/jsx-runtime";var Dp="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Ep({componentName:e,width:t,height:o,children:n}){return Np(Ip,{fallback:n=>Np(Tp,{componentName:e,message:n.message,width:t,height:o}),children:n})}var Bp={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Fp={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Hp(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?Np("div",{style:{...Bp,width:t,height:o},children:n||"No data available"}):null}function zp(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return Np("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return Np("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>Np("div",{className:"semiotic-loading-bar",style:{...Fp,position:"absolute",top:s+o*(i+a),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function Op(e,t,o,n){if(!Dp)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const r=t[0];if(!r||"object"!=typeof r)return;if(n in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${i}`)}function Wp(e,t,o,n,r=4e4){return"sync"!==e&&("worker"===e||n*(t+o)>=r)}function jp(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function Yp(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var Gp=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):function(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),o=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+o)}throw Error("Cannot resolve module worker asset: "+e)}("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.worker=e,this.worker.onmessage=e=>{const t=e.data,o=t.requestId,n=null!=o?this.pending.get(o):this.pending.values().next().value;if(n){if(null!=o?this.pending.delete(o):this.pending.clear(),n.cleanup(),t.error){const e=Error(t.error.message);return e.name=t.error.name??"Error",t.error.stack&&(e.stack=t.error.stack),void n.reject(e)}n.resolve({positions:t.positions??{}})}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||"Force layout worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error("Force layout worker session is closed"));if(t?.aborted)return Promise.reject(Yp());const o=this.nextRequestId;this.nextRequestId+=1;const n={requestId:o,request:e};return new Promise((e,r)=>{const i=()=>{this.pending.delete(o),t?.removeEventListener("abort",i),r(Yp())},a=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:a,reject:r,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(o),a(),r(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error("Force layout worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}},Vp=null;function Xp(e,t){return jp()?t?.aborted?Promise.reject(Yp()):(Vp&&!Vp.isDead||(Vp=new Gp),Vp).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as qp,jsxs as Up}from"react/jsx-runtime";var Kp=/^(value|amount|total|count|weight|score)$/i;function Zp({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Up("div",{className:"semiotic-tooltip",style:Js,children:[Up("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&&Up("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 o=t.__hierarchyNode;if(o){const e=[];let n=o;for(;n;){const o=n.data?.name??n.data?.id??t.id;null!=o&&e.unshift(o+""),n=n.parent}e.length>1&&e.shift();const r=e.length-1;return Up("div",{className:"semiotic-tooltip",style:Js,children:[qp("div",{children:e.map((e,t)=>Up("span",{children:[t>0&&qp("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===r?qp("strong",{children:e}):qp("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&qp("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),r=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=Ks(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>Kp.test(e.key));return Up("div",{className:"semiotic-tooltip",style:Js,children:[qp("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>Up("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Pc(e.value)]},e.key)),!s&&null!=t.value&&t.value>0&&Up("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Up("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,r!==n&&` (weighted: ${r.toLocaleString()})`]})]})}function Qp(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Jp(e,t){if(!t.pathD)return;e.save();const o=Qp(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,0,n.x1,0),r=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",a=xn(e,i)||i;o.addColorStop(0,1===n.from?a:"transparent"),o.addColorStop(1,1===n.to?a:"transparent"),e.fillStyle=o,e.globalAlpha=r}else e.fillStyle=Wn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(o)),e.restore()}function em(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=xn(e,o)||o,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 tm(e,t){if(!t.pathD)return;e.save();const o=Qp(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Wn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(o)),e.restore()}function om(e,t){if(!t.pathD)return;e.save();const o=Qp(t),n=t.style.stroke||"#999";e.strokeStyle=xn(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Wn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}Zp.ownsChrome=!0;var nm=new Map;function rm(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=nm.get(t);return o||(o=new Path2D($t(e.symbolType,e.size)),nm.size>256&&nm.clear(),nm.set(t,o)),o}catch{return null}}function im(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:r}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(r)?r:Ne,a=Array.from(o);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}function am(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,a=Math.sqrt(r*r+i*i);return a>Jo(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,o,n);case"rect":return function(e,t,o){const n=Qo(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=on(Math.atan2(r,n)),s=on(e.startAngle),l=on(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,a=Math.sqrt(r*r+i*i);return a>Jo(It(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const r=dn(e.glyph,e.size),i=e.cx+r.centerDx,a=e.cy+r.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>Jo(r.radius,n)?null:{type:"node",datum:e.datum,x:i,y:a,distance:c}}(e,t,o,n);default:return null}}var sm=null,lm=null;function cm(){return lm||((sm=document.createElement("canvas")).width=1,sm.height=1,lm=sm.getContext("2d")),lm}function um(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 dm(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=um(e),r=cm();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(n,t,o);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,r=e.y2-e.y1,i=n*n+r*r;if(0===i)return null;let a=((t-e.x1)*n+(o-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,l=e.y1+a*r,c=Math.sqrt((t-s)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=um(e),r=cm();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(n,t,o);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function hm(e){const{clientX:t,clientY:o,canvasRect:n,margin:r,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-n.left-r.left,f=o-n.top-r.top;if(0>h||h>i||0>f||f>a)return{kind:"miss-outside"};const p=function(e,t,o,n,r=30,i,a=0){let s=null,l=r,c=1/0;if(i){const e=fn(i,o,n,r,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},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=am(t,o,n,r);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(s=e,c=o)}else l>e.distance&&(s=e,l=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=dm(e,o,n);t&&l>t.distance&&(s=t,l=t.distance)}return s}(s,l,h,f,d,c,u);return p?{kind:"hit",hover:Ys(p.datum||{},p.x,p.y,{nodeOrEdge:p.type})}:{kind:"miss"}}import{useCallback as fm}from"react";var pm="StreamNetworkFrame";import{jsx as mm,jsxs as gm}from"react/jsx-runtime";var ym={top:20,right:80,bottom:20,left:80},bm={top:40,right:40,bottom:40,left:40},vm=new Set(["chord","force","circlepack","orbit"]),xm=[800,600],km=Qd(Zd(function(e,t){const{chartType:o,nodes:n,edges:r,data:i,initialEdges:a,nodeIDAccessor:s="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p="horizontal",nodeAlign:m="justify",nodePaddingRatio:g=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:_="vertical",edgeType:P="curve",padding:R,paddingTop:L,tensionConfig:$,showParticles:I=!1,particleStyle:N,renderMode:D,nodeStyle:E,edgeStyle:B,colorBy:F,colorScheme:H="category10",edgeColorBy:z="source",edgeOpacity:O=.5,colorByDepth:j=!1,nodeSize:Y=8,nodeSizeRange:G=[5,20],nodeLabel:V,showLabels:X=!0,labelMode:q,size:U=xm,responsiveWidth:K,responsiveHeight:Z,margin:Q,className:J,background:ee,enableHover:te=!0,tooltipContent:oe,customHoverBehavior:ne,customClickBehavior:re,onObservation:ie,annotationObservationCallback:ae,chartId:se,onTopologyChange:le,annotations:ce,onAnnotationActivate:ue,autoPlaceAnnotations:de,svgAnnotationRules:he,legend:fe,legendPosition:pe,legendLayout:me,legendHoverBehavior:ge,legendClickBehavior:ye,legendHighlightedCategory:be,legendIsolatedCategories:ve,title:xe,foregroundGraphics:ke,backgroundGraphics:we,decay:Se,pulse:Ae,transition:Ce,animate:Me,staleness:_e,frameScheduler:Pe,clock:Re,random:Le,seed:Te,paused:$e=!1,suspendWhenHidden:Ie=!0,thresholds:De,accessibleTable:Ee=!0,description:Be,summary:Fe,orbitMode:He,orbitSize:ze,orbitSpeed:Oe,orbitRevolution:We,orbitRevolutionStyle:je,orbitEccentricity:Ye,orbitShowRings:Ge,orbitAnimated:Ve,customNetworkLayout:Xe,onLayoutError:qe,layoutConfig:Ue,layoutSelection:Ke}=e,Ze=vm.has(o)?bm:ym,Qe=Gd(!0),Je=Pl({sizeProp:U,responsiveWidth:K,responsiveHeight:Z,userMargin:Q,marginDefault:Ze,title:xe,legend:fe,legendPosition:pe,foregroundGraphics:ke,backgroundGraphics:we,animate:Me,transitionProp:Ce,frameScheduler:Pe,clock:Re,random:Le,seed:Te,paused:$e,suspendWhenHidden:Ie,themeDirtyRef:Qe}),{reducedMotionRef:et,responsiveRef:tt,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,resolvedForeground:at,resolvedBackground:st,transition:lt,introEnabled:ct,tableId:ut,rafRef:dt,renderFnRef:ht,scheduleRender:ft,frameRuntime:pt,currentTheme:mt}=Je,gt=Va(),yt=Ka(),bt=qd(()=>T(n),[n]),vt=qd(()=>Array.isArray(r)?T(r):r,[r]),xt=qd(()=>({...Jd,...$}),[$]),kt=qd(()=>({...eh,...N}),[N]),wt=qd(()=>{return{chartType:(e={chartType:o,clock:pt.now,random:Le,seed:Te,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:P,padding:R,paddingTop:L,tensionConfig:xt,showParticles:I,particleStyle:kt,nodeStyle:E,edgeStyle:B,nodeLabel:V,showLabels:X,labelMode:q,colorBy:F,colorScheme:H,edgeColorBy:z,edgeOpacity:O,colorByDepth:j,nodeSize:Y,nodeSizeRange:G,decay:Se,pulse:Ae,transition:lt,introAnimation:ct,staleness:_e,thresholds:De,orbitMode:He,orbitSize:ze,orbitSpeed:Oe,orbitRevolution:We,orbitRevolutionStyle:je,orbitEccentricity:Ye,orbitShowRings:Ge,orbitAnimated:Ve,customNetworkLayout:Xe,onLayoutError:qe,layoutConfig:Ue,currentTheme:mt}).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:W(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},[o,pt.now,Le,Te,s,l,c,u,d,h,f,p,m,g,y,b,v,S,A,C,M,_,P,R,L,xt,I,kt,E,B,V,X,q,F,H,z,O,j,Y,G,Se,Ae,lt,ct,_e,De,He,ze,Oe,We,je,Ye,Ge,Ve,Xe,qe,Ue,mt]),St=Qa(wt),At=Qa({chartType:(Ct={chartType:o,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:P,padding:R,paddingTop:L,random:Le,seed:Te,tensionConfig:xt,customNetworkLayout:Xe,orbitMode:He,orbitSize:ze,orbitEccentricity:Ye}).chartType,nodeIDAccessor:Ct.nodeIDAccessor,sourceAccessor:Ct.sourceAccessor,targetAccessor:Ct.targetAccessor,valueAccessor:Ct.valueAccessor,edgeIdAccessor:Ct.edgeIdAccessor,childrenAccessor:Ct.childrenAccessor,hierarchySum:Ct.hierarchySum,orientation:Ct.orientation,nodeAlign:Ct.nodeAlign,nodePaddingRatio:Ct.nodePaddingRatio,nodeWidth:Ct.nodeWidth,iterations:Ct.iterations,forceStrength:Ct.forceStrength,padAngle:Ct.padAngle,groupWidth:Ct.groupWidth,sortGroups:Ct.sortGroups,edgeSort:Ct.edgeSort,treeOrientation:Ct.treeOrientation,edgeType:Ct.edgeType,padding:Ct.padding,paddingTop:Ct.paddingTop,random:Ct.random,seed:Ct.seed,tensionConfig:Ct.tensionConfig,customNetworkLayout:Ct.customNetworkLayout,orbitMode:Ct.orbitMode,orbitSize:Ct.orbitSize,orbitEccentricity:Ct.orbitEccentricity});var Ct;const Mt=Gd(0),_t=Gd(0),Pt=Gd(!1),Rt=Gd(null);Rt.current||(Rt.current=new mp(St));const Lt=Bo("StreamNetworkFrame"),Tt=Ud((e,t,o=!1)=>function(e,t,o,n=!1,r=!1){const i=e.beforeCompute(t.getLastUpdateResult(),n);o(),e.afterCompute(i,!0,r)}(Lt.current,e,()=>e.buildScene(t),o),[Lt]),[$t,It]=Vd(null),[Nt,Dt]=Vd(0),[Et,Bt]=Vd(0),[Ft,Ht]=Vd(!1),[zt,Ot]=Vd(!1),Wt=Gd(0),jt=Gd(null),Yt=Gd(!1),Gt=Gd(w);Gt.current=w;const Vt=Gd(St);Vt.current=St;const Xt=Gd(null),qt=Gd(new Map),Ut=Gd(0),Kt=Ud(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:r,colorIndexRef:i}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!r.has(e+"")){const t=Array.isArray(n)?n:Ne;r.set(e+"",t[i.current++%t.length])}return r.get(e+"")}}if(r.has(t.id))return r.get(t.id);const a=Array.isArray(n)?n:Ne,s=o?a[i.current++%a.length]:a[0];return r.set(t.id,s),s}({node:e,colorBy:F,colorScheme:H,nodeColorMap:qt.current,colorIndexRef:Ut}),[F,H]),Zt=(Qt=mt,Qt?.colors?.border||Qt?.colors?.secondary||Qt?.colors?.primary||"#999");var Qt;const Jt=Ud(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Rt.current?.nodes),[]),eo=Ud(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:r,fallback:i}=e;if("function"==typeof o)return o(t);const a=r(t.source),s=r(t.target);return"target"===o&&s?n(s):a?n(a):i}({edge:e,edgeColorBy:z,getNodeColor:Kt,resolveEndpoint:Jt,fallback:Zt}),[z,Kt,Zt,Jt]),to=Ud(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:r,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:l}=e;if("function"==typeof o){const e=s(t.source);return e?o(t,e):l}if(!r)return i(t);const c=n,u=s(t.source),d=s(t.target);return"target"===c&&d?a(d):u?a(u):l}({edge:e,particleStyleColor:kt.color,particleColorBy:kt.colorBy,hasExplicitParticleColorBy:!!N?.colorBy,getEdgeColor:eo,getNodeColor:Kt,resolveEndpoint:Jt,fallback:Zt}),[N?.colorBy,kt.color,kt.colorBy,Kt,eo,Zt,Jt]),oo=function(e,t,o,n,r){return("sankey"===e||t)&&o||n||r}(o,!!Xe,I,!!Ae,Rt.current?.isAnimating??!1);Ko(Rt,St,Qe,ft),Zo(Rt,Ke,Qe,ft),Xd(()=>{const e=Rt.current;e&&(Tt(e,[rt,it]),Ut.current=im({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:qt.current,colorScheme:H}),Qe.current=!0,ft())},[mt,rt,it,Tt,ft,H]);const no=Ud(()=>{const e=Rt.current;if(e&&(e.runLayout([rt,it]),Tt(e,[rt,it]),Qe.current=!0,Ut.current=im({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:qt.current,colorScheme:H}),Dt(e.layoutVersion),le)){const{nodes:t,edges:o}=e.getLayoutData();le(t,o)}},[rt,it,Tt,le,H]),ro=Ud(e=>{if(null==e||"object"!=typeof e)return;const t=Rt.current;t&&(t.ingestEdge(e)&&no(),ft())},[no,ft]),io=Ud(e=>{const t=Rt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&no(),ft()},[no,ft]),ao=Ud(()=>{Rt.current?.clear(),qt.current.clear(),Ut.current=0,Dt(Rt.current?.layoutVersion??0),It(null),Xt.current=null,Qe.current=!0,ft()},[ft]),so=Ud(()=>{const e=Rt.current;e&&(e.tension+=999,no(),ft())},[no,ft]);Kd(t,()=>({push:ro,pushMany:io,removeNode:e=>{const t=Rt.current?.removeNode(e)??!1;if(t){const t=Xt.current?.data?"function"==typeof s?s(Xt.current.data):Xt.current.data[s]:void 0;Xt.current&&"node"===Xt.current.nodeOrEdge&&t===e&&(Xt.current=null,It(null)),qt.current.delete(e),no(),Qe.current=!0,ft()}return t},removeEdge:(e,t)=>{const o=Rt.current?.removeEdge(e,t)??!1;if(o){if(Xt.current&&"edge"===Xt.current.nodeOrEdge){const o=Xt.current.data;let n;n=void 0!==t?("object"==typeof o?.source?o.source.id:o?.source)===e&&("object"==typeof o?.target?o.target.id:o?.target)===t:!d||!o||("function"==typeof d?d:e=>e?.[d])(o)===e,n&&(Xt.current=null,It(null))}no(),Qe.current=!0,ft()}return o},updateNode:(e,t)=>{const o=Rt.current?.updateNode(e,t)??null;return o&&(Qe.current=!0,ft()),o},updateEdge:(e,t,o)=>{const n=Rt.current?.updateEdge(e,t,o)??[];return n.length>0&&(no(),Qe.current=!0,ft()),n},clear:ao,getTopology:()=>Rt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>Rt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Rt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=Rt.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:so,getTension:()=>Rt.current?.tension??0}),[ro,io,ao,so,s,no,ft,d]);const lo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),co=lo?i||(Array.isArray(r)?void 0:r):void 0;Xd(()=>{const e=Rt.current;if(!e)return;const t=++Wt.current;if(jt.current?.abort(),jt.current=null,lo&&co)e.ingestHierarchy(co,[rt,it]),Tt(e,[rt,it]),Ot(!1),Gt.current?.("ready"),Qe.current=!0,ft();else{const i=bt,a=Array.isArray(vt)?vt:[];if(0===i.length&&0===a.length)return null==n&&null==r||0>=e.nodes.size&&0>=e.edges.size||ao(),Ot(!1),void Gt.current?.("ready");const s=[rt,it],l="force"===o&&!Xe&&jp()&&!Le&&Wp(x,i.length,a.length,b);if(l&&yt&&!Yt.current&&e.sceneNodes.length>0)return Yt.current=!0,Ot(!1),Gt.current?.("ready"),Qe.current=!0,void ft();if(l){const o=new AbortController;jt.current=o;const n=e._lastPositionSnapshot;e.ingestBounded(i,a,s,{deferLayout:!0});const r=e.getLayoutData(),l=function(e,t,o,n,r){const i=xf(o.nodeSize,o.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=r?.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,o="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,r="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:o,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:r}}),config:{chartType:"force",iterations:o.iterations,forceStrength:o.forceStrength,seed:o.seed},size:n}}(r.nodes,r.edges,Vt.current,s,n);return Ot(!0),Gt.current?.("pending"),Xp(l,o.signal).then(({positions:o})=>{t===Wt.current&&(e.applyForceLayoutPositions(o,s),Tt(e,s),Ut.current=im({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:qt.current,colorScheme:H}),Ot(!1),Gt.current?.("ready"),Dt(e.layoutVersion),Qe.current=!0,ft())}).catch(o=>{"AbortError"!==o.name&&t===Wt.current&&(e.runLayout(s),Tt(e,s),Ut.current=im({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:qt.current,colorScheme:H}),Ot(!1),Gt.current?.("error"),Dt(e.layoutVersion),Qe.current=!0,ft())}),()=>o.abort()}e.ingestBounded(i,a,s),Tt(e,s),Ot(!1),Gt.current?.("ready"),Ut.current=im({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:qt.current,colorScheme:H}),Qe.current=!0,ft()}},[bt,vt,n,r,i,co,lo,rt,it,At,x,b,yt,o,Xe,Le,ft,ao,H,Tt]),Xd(()=>{a&&a.length>0&&io(a)},[a,io]);const{customHoverBehavior:uo,customClickBehavior:ho}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:fm((t,r)=>{e?.(t,r),zc({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:pm,chartId:n,context:r})},[e,o,n]),customClickBehavior:fm((e,r)=>{t?.(e,r),Oc({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:pm,chartId:n,context:r})},[t,o,n])}}({customHoverBehavior:ne,customClickBehavior:re,onObservation:ie,chartId:se}),{hoverHandlerRef:fo,hoverLeaveRef:po,onPointerMove:mo,onPointerLeave:go}=Je,yo=()=>!Xe||(Rt.current?.hasCustomRestyle??!1);fo.current=e=>{if(!te)return;const t=yo(),o=Co.current;if(!o)return;const n=Rt.current;if(!n)return;const r=hm({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:nt,adjustedWidth:rt,adjustedHeight:it,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===r.kind?(Xt.current=r.hover,It(r.hover),uo&&(uo(r.hover),t&&(Qe.current=!0)),t&&ft()):Xt.current&&(Xt.current=null,It(null),uo&&(uo(null),t&&(Qe.current=!0)),t&&ft())},po.current=()=>{if(Xt.current){const e=yo();Xt.current=null,It(null),uo&&(uo(null),e&&(Qe.current=!0)),e&&ft()}};const bo=Gd(()=>{});bo.current=e=>{if(Ci(e.target))return;if(!re&&!ie)return;const t=Co.current;if(!t)return;const o=Rt.current;if(!o)return;const n=hm({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:nt,adjustedWidth:rt,adjustedHeight:it,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?ho(n.hover,{type:"activate",inputType:Fc(e.nativeEvent.pointerType)}):"miss"===n.kind&&ho(null)};const vo=Ud(e=>bo.current(e),[]),xo=Gd(-1),ko=Gd(null),wo=Gd(-1),So=Ud(e=>{if(Hc(e))return;const t=Rt.current;if(!t)return;const o=()=>{xo.current=-1,ko.current=null,wo.current=-1,Xt.current=null,It(null),uo&&(uo(null),Qe.current=!0),ft()},n=function(e){const t=[];for(const o of e)if("circle"===o.type&&null!=o.cx){if(0>=o.r)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("rect"===o.type&&null!=o.x){if(0>=o.w||0>=o.h)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.datum?.id??"_default"})}else if("arc"===o.type&&null!=o.cx)t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"});else if("symbol"===o.type&&null!=o.cx){if(0>=o.size)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("glyph"===o.type&&null!=o.cx){if(0>=o.size||null==o.datum)continue;const e=dn(o.glyph,o.size);t.push({x:o.cx+e.centerDx,y:o.cy+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:o.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===n.length)return void(0>xo.current||o());const r=Vc(n);let i=xo.current;if(r.flat.length>i||(o(),i=-1)," "===e.key&&i>=0){e.preventDefault();const t=r.flat[i];return void ho(Ys(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),xo.current=0,wo.current=-1;const t=r.flat[0];ko.current={shape:t.shape,w:t.w,h:t.h};const o=Ys(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Xt.current=o,It(o),uo&&(uo(o,{type:"focus",inputType:"keyboard"}),Qe.current=!0),void ft()}const a=Xc(r,i),s=function(e,t,o,n,r){const i=o.flat[t.flatIndex];if(!i)return qc(e,t,o);const a=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=function(e,t,o){let n=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(o){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,n=i)}return n}(o,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return n!==t.flatIndex&&(r.current=-1),n}case"Enter":{if(null==a)return t.flatIndex;const e=function(e,t){const o=e+"",n=[];for(const e of t){const t=e.datum??e,r=Qc(t.source),i=Qc(t.target),a=null!=r,s=null!=i;a&&r+""===o&&s?n.push(i+""):s&&i+""===o&&a&&n.push(r+"")}return n}(a,n);if(0===e.length)return t.flatIndex;const i=o.idToIdx.get(e[(r.current+1)%e.length])??-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const n=qc(e,t,o);return null!==n&&n!==t.flatIndex&&(r.current=-1),n}}}(e.key,a,r,t.sceneEdges??[],wo);if(null===s)return;if(e.preventDefault(),0>s)return void o();xo.current=s;const l=r.flat[s];ko.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Xt.current=c,It(c),uo&&(uo(c,{type:"focus",inputType:"keyboard"}),Qe.current=!0),ft()},[ho,uo,ft]),Ao=Ud(e=>{xo.current=-1,ko.current=null,mo(e)},[mo]);ht.current=()=>{if(dt.current=null,!pt.isActive)return;const e=Co.current;if(!e)return;const t=Rt.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:r,margin:i,adjustedWidth:a,adjustedHeight:s,background:l,renderMode:c,hasBackgroundGraphics:u=!1,dirtyRef:d,lastFrameTimeRef:h,now:f,random:p,reducedMotion:m,showParticles:g,isContinuous:y,animate:b,decay:v,pulse:x,thresholds:k,staleness:w,particleStyle:S,getParticleColor:A,pendingAnnotationFrameRef:C,lastAnnotationFrameTimeRef:M,setAnnotationFrame:_,scheduleNextFrame:P}=e,R=t.getContext("2d");if(!R)return;const L=h.current?Math.min((f-h.current)/1e3,.1):.016;h.current=f;const T=o.advanceTransition(m?f+1e6:f),$=!m&&T,I=!m&&o.tickAnimation([a,s],L),N=d.current,D=n?.beforeCompute(o.getLastUpdateResult(),$),E=T||N||I;E&&o.buildScene([a,s]),D&&n?.afterCompute(D,E,!1);const B=g&&!m&&!!o.particlePool,F=!!((H={dirtyOrRebuilt:N,transitioning:$,animationTicked:I,continuous:B||y,liveEncoding:!!v||!!x||!!k||!1!==b&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()}).dirtyOrRebuilt||H.transitioning||H.animationTicked||H.continuous||H.liveEncoding||H.forced);var H;const z=!!w&&o.lastIngestTime>0&&f-o.lastIngestTime>(w?.threshold??5e3);if(F){const e=Bl();if(!El(t,r,i,e))return;if(R.clearRect(-i.left,-i.top,r[0],r[1]),os(R,{background:l,hasBackgroundGraphics:u,width:a,height:s}),v&&o.applyDecay(),x&&o.applyPulse(f),k&&o.applyThresholds(f),!1!==b&&o.applyTopologyDiff(f),z&&(R.globalAlpha=w?.dimOpacity??.5),Sc({context:R,nodes:o.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":Jp(e,o);break;case"line":em(e,o);break;case"ribbon":tm(e,o);break;case"curved":om(e,o)}}(R,e)}),Sc({context:R,nodes:o.sceneNodes,renderMode:c,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const o of t){if("rect"!==o.type)continue;const t=o;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=Wn(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),Ql(e,t),e.restore())}}(R,t),function(e,t){for(const o of t){if("circle"!==o.type)continue;const t=o;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=Wn(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),Jl(e,t),e.restore())}}(R,t),function(e,t){for(const o of t){if("arc"!==o.type)continue;const t=o;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=Wn(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(R,t),function(e,t){const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=rm(t);if(!r)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const i=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle=Wn(e,t.style.fill,"#007bff"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}}(R,t),function(e,t){const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&cc(e,n,n.cx,n.cy,o);e.globalAlpha=o}(R,t)}}),B&&!z){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,r=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 l=s.value*i*o*(s.bezier.circular?.3:1),c=Math.floor(l),u=l-c;let d=c;r()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n,r)}}(o.particlePool,e,L,S,p);const t=.5*(S.speedMultiplier??1);let n;if(S.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}o.particlePool.step(L,t,e,n),function(e,t,o,n,r){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 l=o[s.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:r(l),e.fillStyle=xn(e,c)||c,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(R,o.particlePool,e,S,A)}}z&&(R.globalAlpha=1)}d.current=!1,(N||$||I)&&t.setAttribute("aria-label",xs(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const O=N||$||I||C.current;O&&f-M.current>=33?(_(e=>e+1),M.current=f,C.current=!1):C.current=!!O,(y||$||null!=o.transition||I||o.hasActivePulses||o.hasActiveThresholds||!1!==b&&o.hasActiveTopologyDiff||C.current)&&P()}({canvas:e,store:t,sceneRevisionDiagnostics:Lt.current,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,background:ee,renderMode:D,hasBackgroundGraphics:!!we,dirtyRef:Qe,lastFrameTimeRef:Mt,now:pt.now(),random:pt.random,reducedMotion:!!et.current,showParticles:I,isContinuous:oo,animate:Me,decay:Se,pulse:Ae,thresholds:De,staleness:_e,particleStyle:kt,getParticleColor:to,pendingAnnotationFrameRef:Pt,lastAnnotationFrameTimeRef:_t,setAnnotationFrame:Bt,scheduleNextFrame:()=>{ft()}})};const{canvasRef:Co}=$l(Je,{hydrated:gt,wasHydratingFromSSR:yt,storeRef:Rt,dirtyRef:Qe,canvasPaintDependencies:[o,rt,it,ee,we,D,ft]});hr(_e,Rt,Qe,ft,Ft,Ht);const Mo=te&&$t?mm(sl,{x:$t.x,y:$t.y,containerWidth:rt,containerHeight:it,margin:nt,className:"stream-network-tooltip",zIndex:2,children:oe?oe($t):mm(Zp,{data:$t})}):null;if(Ha||!gt&&yt)return mm(_p,{props:e,store:Rt.current,responsiveRef:tt,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,resolvedBackground:st,resolvedForeground:at});const _o=Rt.current;return gm("div",{ref:tt,className:"stream-network-frame"+(J?" "+J:""),role:"group","aria-label":Be||("string"==typeof xe?xe:"Network chart"),tabIndex:0,"aria-busy":zt||void 0,style:{position:"relative",width:K?"100%":ot[0],height:Z?"100%":ot[1],overflow:"visible"},onKeyDown:So,children:["production"!==process.env.NODE_ENV&&Rt.current&&mm(Fo,{store:Rt.current,diagnostics:Lt.current}),Ee&&mm(Bs,{tableId:ut}),Ee&&mm(Ds,{nodes:_o?.sceneNodes??[],edges:_o?.sceneEdges??[],chartType:"Network chart",tableId:ut,chartTitle:"string"==typeof xe?xe:void 0}),mm(Es,{summary:Fe}),mm(fs,{hoverPoint:$t}),gm("div",{role:"img","aria-label":Be||("string"==typeof xe?xe:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:te?Ao:void 0,onMouseLeave:te?go:void 0,onClick:re||ie?vo:void 0,children:[zt&&!1!==k&&mm("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:zp(!0,ot[0],ot[1],k)}),mm(Il,{size:ot,margin:nt,overflowVisible:!0,children:st}),mm("canvas",{ref:Co,"aria-label":xs(_o?.sceneNodes?.length??0,_o?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),mm(xp,{width:rt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:nt,labels:_o?.labels||[],sceneNodes:_o?.sceneNodes,title:xe,legend:fe,legendPosition:pe,legendLayout:me,legendHoverBehavior:ge,legendClickBehavior:ye,legendHighlightedCategory:be,legendIsolatedCategories:ve,foregroundGraphics:zo(at,Xo(Rt.current?.customLayoutOverlays,Ke??null)),annotations:ce,onAnnotationActivate:ue,onObservation:ae??ie,chartId:se,chartType:"StreamNetworkFrame",autoPlaceAnnotations:de,svgAnnotationRules:he,annotationFrame:Et}),mm(Ap,{marks:_o?.customLayoutHtmlMarks,margin:nt,selection:Ke??null}),mm(zs,{active:xo.current>=0,hoverPoint:$t,margin:nt,size:ot,shape:ko.current?.shape,width:ko.current?.w,height:ko.current?.h}),Mo,_e?.showBadge&&mm(pr,{isStale:Ft,position:_e.badgePosition})]})]})}));km.displayName="StreamNetworkFrame";var wm=km;function Sm(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Am(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};n&&(f.annotationObservationCallback=n);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(s||t||n||r||a)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||o))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}function Cm(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:il(t)||o}}import*as Mm from"react";import{useMemo as _m,useCallback as Pm,forwardRef as Rm,useRef as Lm}from"react";import{useMemo as Tm,useCallback as $m,useState as Im,useId as Nm,useEffect as Dm,useRef as Em}from"react";import{createContext as Bm,useContext as Fm,useMemo as Hm}from"react";import{jsx as zm}from"react/jsx-runtime";var Om=Bm(null);function Wm({colors:e,categories:t,colorScheme:o="category10",children:n}){const r=Hm(()=>{if(e)return e;if(t){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o,n={};let r=0;for(const o of t)n[o]=He(e,o)??Ne[r++%Ne.length];return n}const e=Array.isArray(o)?o:Ie[o]||Ne,n={};for(let o=0;t.length>o;o++)n[t[o]]=e[o%e.length];return n}return{}},[e,t,o]);return zm(Om.Provider,{value:r,children:n})}function jm(){return Fm(Om)}Wm.displayName="CategoryColorProvider";import{createContext as Ym,useContext as Gm,useEffect as Vm,useId as Xm,useLayoutEffect as qm,useMemo as Um,useRef as Km,useState as Zm,useCallback as Qm}from"react";function Jm(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function eg(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Jm(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function tg(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function og(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[ng,rg]=z(e=>({selections:new Map,setClause(t,o){e(e=>{const n=e.selections.get(t),r=n?.clauses.get(o.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,n]of o){const o=t.fields[e];if(!o||!og(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),a=tg(i,t),s=new Map(a.clauses);return s.set(o.clientId,o),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=tg(r,t);return r.set(t,{...i,resolution:o}),{selections:r}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const n=new Map(e.selections);return n.set(t,{...o,clauses:new Map}),{selections:n}})}}));import{useId as ig,useMemo as ag,useCallback as sg}from"react";function lg(e){const t=ig(),o=e.clientId||t,{name:n}=e,r=rg(e=>e.selections.get(n)),i=rg(e=>e.setClause),a=rg(e=>e.clearClause),s=ag(()=>!!r&&r.clauses.size>0,[r]);return{predicate:ag(()=>r&&0!==r.clauses.size?eg(r,o):()=>!0,[r,o]),isActive:s,selectPoints:sg(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:sg(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:sg(()=>{a(n,o)},[a,n,o]),clientId:o}}function cg(e,t){const o=ig(),n=t||o,r=rg(e=>e.setClause),i=rg(e=>e.clearClause);return{selectPoints:sg(t=>{const o={};let i=!1;for(const[e,n]of Object.entries(t))o[e]={type:"point",values:new Set(n)},i=!0;i&&r(e,{clientId:n,type:"point",fields:o})},[e,n,r]),clear:sg(()=>i(e,n),[e,n,i]),clientId:n}}function ug(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:a}=lg({name:t,fields:o});return{onHover:sg(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}fg(t)&&i(t)},[o,i,a]),predicate:n,isActive:r}}function dg(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function hg(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:a,clear:s}=lg({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=sg(e=>{if(!e)return void s();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&dg(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&dg(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),fg(t)&&a(t)},[l,o,n,a,s]);return{brushInteraction:ag(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:s}}function fg(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function pg(e,t,o){const n=rg(e=>e.selections.get(t));return ag(()=>{if(!n||0===n.clauses.size)return e;const t=eg(n,o);return e.filter(t)},[e,n,o])}import{useMemo as mg}from"react";function gg(e={}){const{limit:t=50,types:o,chartId:n}=e,r=ki(e=>e.version),i=ki(e=>e.observations),a=ki(e=>e.clearObservations),s=mg(()=>{let e=i;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[i,o,n,t,r]);return{observations:s,latest:s.length>0?s[s.length-1]:null,clear:a}}import{jsx as yg,jsxs as bg}from"react/jsx-runtime";var vg=Ym(!1),xg=Ym(!1);function kg(){return Gm(xg)}var wg=Ym(null),Sg="undefined"==typeof window?Vm:qm;function Ag(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function Cg(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function Mg(e){const t=Gm(wg),o=Xm(),n=Ag(e),r=Km([]);Cg(r.current,n)||(r.current=n);const i=r.current;Sg(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Sg(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var _g="__linked-legend-isolate__",Pg="__linked-legend-highlight__";function Rg({categoryColors:e,interaction:t,selectionName:o,field:n}){const r=Object.entries(e),i=r.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:s,clear:l}=lg({name:o,fields:[n],clientId:_g}),{selectPoints:c,clear:u}=lg({name:o,fields:[n],clientId:Pg}),d=rg(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:f}=Um(()=>{const e=new Set;let t=null;const o=d?.clauses.get(_g)?.fields[n];if("point"===o?.type)for(const t of o.values)e.add(t+"");const r=d?.clauses.get(Pg)?.fields[n];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,n]),p=Qm(e=>{"highlight"===t&&(e?c({[n]:[e.label]}):u())},[t,n,c,u]),m=Qm(e=>{if("isolate"!==t)return;const o=new Set(h);o.has(e.label)?o.delete(e.label):o.add(e.label),0===o.size||o.size===i.length?l():s({[n]:Array.from(o)})},[t,n,h,i.length,s,l]),[g,[y]]=xl([0,0],!0,!1),b=Um(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const r of e){const e=26+7*r.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(r.map(([e])=>e),y),[r,y]);return 0===r.length?null:yg("div",{ref:g,style:{width:"100%",display:"block"},children:yg("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:yg(_r,{legendGroups:a,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?m:void 0,highlightedCategory:f,isolatedCategories:h})})})}function Lg({children:e,selections:t,showLegend:o,legendPosition:n="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:a="category"}){const s=Um(()=>{if(!t)return;const e=new Map;for(const[o,n]of Object.entries(t))n.resolution&&e.set(o,{name:o,resolution:n.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=jm(),[c,u]=Zm({}),d=Km({}),h=Um(()=>({registerCategories:(e,t)=>{const o=Ag(t);u(t=>Cg(t[e]??[],o)?t:{...t,[e]:o})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const o={...t};return delete o[e],o})}}),[]),f=Um(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return Ag(e)},[c]),p=Um(()=>{const e=l??{},t=d.current;let o=Object.keys(e).length+Object.keys(t).length;for(const n of f)e[n]||t[n]||(t[n]=Ne[o%Ne.length],o++);const n={...e};for(const o of f)n[o]=e[o]??t[o];return n},[l,f]),m=void 0===o||o,g=Object.keys(p).length>0;return yg(ng,{initialState:s,children:yg(xi,{children:yg(xg.Provider,{value:!0,children:yg(wg.Provider,{value:h,children:yg(Wm,{colors:p,children:bg(vg.Provider,{value:m&&g,children:[m&&"top"===n&&yg(Rg,{categoryColors:p,interaction:r,selectionName:i,field:a}),e,m&&"bottom"===n&&yg(Rg,{categoryColors:p,interaction:r,selectionName:i,field:a})]})})})})})})}function Tg({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?n(a,t,o):o?o(r):De[i%De.length];return{label:r+"",color:s}}),label:""}]}}function $g(e){return e?"string"==typeof e?{name:e}:e:null}function Ig(e,t,o){return t?(n,...r)=>{const i={...e(n,...r)};if(t.isActive)if(t.predicate(n))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}import*as Ng from"react";function Dg(e,t=":root"){const o=[];return o.push(` --semiotic-bg: ${e.colors.background};`),o.push(` --semiotic-text: ${e.colors.text};`),o.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),o.push(` --semiotic-grid: ${e.colors.grid};`),o.push(` --semiotic-border: ${e.colors.border};`),o.push(` --semiotic-primary: ${e.colors.primary};`),o.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&o.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&o.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&o.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&o.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&o.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&o.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&o.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&o.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&o.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&o.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&o.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&o.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&o.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&o.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&o.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&o.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),o.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),o.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&o.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&o.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&o.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&o.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&o.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${o.join("\n")}\n}`}function Eg(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 Bg=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Fg={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Hg={light:G,dark:V,"high-contrast":X,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 zg(e){return Hg[e]}import{jsx as Og,jsxs as Wg}from"react/jsx-runtime";var jg=Ng.createContext(void 0),Yg="undefined"==typeof window?Ng.useEffect:Ng.useLayoutEffect;function Gg(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return zg(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Vg({theme:e}){const t=K(e=>e.setTheme),o=K(e=>e.theme),n=Ng.useRef(o);n.current=o;const r=Ng.useRef(null);Ng.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=n.current===X?G:n.current,t("high-contrast")),gl(o,e=>{e.matches?(r.current=n.current===X?r.current??G:n.current,t("high-contrast")):(function(e,t){e(t===G?"light":t===V?"dark":t===X?"high-contrast":t)}(t,r.current??G),r.current=null)})},[e,t]);const i=Ng.useRef(!1);return Yg(()=>{i.current?void 0!==e&&t(Gg(e)):i.current=!0},[e,t]),null}function Xg({children:e}){const t=K(e=>e.theme),o={position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-cell-border":t.colors.cellBorder||t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily,...t.colors.focus?{"--semiotic-focus":t.colors.focus}:{},...t.tooltip?.background?{"--semiotic-tooltip-bg":t.tooltip.background}:{},...t.tooltip?.text?{"--semiotic-tooltip-text":t.tooltip.text}:{},...t.tooltip?.borderRadius?{"--semiotic-tooltip-radius":t.tooltip.borderRadius}:{},...t.tooltip?.fontSize?{"--semiotic-tooltip-font-size":t.tooltip.fontSize}:{},...t.tooltip?.shadow?{"--semiotic-tooltip-shadow":t.tooltip.shadow}:{},...t.borderRadius?{"--semiotic-border-radius":t.borderRadius}:{},...t.colors.selection?{"--semiotic-selection-color":t.colors.selection}:{},...null!=t.colors.selectionOpacity?{"--semiotic-selection-opacity":t.colors.selectionOpacity+""}:{},...t.colors.diverging?{"--semiotic-diverging":t.colors.diverging}:{},...t.colors.annotation?{"--semiotic-annotation-color":t.colors.annotation}:{},...null!=t.typography.legendSize?{"--semiotic-legend-font-size":t.typography.legendSize+"px"}:{},...null!=t.typography.titleFontSize?{"--semiotic-title-font-size":t.typography.titleFontSize+"px"}:{},...null!=t.typography.tickFontFamily?{"--semiotic-tick-font-family":t.typography.tickFontFamily}:{},...null!=t.typography.tickSize?{"--semiotic-tick-font-size":t.typography.tickSize+"px"}:{},...null!=t.typography.labelSize?{"--semiotic-axis-label-font-size":t.typography.labelSize+"px"}:{},"--semiotic-secondary":t.colors.secondary||t.colors.primary,"--semiotic-surface":t.colors.surface||t.colors.background,...t.colors.success?{"--semiotic-success":t.colors.success}:{},...t.colors.danger?{"--semiotic-danger":t.colors.danger}:{},...t.colors.warning?{"--semiotic-warning":t.colors.warning}:{},...t.colors.error?{"--semiotic-error":t.colors.error}:{},...t.colors.info?{"--semiotic-info":t.colors.info}:{}},n=Ng.useContext(jg),r={};return n&&(r["data-semiotic-theme"]=n),Og("div",{style:o,...r,children:e})}function qg({theme:e,children:t}){const o="string"==typeof e&&zg(e)?e:void 0,n=Ng.useMemo(()=>function(e){return void 0!==e?q(G,Gg(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?X:G}(e),[e]);return Og(U,{initialState:{theme:n},children:Wg(jg.Provider,{value:o,children:[Og(Vg,{theme:e}),Og(Xg,{children:t})]})})}function Ug(){return K(e=>e.theme)}function Kg(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Zg(e,t){const{when:o}=e,n=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&a!==o.orientation)}function Qg(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const n=o.map((e,t)=>({rule:e,index:t})).filter(e=>Zg(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:n.reduce((e,t)=>function(e,t){const o={...e,...t};for(const n of["margin","frameProps","mobileSemantics","style"])Kg(e[n])&&Kg(t[n])&&(o[n]={...e[n],...t[n]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:n}}function Jg(e,t,o){const n=e.xValue??t?.[o];if(null==n)return null;const r=Number(n);return Number.isFinite(r)?r:null}function ey(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function ty(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var oy="#007bff",ny=[],ry={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function iy(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!r&&!i)return ry;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??n??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function ay(){const e=Ug(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function sy(e,t,o,n,r){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=He(o,n);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=Ie[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=n?(r.has(n)||r.set(n,r.size),i[r.get(n)%i.length]):i[0]:oy}function ly(e,t,o){const n=jm(),r=ay();return Tm(()=>{if(!t)return;const i=n??void 0,a=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&ty(i)){const e=ze(o.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return ze(o.map(e=>({_cat:e})),"_cat",a)}if(i&&ty(i)){const o=ze(e,t,a);return e=>i[e]||o(e)}return ze(e,t,a)}if(i&&ty(i)){const e=ze([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,o,n,r])}function cy(e,t,o){return Tm(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function uy({selection:e,linkedHover:t,fallbackFields:o=ny,unwrapData:n=!1,onObservation:r,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=Nm(),h=Tm(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,o),[t,o]),f=Tm(()=>"series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o,[h,c,o]),p=lg({name:e?.name||"__unused__",fields:f}),m=ug({name:h?.name||"hover",fields:f}),g=ki(e=>e.pushObservation),y=$m(e=>{r?.(e),g?.(e)},[r,g]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=Im(null),k=Em(!1),w=c||o[0],S=Tm(()=>{if(!l||null==v||!w)return null;const e=v,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,v,w]),A=$m((e,o)=>{const n=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const o=Jg(e,t,h.xField);null!=o&&function(e,t,o){const n=oa.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(oa={positions:new Map(oa.positions).set(e,{xValue:t,sourceId:o})},ra())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||n||ia(h.name||"hover",d),"x-position"===h?.mode||n||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];x(null!=o?o+"":null)}else n||x(null);(r||g)&&zc({onObservation:y,datum:e?ey(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:o})},[t,m,h,d,r,i,a,g,y,l,w,u]),C=$m((o=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),o&&l&&x(null),"x-position"===h?.mode&&(aa(h.name||"hover",d),ia(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),M=$m((o,n)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=Jg(o,e,h.xField);null!=t&&function(e,t,o){const n=oa.positions.get(e);if(n?.locked){const t=new Map(oa.positions);return t.delete(e),oa={positions:t},ra(),!1}oa={positions:new Map(oa.positions).set(e,{xValue:t,sourceId:o,locked:!0})},ra()}(h.name||"hover",t,d)}if(c)if(o){k.current=!0;const n=ey(o);if(t&&"x-position"!==h?.mode&&m.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}ty(e)&&p.selectPoints(e)}if(l&&w){const e=n?.[w];x(null!=e?e+"":null)}}else b&&C();if(o||b){if(o&&s){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),s(e,{x:o.x??0,y:o.y??0})}(r||g)&&Oc({onObservation:y,datum:o?ey(o):null,x:o?.x,y:o?.y,chartType:i||"unknown",chartId:a,context:n})}},[s,r,g,y,i,a,h,d,u,t,m,e,p,f,l,w,C]);return Dm(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&C()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,C]),Dm(()=>()=>{k.current&&C(!1)},[C]),Dm(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{aa(e,d),ia(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:M,crosshairSourceId:d}}function dy(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function hy({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Gm(vg),c=null!==Gm(wg),u=void 0!==n?n:!l&&!!t,d=!!t&&(u||c),h=Tm(()=>{if(!d)return[];if(void 0!==s)return s;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[s,t,e,d]);Mg(c&&t?h:[]);const f=Tm(()=>{if(!u||!t)return;const n=Tg({data:e,colorBy:t,colorScale:o,getColor:Fe,categories:h});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[u,t,e,o,h]),p=Tm(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:a[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[a,i,f,r]);return{legend:f,margin:p,legendPosition:r}}function fy(e,t,o){const[n,r]=Im(null),[i,a]=Im(new Set),s=Tm(()=>new Set,[]),l=$m(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=$m(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=Tm(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has(n)}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var py={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function my(e,t,o){const n=py[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,a=Qg({...t,mode:e},{width:t.width??r,height:t.height??i}).props,s=a.mode||e,l=py[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!o?.width?l.width:o.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!o?.height?l.height:o.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:gy(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:iy(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function gy(e,t,o){if(!1!==t)return e;const n={...e};return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function yy(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let a=1;n>=a;a++){const n=r[a];r[a]=e[i-1]===t[a-1]?o:1+Math.min(o,r[a],r[a-1]),o=n}}return r[n]}function by(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}function vy(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let n,r=o+1;for(const o of t){const t=yy(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function xy({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(o){const n=by(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[r,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in n)){const o=vy(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function ky({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function wy({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==o)return null;if(r&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const o=by(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in o)){const o=vy(r,t),i=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}import{useCallback as Sy,useMemo as Ay,useState as Cy}from"react";import{useMemo as My}from"react";function _y(e){const t=K(e=>e.theme.colors.selectionOpacity);return My(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Py(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,userMargin:m,marginDefaults:g,onClick:y,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:k,loadingContent:w,emptyContent:S,width:A,height:C}=e,M=void 0===o,_=Ay(()=>T(t),[t]),[P,R]=Cy([]),L=Sy(e=>{R(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),$="string"==typeof e.colorBy?e.colorBy:void 0,I=Ay(()=>iy(v,{width:A,mobileSemantics:x}),[v,A,x]),{activeSelectionHook:N,hoverSelectionHook:D,customHoverBehavior:E,customClickBehavior:B,crosshairSourceId:F}=uy({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:y,hoverHighlight:b,colorByField:$,mobileInteraction:I}),H=dy(l,F),z=ly(_,n,r),O=Ay(()=>{if(!n)return[];const e=new Set;for(const t of _){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[_,n]),W=Ay(()=>M&&P.length>0?P:O,[M,P,O]),j=fy(i,n,W),Y=Ay(()=>D||(j.legendSelectionHook?j.legendSelectionHook:N),[D,j.legendSelectionHook,N]),G=_y(s),V=ay(),X=jm(),q=Ay(()=>{if(z)return z;if(!n||0===W.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:V&&V.length>0?V:De,t="__streamCat",o=ze(W.map(e=>({[t]:e})),t,e);return e=>X?.[e]||o(e)||"#999"},[z,n,W,r,V,X]),{legend:U,margin:K,legendPosition:Z}=hy({data:_,colorBy:n,colorScale:q,showLegend:p,legendPosition:a,userMargin:m,defaults:g,categories:W}),Q=Ay(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Z),i&&"none"!==i&&(e.legendHoverBehavior=j.onLegendHover,e.legendClickBehavior=j.onLegendClick,e.legendHighlightedCategory=j.highlightedCategory,e.legendIsolatedCategories=j.isolatedCategories),M&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=L),e},[U,Z,i,j.onLegendHover,j.onLegendClick,j.highlightedCategory,j.isolatedCategories,M,n,L]),J=Array.isArray(o)?T(o):o,ee=zp(k,A,C,w),te=ee?null:Hp(J,A,C,S);return{data:_,colorScale:z,allCategories:W,legendState:j,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:E,customClickBehavior:B,mobileInteraction:I,legend:U,margin:K,legendPosition:Z,earlyReturn:ee||te||null,legendBehaviorProps:Q,crosshairProps:H,resolvedSelection:G}}import{useImperativeHandle as Ry}from"react";function Ly(e,t){const{variant:o,frameRef:n,overrides:r}=t;Ry(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return{...e,...r}},[n,r,o])}import{useMemo as Ty}from"react";function $y(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function Iy(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Ey(t(e))}function Ny(e,t){const o=Iy(e),n=Iy(t);return(e,t)=>{const r=n(e);return{value:r,x:o(e),y:r,category:t}}}function Dy(e,t){const o=Iy(t??"value"),n=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=n?n(e):void 0;return{value:o(e),category:null==t?void 0:t+""}}}function Ey(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function By(e,t,o){const n=null!=e.axis?o[e.axis]:null!=e.field?t[e.field]:o.value;if(void 0!==e.eq&&n!==e.eq)return!1;if(void 0!==e.ne&&n===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(n))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Ey(n);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,o]=e.within;if(t>r||r>o)return!1}if(void 0!==e.outside){const[t,o]=e.outside;if(r>=t&&o>=r)return!1}return!0}function Fy(e,t,o){const n=e.when;return void 0===n||!0===n||!1!==n&&("function"==typeof n?n(t,o):By(n,t,o))}function Hy(e,t,o){if(!t||0===t.length)return{};let n={};for(const r of t){if(!Fy(r,e,o))continue;const t="function"==typeof r.style?r.style(e,o):r.style;t&&(n={...n,...t})}return n}function zy(e,t,o,n=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const a=n(e),s={...r(e,i)};return Object.assign(s,Hy(a,t,o(a,i))),s}:r}function Oy(e,t,o){return e&&0!==e.length?(n,r)=>{const i=Hy(n,e,t(n,r)),a=o?o(n,r):void 0;return a?{...i,...a}:i}:o}function Wy(e,t,o,n){if(!e||0===e.length)return n;const r=Dy(t,o);return(t,o)=>{const i=t&&t.data||t,a=Hy(i,e,r(i)),s=n?n(t,o):void 0;return s?{...a,...s}:a}}function jy(e,t,o,n){return Oy(e,Ny(t,o),n)}function Yy(e,t,o){const n=Iy(t);return Oy(e,(e,t)=>({value:n(e),category:t}),o)}function Gy(e){const{colorBy:t,colorScale:o,color:n,pointRadius:r=5,radiusFn:i,fillOpacity:a=1,fallbackFill:s,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f,colorDatumAccessor:p,styleRules:m,ruleContext:g}=e,y=Ty(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(t){if(o){const n=p?p(e):e;u.fill=Fe(n,t,o)}}else u.fill=s?s(e):n||oy;return void 0===u.r&&(u.r=i?i(e):r),m&&m.length>0&&Object.assign(u,Hy(e,m,g?g(e):{value:void 0})),u},[t,o,n,r,i,a,s,l,p,m,g]),b=Ty(()=>$y(y,{stroke:c,strokeWidth:u,opacity:d}),[y,c,u,d]);return Ty(()=>Ig(b,h??null,f),[b,h,f])}import{useCallback as Vy,useMemo as Xy,useRef as qy,useState as Uy}from"react";function Ky(e){const{accessor:t,data:o,isPushMode:n}=e,r=qy(null),[i,a]=Uy(0),s=Vy(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,o=!0),i>r.current[1]&&(r.current[1]=i,o=!0)):(r.current=[i,i],o=!0))}o&&a(e=>e+1)},[n,t]),l=Vy(()=>{n&&(r.current=null,a(e=>e+1))},[n]);return{domain:Xy(()=>{if(n)return r.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(i>n&&(i=n),n>a&&(a=n))}return Number.isFinite(i)&&Number.isFinite(a)?[i,a]:void 0},[o,t,n,i]),trackPushed:s,reset:l}}function Zy(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}import{useEffect as Qy,useMemo as Jy,useRef as eb,useState as tb}from"react";var ob="__forecastSegment",nb=null;async function rb(){return nb||(nb=await import("./semiotic-statisticalOverlays-UOMSFKVJ.module.min.js")),nb}var ib="__semiotic_resolvedX",ab="__semiotic_resolvedY";function sb(e){const{data:t,xAccessor:o,yAccessor:n,forecast:r,anomaly:i,groupBy:a}=e,s="string"==typeof o?o:ib,l="string"==typeof n?n:ab,c=Jy(()=>{if(!r&&!i)return t;const e="function"==typeof o,a="function"==typeof n;return e||a?t.map(t=>{const r={...t};return e&&(r[ib]=o(t)),a&&(r[ab]=n(t)),r}):t},[t,r,i,o,n]),[u,d]=tb(null),[h,f]=tb([]),p=eb(r),m=eb(i);return Qy(()=>{if(!r&&!i)return void((p.current||m.current)&&(d(null),f([]),p.current=r,m.current=i));let e=!1;const t=r!==p.current||i!==m.current;if(p.current=r,m.current=i,t&&(d(null),f([])),r){const t=a&&"string"==typeof a&&"object"==typeof r?{...r,_groupBy:a}:r;(async function(...e){return(await rb()).buildForecast(...e)})(c,s,l,t,i).then(t=>{e||(d(t),f(t.annotations))}).catch(()=>{e||(d(null),f([]))})}else i&&async function(...e){return(await rb()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,s,l,a]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:s,yAccessorKey:l}}import{jsx as lb}from"react/jsx-runtime";var cb=Rm(function(e,t){const o=Lm(null),n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:d,yScaleType:h,colorBy:f,colorScheme:p,styleRules:m,sizeBy:g,sizeRange:y=[3,15],symbolBy:b,symbolMap:v,pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:S,pointIdAccessor:A,annotations:C,regression:M,forecast:_,anomaly:P,xExtent:R,yExtent:L,frameProps:$={},selection:I,linkedHover:N,linkedBrush:D,onObservation:E,onClick:B,hoverHighlight:F,chartId:H,loading:z,loadingContent:O,emptyContent:W,legendInteraction:j,legendPosition:Y,color:G,stroke:V,strokeWidth:X,opacity:q}=e,{width:U,height:K,enableHover:Z,showGrid:Q,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:ne,xLabel:re,yLabel:ie}=n,ae=_m(()=>T(r),[r]),se=void 0===r,{domain:le,trackPushed:ce,reset:ue}=Ky({accessor:g,data:ae,isPushMode:se}),de=Pm(e=>{ce([e]),o.current?.push(e)},[ce]),he=Pm(e=>{ce(e),o.current?.pushMany(e)},[ce]);Ly(t,{variant:"xy",frameRef:o,overrides:{push:de,pushMany:he,clear:()=>{ue(),o.current?.clear()}}});const fe=Py({data:ae,rawData:r,colorBy:f,colorScheme:p,legendInteraction:j,legendPosition:Y,selection:I,linkedHover:N,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:E,onClick:B,hoverHighlight:F,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Scatterplot",chartId:H,showLegend:J,userMargin:i,marginDefaults:n.marginDefaults,loading:z,loadingContent:O,emptyContent:W,width:U,height:K}),pe=$g(D),me=hg({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),ge=pe?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,ye=Mm.useRef(me.brushInteraction);ye.current=me.brushInteraction;const be=Pm(e=>{const t=ye.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Op("Scatterplot",ae,"xAccessor",c),Op("Scatterplot",ae,"yAccessor",u);const ve=_m(()=>g?le??[0,1]:void 0,[g,le]),xe=_m(()=>g?e=>Oe(e,g,y,ve):void 0,[g,y,ve]),ke=_m(()=>Ny(c,u),[c,u]),we=Gy({colorBy:f,colorScale:fe.colorScale,color:G,pointRadius:x,fillOpacity:k,radiusFn:xe,stroke:V,strokeWidth:X,opacity:q,styleRules:m,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Se=_m(()=>$c([{label:re||_c(c),accessor:c,role:"x",format:s},{label:ie||_c(u),accessor:u,role:"y",format:l},...f?[{label:_c(f),accessor:f,role:"color"}]:[],...g?[{label:_c(g),accessor:g,role:"size"}]:[]]),[c,u,re,ie,f,g,s,l]),{effectiveData:Ae,statisticalAnnotations:Ce}=sb({data:ae,xAccessor:c,yAccessor:u,forecast:_,anomaly:P}),Me=_m(()=>{const e=Zy(M);return e||0!==Ce.length?[...e?[e]:[],...C||[],...Ce]:C},[M,C,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const _e=xy({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(_e)return lb(Tp,{componentName:"Scatterplot",message:_e,width:U,height:K});const Pe={chartType:"scatter",...null!=r&&{data:Ae},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:f||void 0,sizeAccessor:g||void 0,...b&&{symbolAccessor:b},...v&&{symbolMap:v},sizeRange:y,pointStyle:we,colorScheme:p,size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:n.showAxes,xLabel:re,yLabel:ie,xFormat:s,yFormat:l,enableHover:Z,showGrid:Q,...fe.legendBehaviorProps,...Sm({title:ee,description:te,summary:oe,accessibleTable:ne,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:w,defaultTooltipContent:Se}),...Am({linkedHover:N,selection:I,onObservation:E,onClick:B,hoverHighlight:F,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...S&&{marginalGraphics:S},...A&&{pointIdAccessor:A},...Me&&Me.length>0&&{annotations:Me},...R&&{xExtent:R},...L&&{yExtent:L},...pe&&{brush:{dimension:ge},onBrush:be},...fe.crosshairProps,...$};return lb(Ep,{componentName:"Scatterplot",width:U,height:K,children:lb(su,{ref:o,...Pe})})});cb.displayName="Scatterplot";import{useMemo as ub,forwardRef as db,useRef as hb}from"react";import{Fragment as fb,jsx as pb}from"react/jsx-runtime";function mb(e,t){return be(1===t?.5:e/(t-1))}var gb=db(function(e,t){const o=hb(null);Ly(t,{variant:"xy",frameRef:o});const n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:d,orderLabel:h,styleRules:f,pointRadius:p=4,tooltip:m,pointIdAccessor:g,annotations:y,regression:b,forecast:v,anomaly:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:T,emptyContent:$,legendInteraction:I,stroke:N,strokeWidth:D,opacity:E}=e,{width:B,height:F,enableHover:H,showGrid:z,title:O,description:W,summary:j,accessibleTable:Y,xLabel:G,yLabel:V}=n,{safeData:X,orderMap:q}=ub(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],o="function"==typeof u?u:e=>e[u];let n=e;if(d&&e.length>0){const t="function"==typeof d?d:e=>e[d];n=[...e].sort((e,o)=>{const n=t(e),r=t(o);return(n instanceof Date?n.getTime():+n)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let a=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&a++}let s=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i.set(e,{idx:s++,total:a})}return{safeData:n,orderMap:i}},[r,d,c,u]);Op("ConnectedScatterplot",X,"xAccessor",c),Op("ConnectedScatterplot",X,"yAccessor",u);const U=Py({data:X,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:A,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:L,loadingContent:T,emptyContent:$,width:B,height:F}),K=U.resolvedSelection?.unselectedOpacity??.5,Z=ub(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=mb(t,a),u=!n||!r||r(s.datum??s)||r(l.datum??l),d=n?u?1:K:1;i&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Q=ub(()=>[Z],[Z]),J=ub(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const r=n.length,i=100>r,a=[];for(let e=0;r-1>e;e++){const t=n[e],o=n[e+1],s=mb(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&a.push(pb("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(pb("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return pb(fb,{children:a})},[p]),ee=ub(()=>[J],[J]),te=Gy({colorScale:void 0,baseStyleExtras:ub(()=>e=>{const t=q.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?mb(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,q]),stroke:N,strokeWidth:D,opacity:E,styleRules:f,ruleContext:ub(()=>Ny(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),ne=ub(()=>$c([{label:G||_c(c),accessor:c,role:"x",format:s},{label:V||_c(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,G,V,d,oe,s,l]),re=xy({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:ae}=sb({data:X,xAccessor:c,yAccessor:u,forecast:v,anomaly:x});if(U.earlyReturn)return U.earlyReturn;const se=Zy(b),le=se||ae.length>0?[...se?[se]:[],...y||[],...ae]:y,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:n.showAxes,xLabel:G,yLabel:V,xFormat:s,yFormat:l,enableHover:H,showGrid:z,...Sm({title:O,description:W,summary:j,accessibleTable:Y,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:m,defaultTooltipContent:ne}),...Am({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...g&&{pointIdAccessor:g},canvasPreRenderers:Q,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...S};return re?pb(Tp,{componentName:"ConnectedScatterplot",message:re,width:B,height:F}):pb(Ep,{componentName:"ConnectedScatterplot",width:B,height:F,children:pb(su,{ref:o,...ce})})});gb.displayName="ConnectedScatterplot";import{useMemo as yb,useCallback as bb,useState as vb,useEffect as xb,forwardRef as kb,useRef as wb}from"react";import{useMemo as Sb}from"react";function Ab(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:r,resolveStroke:i,fillArea:a,areaOpacity:s=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,styleRules:f,ruleContext:p}=e,m=Sb(()=>(e,l)=>{const c={strokeWidth:t},u=!0===a||Array.isArray(a)&&null!=l&&a.includes(l);let d;return i?d=i(e,l):o?n&&(d=Fe(e,o,n)):d=r||oy,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=s)),f&&f.length>0&&Object.assign(c,Hy(e,f,p?p(e,l):{value:void 0,category:l})),c},[t,o,n,r,i,a,s,f,p]),g=Sb(()=>$y(m,{stroke:l,strokeWidth:c,opacity:u}),[m,l,c,u]);return Sb(()=>Ig(g,d??null,h),[g,d,h])}import{jsx as Cb}from"react/jsx-runtime";var Mb="__lineObjectSeries",_b=kb(function(e,t){const o=wb(null);Ly(t,{variant:"xy",frameRef:o});const n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:d="y",lineBy:h,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:m,styleRules:g,curve:y="linear",showPoints:b=!1,pointRadius:v=3,fillArea:x=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:S,tooltip:A,pointIdAccessor:C,annotations:M,directLabel:_,gapStrategy:P="break",anomaly:R,forecast:L,band:$,xExtent:I,yExtent:N,frameProps:D={},selection:E,linkedHover:B,onObservation:F,onClick:H,hoverHighlight:z,hoverRadius:O,chartId:W,loading:j,loadingContent:Y,emptyContent:G,legendInteraction:V,legendPosition:X,xScaleType:q,yScaleType:U,color:K,stroke:Z,strokeWidth:Q,opacity:J}=e,{width:ee,height:te,enableHover:oe,showGrid:ne,showLegend:re,title:ie,description:ae,summary:se,accessibleTable:le,xLabel:ce,yLabel:ue}=n,de=yb(()=>T(r),[r]),he=Array.isArray(de[0]?.[f])?de[0][f]:de;Op("LineChart",he,"xAccessor",u),Op("LineChart",he,"yAccessor",d);const{effectiveData:fe,statisticalAnnotations:pe}=sb({data:de,xAccessor:u,yAccessor:d,forecast:L,anomaly:R,groupBy:h}),me="__compoundGroup",ge=!(!L||!h),ye=ge?me:L?ob:h,be=yb(()=>{if(!ge)return fe;const e="function"==typeof h?h:e=>e[h];return fe.map(t=>{const o={...t};return o[me]=`${e(t)}__${t[ob]||"observed"}`,o})},[fe,ge,h]),ve=ge?be:fe,xe=p||h,ke=yb(()=>{if(!L)return;const e=L.upperBounds,t=L.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const a=fe;for(const e of a){const t="function"==typeof d?d(e):+e[d];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[L,fe,d]),we=bb(e=>{const t="function"==typeof u?u(e):e[u],o="function"==typeof d?d(e):e[d];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[u,d]),Se=void 0!==ve[0]?.[f],Ae=Se?Mb:ye,Ce=yb(()=>{if(Se)return ve.map((e,t)=>{const o="function"==typeof h?h(e):"string"==typeof h?e[h]:void 0,n=null==o?"line-"+t:o+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[Mb]:n,[f]:r.map(t=>({...t,[Mb]:n,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(ye){const e=ve.reduce((e,t)=>{const o="function"==typeof ye?ye(t):t[ye];if(!e[o]){const n={[f]:[]};"string"==typeof ye&&(n[ye]=o),ge&&(n[ob]=t[ob],"string"==typeof h&&(n[h]=t[h])),e[o]=n}return e[o][f].push(t),e},{});return Object.values(e)}return[{[f]:ve}]},[Se,ye,f,ve,h,ge]),{gapProcessedLineData:Me,hasGaps:_e}=yb(()=>{if("interpolate"===P){let e=!1;const t=[];for(const o of Ce){const n=(o[f]||[]).filter(t=>!we(t)||(e=!0,!1));n.length>0&&t.push({...o,[f]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===P){let e=!1;const t=[];for(const o of Ce){const n=o[f]||[];let r=[],i=0;const a=Ae&&"string"==typeof Ae?o[Ae]:void 0;for(const s of n)if(we(s))e=!0,r.length>0&&(t.push({...o,[f]:r}),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push({...s,_gapSegment:e})}r.length>0&&t.push({...o,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===P){let e=!1;const t="string"==typeof d?d:"y",o=[];for(const n of Ce){const r=n[f]||[],i=[];for(const o of r)we(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...n,[f]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ce,hasGaps:!1}},[Ce,P,f,we,Ae,d]),Pe="object"==typeof _?_:{},Re=Pe.position||"end",Le=Pe.fontSize||11,Te=yb(()=>{if(!_||!xe)return[];const e="function"==typeof xe?xe:e=>e[xe],t=new Set;for(const o of Me){const n=o[f]||[];if(0===n.length)continue;const r=e("end"===Re?n[n.length-1]:n[0])??e(o);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[_,xe,Me,f,Re]),$e=yb(()=>{if(!_)return n.marginDefaults;const e=Te.reduce((e,t)=>Math.max(e,t.length*(.6*Le)),0)+10,t="end"===Re?"right":"left";return{...n.marginDefaults,[t]:Math.max(n.marginDefaults[t]||0,e)}},[_,Te,Le,Re,n.marginDefaults]),Ie=Py({data:fe,rawData:r,colorBy:xe,colorScheme:m,legendInteraction:V,legendPosition:X,selection:E,linkedHover:B,fallbackFields:xe?["string"==typeof xe?xe:""]:[],unwrapData:!1,onObservation:F,onClick:H,hoverHighlight:z,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LineChart",chartId:W,showLegend:(!_||void 0!==re)&&re,userMargin:i,marginDefaults:$e,loading:j,loadingContent:Y,emptyContent:G,width:ee,height:te}),Ne=Ie.colorScale,De=Ie.effectiveSelectionHook,Ee=Ie.resolvedSelection,Be=Ie.customHoverBehavior,He=Ie.customClickBehavior,ze=Ie.crosshairProps,Oe=yb(()=>{if(xe)return Se?e=>{const t=e.parentLine||e;return"function"==typeof xe?xe(t):t[xe]}:xe},[xe,Se]),We=yb(()=>Ny(u,d),[u,d]),je=Ab({lineWidth:w,colorBy:Oe,colorScale:Ne,color:K,fillArea:x,areaOpacity:k,stroke:Z,strokeWidth:Q,opacity:J,effectiveSelectionHook:De,resolvedSelection:Ee,styleRules:g,ruleContext:We}),[Ye,Ge]=vb(null);xb(()=>{if(!L)return void Ge(null);let e=!1;return async function(...e){return(await rb()).createSegmentLineStyle(...e)}(je,L).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[je,L]);const Ve=Ye||je,Xe=yb(()=>{if(b)return e=>{const t={r:v,fillOpacity:1};return xe?Ne&&(t.fill=Fe(e.parentLine||e,xe,Ne)):t.fill=K||oy,t}},[b,v,xe,Ne,K]),qe=Array.isArray(x)?"mixed":x?"area":"line",Ue=yb(()=>{if(!_||!xe)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof d?d:e=>e[d],o="function"==typeof xe?xe:e=>e[xe],n=new Map;for(const e of Me){const t=e[f]||[];if(0===t.length)continue;const r="end"===Re?t[t.length-1]:t[0],i=o(r)??o(e);if(null==i)continue;const a=i+"";""===a||n.has(a)||n.set(a,r)}const r=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof u?u:"x"]:e(n),["string"==typeof d?d:"y"]:t(n),dx:"end"===Re?6:-6,dy:0,color:Ne?Ne(o):oy,fontSize:Le}));r.sort((e,t)=>{const o="string"==typeof d?d:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof d?d:"y",o=r[e-1],n=r[e];Le+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=Le+2)}return r},[_,xe,Ne,Me,f,u,d,Re,Le]),Ke=Ie.margin,Ze=h||p,Qe=yb(()=>$c([{label:ce||_c(u),accessor:u,role:"x",format:s},{label:ue||_c(d),accessor:d,role:"y",format:l},...Ze?[{label:_c(Ze),accessor:Ze,role:"group"}]:[],...Tc($,l)]),[u,d,ce,ue,Ze,s,l,$]),Je=xy({componentName:"LineChart",data:Se?fe[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:d}}),et=yb(()=>Se||Ae||_e?Me.flatMap(e=>{const t=e[f]||[];return Ae&&"string"==typeof Ae?t.map(t=>({...t,[Ae]:t[Ae]??e[Ae]})):t}):ve,[Me,f,Se,Ae,ve,_e]),tt={chartType:qe,...Array.isArray(x)&&{areaGroups:x},...S&&{lineGradient:S},...null!=r&&{data:et},xAccessor:u,yAccessor:d,xScaleType:q,yScaleType:U,...I&&{xExtent:I},...!N||null==N[0]&&null==N[1]?ke?{yExtent:ke}:{}:{yExtent:N},groupAccessor:"break"===P&&_e?"_gapSegment":Ae||void 0,...$&&{band:$},curve:y,lineStyle:Ve,...b&&{pointStyle:Xe},size:[ee,te],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ke,showAxes:n.showAxes,xLabel:ce,yLabel:ue,xFormat:s,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:oe,showGrid:ne,...Ie.legendBehaviorProps,...ie&&{title:ie},...ae&&{description:ae},...se&&{summary:se},...void 0!==le&&{accessibleTable:le},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===A?()=>null:"multi"===A?rl():il(A)||Qe,..."multi"===A&&{tooltipMode:"multi"},...Am({linkedHover:B,selection:E,onObservation:F,onClick:H,hoverRadius:O,hoverHighlight:z,mobileInteraction:Ie.mobileInteraction,customHoverBehavior:Be,customClickBehavior:He}),...C&&{pointIdAccessor:C},...(M?.length||pe.length||Ue.length)&&{annotations:[...M||[],...pe,...Ue]},...ze,...D};return Ie.earlyReturn?Ie.earlyReturn:Je?Cb(Tp,{componentName:"LineChart",message:Je,width:ee,height:te}):Cb(Ep,{componentName:"LineChart",width:ee,height:te,children:Cb(su,{ref:o,...tt})})});_b.displayName="LineChart";import{useMemo as Pb,forwardRef as Rb,useRef as Lb}from"react";import{useMemo as Tb}from"react";function $b(e){const{safeData:t,data:o,areaBy:n,lineDataAccessor:r,colorBy:i,colorScale:a,color:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:f,showLine:p,lineWidth:m,showPoints:g,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:k,xFormat:w,yFormat:S,groupField:A,styleRules:C,ruleContext:M}=e,_=void 0!==t[0]?.[r],P=Tb(()=>{if(null==o)return[];if(!_&&!n)return t;let e;if(_)e=t;else{const o=n,i=t.reduce((e,t)=>{const n="function"==typeof o?o(t):t[o];if(!e[n]){const t={[r]:[]};"string"==typeof o&&(t[o]=n),e[n]=t}return e[n][r].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[r]||[];return n&&"string"==typeof n?t.map(t=>({...t,[n]:e[n]})):t})},[o,t,n,r,_]),R=Tb(()=>e=>{const t={};if(i){if(a){const o=Fe(e,i,a);t.fill=o,p?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=s||oy;t.fill=e,p?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,Hy(e,C,M?M(e):{value:void 0})),t},[i,a,s,f,p,m,C,M]),L=Tb(()=>$y(R,{stroke:l,strokeWidth:c,opacity:u}),[R,l,c,u]);return{flattenedData:P,lineStyle:Tb(()=>Ig(L,d??null,h),[L,d,h]),pointStyle:Tb(()=>{if(g)return e=>{const t={r:y,fillOpacity:1};return i?a&&(t.fill=Fe(e.parentLine||e,i,a)):t.fill=s||oy,t}},[g,y,i,a,s]),defaultTooltipContent:Tb(()=>$c([{label:x||_c(b),accessor:b,role:"x",format:w},{label:k||_c(v),accessor:v,role:"y",format:S},...A?[{label:_c(A),accessor:A,role:"group"}]:[],...Tc(e.band,S)]),[b,v,x,k,A,w,S,e.band])}}import{jsx as Ib}from"react/jsx-runtime";function Nb(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Db=Rb(function(e,t){const o=Lb(null);Ly(t,{variant:"xy",frameRef:o});const n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,y0Accessor:h,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:y,styleRules:b,curve:v="monotoneX",areaOpacity:x=.7,lineGradient:k,showLine:w=!0,lineWidth:S=2,showPoints:A=!1,pointRadius:C=3,tooltip:M,annotations:_,forecast:P,anomaly:R,band:L,xExtent:$,yExtent:I,frameProps:N={},selection:D,linkedHover:E,onObservation:B,onClick:F,hoverHighlight:H,chartId:z,loading:O,loadingContent:W,emptyContent:j,legendInteraction:Y,legendPosition:G,color:V,stroke:X,strokeWidth:q,opacity:U}=e,{width:K,height:Z,enableHover:Q,showGrid:J,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:re,xLabel:ie,yLabel:ae}=n,se=Pb(()=>T(r),[r]),le=g||d,ce=Pb(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Nb(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);Op("AreaChart",se,"xAccessor",c),Op("AreaChart",se,"yAccessor",u);const ue=Py({data:se,rawData:r,colorBy:le,colorScheme:y,legendInteraction:Y,legendPosition:G,selection:D,linkedHover:E,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:B,onClick:F,hoverHighlight:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"AreaChart",chartId:z,showLegend:ee,userMargin:i,marginDefaults:n.marginDefaults,loading:O,loadingContent:W,emptyContent:j,width:K,height:Z}),{effectiveData:de,statisticalAnnotations:he}=sb({data:se,xAccessor:c,yAccessor:u,forecast:P,anomaly:R,groupBy:d}),fe=Pb(()=>Ny(c,u),[c,u]),{flattenedData:pe,lineStyle:me,pointStyle:ge,defaultTooltipContent:ye}=$b({safeData:de,data:r,areaBy:d,lineDataAccessor:m,colorBy:le,colorScale:ue.colorScale,color:V,stroke:X,strokeWidth:q,opacity:U,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:x,showLine:w,lineWidth:S,showPoints:A,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:ae,xFormat:s,yFormat:l,groupField:d||g,band:L,styleRules:b,ruleContext:fe}),be=xy({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),ve={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,...h&&{y0Accessor:h},...L&&{band:L},...ce&&{gradientFill:ce},...k&&{lineGradient:k},curve:v,lineStyle:me,...A&&ge&&{pointStyle:ge},size:[K,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:n.showAxes,xLabel:ie,yLabel:ae,xFormat:s,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...ue.legendBehaviorProps,...Sm({title:te,description:oe,summary:ne,accessibleTable:re,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:rl(),tooltipMode:"multi"}:Cm({tooltip:M,defaultTooltipContent:ye}),...Am({linkedHover:E,selection:D,onObservation:B,onClick:F,hoverHighlight:H,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...(_&&_.length>0||he.length>0)&&{annotations:[..._||[],...he]},...$&&{xExtent:$},...I&&{yExtent:I},...ue.crosshairProps,...N};return ue.earlyReturn?ue.earlyReturn:be?Ib(Tp,{componentName:"AreaChart",message:be,width:K,height:Z}):Ib(Ep,{componentName:"AreaChart",width:K,height:Z,children:Ib(su,{ref:o,...ve})})});Db.displayName="AreaChart";import{useMemo as Eb,forwardRef as Bb,useRef as Fb,useState as Hb,useImperativeHandle as zb,useCallback as Ob}from"react";import{jsx as Wb,jsxs as jb}from"react/jsx-runtime";function Yb(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Gb=Bb(function(e,t){const o=Fb(null),n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:d="b",seriesALabel:h="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:g=!0,lineWidth:y=1.5,showPoints:b=!1,pointRadius:v=3,curve:x="linear",areaOpacity:k=.6,gradientFill:w,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:_={},selection:P,linkedHover:R,onObservation:L,onClick:$,hoverHighlight:I,chartId:N,loading:D,loadingContent:E,emptyContent:B,legendInteraction:F,legendPosition:H,pointIdAccessor:z,windowSize:O}=e,{width:W,height:j,enableHover:Y,showGrid:G,showLegend:V,title:X,description:q,summary:U,accessibleTable:K,xLabel:Z,yLabel:Q}=n,J=Eb(()=>"function"==typeof c?e=>Yb(c(e)):e=>Yb(e[c]),[c]),ee=Eb(()=>"function"==typeof u?e=>Yb(u(e)):e=>Yb(e[u]),[u]),te=Eb(()=>"function"==typeof d?e=>Yb(d(e)):e=>Yb(e[d]),[d]),[oe,ne]=Hb([]),re=Fb([]),ie=null==r,ae=Eb(()=>T(ie?oe:r),[ie,oe,r]),se=Eb(()=>function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];let a=0,s=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,h=e=>i.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),m=o(i),g=n(i);if(!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(g))continue;const y=u(m,g);if(null!==y)if(null!=s){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=m-l.a-(g-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(m-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],s)}else for(const e of c)f(e,s);c=[],h({__x:p,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(s),__diffWinner:s,__valA:m,__valB:g,__sourceDatum:i}),l={x:p,a:m,b:g,w:y}}else{s=y;for(const e of c)f(e,s);c=[],h({__x:p,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(s),__diffWinner:s,__valA:m,__valB:g,__sourceDatum:i}),l={x:p,a:m,b:g,w:y}}else c.push({x:p,y:m,datum:i})}for(const e of c)f(e,s??"A");return i}(ae,J,ee,te),[ae,J,ee,te]),le=Eb(()=>g?function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];for(const e of r){const r=t(e),a=o(e),s=n(e);Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-B"})}return i}(ae,J,ee,te):[],[g,ae,J,ee,te]),ce=Eb(()=>[...se,...le],[se,le]),ue=Eb(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);zb(t,()=>{const e=e=>{const t=O&&e.length>O?e.slice(e.length-O):e;re.current=t,ne(t)},t=z?"function"==typeof z?z:e=>e[z]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],r=[],i=[];for(const e of re.current)n.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(o,n)=>{if(!t)return[];const r=Array.isArray(o)?o:[o],i=[],a=re.current.map(e=>{if(r.includes(t(e))){const t=n(e);return i.push(t),t}return e});return e(a),i},clear:()=>e([]),getData:()=>ie?re.current:ae,getScales:()=>o.current?.getScales()??null}},[ie,ae,z,O]);const de=Py({data:ae,rawData:r,colorBy:"__diffWinner",colorScheme:[p,m],legendInteraction:F,legendPosition:H,selection:P,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:N,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:D,loadingContent:E,emptyContent:B,width:W,height:j}),he=Eb(()=>{if(!1!==V)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:p},{label:f,color:m}]}]}},[V,h,f,p,m]),fe=Ob(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:m,stroke:"none",fillOpacity:k}},[p,m,k]),pe=Ob(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:m,strokeWidth:y,fill:"none"}),[p,m,y]),me=Ob(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:m,r:v}),[p,m,v]),ge=Ob(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=n&&(null==r||null==i)){const e=ae.find(e=>J(e)===n);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=s&&null!=n?s(n):null!=n?n+"":"";return jb("div",{className:"semiotic-tooltip",style:Js,children:[l&&Wb("div",{style:{fontWeight:600,marginBottom:4},children:l}),jb("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Wb("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),jb("span",{children:[h,": ",a(r)]})]}),jb("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Wb("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),jb("span",{children:[f,": ",a(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&jb("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(r-i)]})]})},[ae,J,ee,te,s,p,m,h,f]),ye="multi"===S,be=Eb(()=>!1===S?()=>null:ye?ge:il(S)||ge,[S,ye,ge]);if(de.earlyReturn)return de.earlyReturn;const ve={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:x,areaStyle:fe,lineStyle:pe,...b&&{pointStyle:me},size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:n.showAxes,xLabel:Z,yLabel:Q,xFormat:s,yFormat:l,enableHover:Y,showGrid:G,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...he&&{legend:he,legendPosition:de.legendPosition},...Sm({title:X,description:q,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:be,...ye&&{tooltipMode:"multi"},...Am({linkedHover:R,selection:P,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior}),...A&&A.length>0&&{annotations:A},...C&&{xExtent:C},...M&&{yExtent:M},...de.crosshairProps,..._};return Wb(Ep,{componentName:"DifferenceChart",width:W,height:j,children:Wb(su,{ref:o,...ve})})});"function"==typeof Gb&&(Gb.displayName="DifferenceChart");import{useMemo as Vb,forwardRef as Xb,useRef as qb}from"react";import{jsx as Ub}from"react/jsx-runtime";var Kb=Xb(function(e,t){const o=qb(null),n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,lineDataAccessor:h="coordinates",colorBy:f,colorScheme:p,styleRules:m,curve:g="monotoneX",areaOpacity:y=.7,showLine:b=!0,lineWidth:v=2,showPoints:x=!1,pointRadius:k=3,normalize:w=!1,baseline:S="zero",stackOrder:A,tooltip:C,annotations:M,xExtent:_,yExtent:P,frameProps:R={},selection:L,linkedHover:$,onObservation:I,onClick:N,hoverHighlight:D,chartId:E,loading:B,loadingContent:F,emptyContent:H,legendInteraction:z,legendPosition:O,color:W,stroke:j,strokeWidth:Y,opacity:G}=e,{width:V,height:X,enableHover:q,showGrid:U,showLegend:K,title:Z,description:Q,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=n,ne=Vb(()=>T(r),[r]),re=f||d;Ly(t,{variant:"xy",frameRef:o});const ie=Py({data:ne,rawData:r,colorBy:re,colorScheme:p,legendInteraction:z,legendPosition:O,selection:L,linkedHover:$,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:I,onClick:N,hoverHighlight:D,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedAreaChart",chartId:E,showLegend:K,userMargin:i,marginDefaults:n.marginDefaults,loading:B,loadingContent:F,emptyContent:H,width:V,height:X}),ae=Vb(()=>Ny(c,u),[c,u]),{flattenedData:se,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=$b({safeData:ne,data:r,areaBy:d,lineDataAccessor:h,colorBy:re,colorScale:ie.colorScale,color:W,stroke:j,strokeWidth:Y,opacity:G,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,areaOpacity:y,showLine:b,lineWidth:v,showPoints:x,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:te,yLabel:oe,xFormat:s,yFormat:l,groupField:d||f,styleRules:m,ruleContext:ae}),de=xy({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),he={chartType:"stackedarea",...null!=r&&{data:se},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,curve:g,normalize:w,baseline:w?"zero":S,stackOrder:A,lineStyle:le,...x&&ce&&{pointStyle:ce},size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,showAxes:n.showAxes,xLabel:te,yLabel:oe,xFormat:s,yFormat:l,enableHover:q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:U,...ie.legendBehaviorProps,...Sm({title:Z,description:Q,summary:J,accessibleTable:ee,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:rl(),tooltipMode:"multi"}:Cm({tooltip:C,defaultTooltipContent:ue}),...Am({linkedHover:$,selection:L,onObservation:I,onClick:N,hoverHighlight:D,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...M&&M.length>0&&{annotations:M},..._&&{xExtent:_},...P&&{yExtent:P},...ie.crosshairProps,...R};return ie.earlyReturn?ie.earlyReturn:de?Ub(Tp,{componentName:"StackedAreaChart",message:de,width:V,height:X}):Ub(Ep,{componentName:"StackedAreaChart",width:V,height:X,children:Ub(su,{ref:o,...he})})});Kb.displayName="StackedAreaChart";import{useMemo as Zb,forwardRef as Qb,useRef as Jb}from"react";import{scaleSequential as ev}from"d3-scale";import{jsx as tv}from"react/jsx-runtime";var ov=Qb(function(e,t){const o=Jb(null);Ly(t,{variant:"xy",frameRef:o});const r=my(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:i,margin:a,className:s,xAccessor:l="x",yAccessor:c="y",valueAccessor:u="value",xFormat:d,yFormat:h,colorScheme:f,customColorScale:p,showValues:m=!1,valueFormat:g,cellBorderColor:y="#fff",cellBorderWidth:b=1,tooltip:v,annotations:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:$,emptyContent:I,showLegend:N,legendPosition:D,legendInteraction:E}=e,{width:B,height:F,enableHover:H,title:z,description:O,summary:W,accessibleTable:j,xLabel:Y,yLabel:G}=r,V=zp(L,B,F,$),X=V?null:Hp(i,B,F,I),q=Zb(()=>T(i),[i]),U=function(){const e=Ug();return e?.colors?.sequential||void 0}(),K=f??U??"blues",Z=N??!1,Q=D??"right",{margin:J}=hy({data:q,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:Q,userMargin:a,defaults:r.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=uy({selection:A,linkedHover:C,fallbackFields:[],onObservation:M,onClick:_,chartType:"Heatmap",chartId:R,hoverHighlight:P,colorByField:void 0,mobileInteraction:r.mobileInteraction});_y(A);const ne=dy(C,oe);fy(E,void 0,[]);const re=Zb(()=>"function"==typeof u?e=>u(e):e=>e[u],[u]),ie=Zb(()=>{const e=q.map(re);return n(e)},[q,re]),ae=Zb(()=>{if("custom"===K&&p)return p;const e=Ce(K);return ev(e).domain(ie)},[K,p,ie]),se=Zb(()=>$c([{label:Y||_c(l),accessor:l,role:"x",format:d},{label:G||_c(c),accessor:c,role:"y",format:h},{label:_c(u),accessor:u,role:"value",format:g}]),[l,c,Y,G,u,d,h,g]),le=xy({componentName:"Heatmap",data:i,accessors:{xAccessor:l,yAccessor:c,valueAccessor:u}}),ce=Zb(()=>{if(Z)return{gradient:{colorFn:e=>ae(e),domain:ie,label:"string"==typeof u?u:"value",format:g}}},[Z,ae,ie,u,g]),ue={chartType:"heatmap",...null!=i&&{data:q},xAccessor:l,yAccessor:c,valueAccessor:u,colorScheme:"custom"!==K?K:void 0,showValues:m,heatmapValueFormat:g,size:[B,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:r.showAxes,xLabel:Y,yLabel:G,xFormat:d,yFormat:h,enableHover:H,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Q},...Sm({title:z,description:O,summary:W,accessibleTable:j,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:v,defaultTooltipContent:se}),...Am({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...x&&x.length>0&&{annotations:x},...k&&{xExtent:k},...w&&{yExtent:w},...ne,...S};return V||X||(le?tv(Tp,{componentName:"Heatmap",message:le,width:B,height:F}):tv(Ep,{componentName:"Heatmap",width:B,height:F,children:tv(su,{ref:o,...ue})}))});ov.displayName="Heatmap";import{useMemo as nv,useCallback as rv,forwardRef as iv,useRef as av}from"react";import{jsx as sv}from"react/jsx-runtime";var lv=iv(function(e,t){const o=av(null),n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:f,colorScheme:p,styleRules:m,bubbleOpacity:g=.6,bubbleStrokeWidth:y=1,bubbleStrokeColor:b="white",tooltip:v,marginalGraphics:x,pointIdAccessor:k,annotations:w,regression:S,xExtent:A,yExtent:C,frameProps:M={},selection:_,linkedHover:P,linkedBrush:R,onObservation:L,onClick:$,hoverHighlight:I,chartId:N,loading:D,loadingContent:E,emptyContent:B,legendInteraction:F,legendPosition:H,color:z,stroke:O,strokeWidth:W,opacity:j}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:q,title:U,description:K,summary:Z,accessibleTable:Q,xLabel:J,yLabel:ee}=n,te=nv(()=>T(r),[r]),oe=void 0===r,ne=Py({data:te,rawData:r,colorBy:f,colorScheme:p,legendInteraction:F,legendPosition:H,selection:_,linkedHover:P,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BubbleChart",chartId:N,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:D,loadingContent:E,emptyContent:B,width:Y,height:G}),{domain:re,trackPushed:ie,reset:ae}=Ky({accessor:d,data:te,isPushMode:oe}),se=rv(e=>{ie([e]),o.current?.push(e)},[ie]),le=rv(e=>{ie(e),o.current?.pushMany(e)},[ie]);Ly(t,{variant:"xy",frameRef:o,overrides:{push:se,pushMany:le,clear:()=>{ae(),o.current?.clear()}}});const ce=$g(R),ue=(hg({name:ce?.name||"__unused_brush__",xField:ce?.xField||("string"==typeof c?c:void 0),yField:ce?.yField||("string"==typeof u?u:void 0)}),nv(()=>({stroke:b,strokeWidth:y}),[b,y])),de=nv(()=>re??[0,1],[re]),he=rv(e=>Oe(e,d,h,de),[d,h,de]),fe=nv(()=>Ny(c,u),[c,u]),pe=Gy({colorBy:f,colorScale:ne.colorScale,color:z,fillOpacity:g,radiusFn:he,baseStyleExtras:ue,stroke:O,strokeWidth:W,opacity:j,styleRules:m,ruleContext:fe,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),me=nv(()=>$c([{label:J||_c(c),accessor:c,role:"x",format:s},{label:ee||_c(u),accessor:u,role:"y",format:l},{label:_c(d),accessor:d,role:"size"},...f?[{label:_c(f),accessor:f,role:"color"}]:[]]),[c,u,J,ee,d,f,s,l]);if(ne.earlyReturn)return ne.earlyReturn;const ge=xy({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(ge)return sv(Tp,{componentName:"BubbleChart",message:ge,width:Y,height:G});const ye=Zy(S),be=ye?[ye,...w||[]]:w,ve={chartType:"bubble",...null!=r&&{data:te},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:d,sizeRange:h,pointStyle:pe,colorScheme:p,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:n.showAxes,xLabel:J,yLabel:ee,xFormat:s,yFormat:l,enableHover:V,showGrid:X,...ne.legendBehaviorProps,...Sm({title:U,description:K,summary:Z,accessibleTable:Q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:v,defaultTooltipContent:me}),...Am({linkedHover:P,selection:_,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...x&&{marginalGraphics:x},...k&&{pointIdAccessor:k},...be&&be.length>0&&{annotations:be},...A&&{xExtent:A},...C&&{yExtent:C},...ne.crosshairProps,...M};return sv(Ep,{componentName:"BubbleChart",width:Y,height:G,children:sv(su,{ref:o,...ve})})});lv.displayName="BubbleChart";import*as cv from"react";import{useMemo as uv,useCallback as dv,useState as hv,useRef as fv,useEffect as pv}from"react";import{brush as mv}from"d3-brush";import{select as gv}from"d3-selection";import{jsx as yv,jsxs as bv}from"react/jsx-runtime";var vv="__splomIdx",xv={top:4,bottom:4,left:4,right:4};function kv({frameRef:e,cellSize:t,onBrush:o}){const n=fv(null),r=t-xv.left-xv.right,i=t-xv.top-xv.bottom;return pv(()=>{if(!n.current)return;const t=gv(n.current).select(".brush-g"),a=mv().extent([[0,0],[r,i]]).on("brush end",t=>{const n=e.current?.getScales();if(!n)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void o(null);var r;const[[i,a],[s,l]]=t.selection,c=[[n.x.invert(i),n.y.invert(a)],[n.x.invert(s),n.y.invert(l)]];o(c)});return t.call(a),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{a.on("brush end",null)}},[r,i,e,o]),yv("svg",{ref:n,width:t,height:t,style:{position:"absolute",top:0,left:0},children:yv("g",{className:"brush-g",transform:`translate(${xv.left},${xv.top})`})})}function wv({data:e,xField:t,yField:o,cellSize:n,pointRadius:r,pointOpacity:i,colorBy:a,colorScale:s,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:d,mode:h,onPointHover:f,onPointClick:p}){const m=fv(null),g=lg({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),y=hg({name:l,xField:t,yField:o}),b=lg({name:c,clientId:"splom-hover-source",fields:[vv]}),v=b.selectPoints,x=dv(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),k=dv(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[vv];void 0!==o&&(v({[vv]:[o]}),f?.(t,e.x+xv.left,e.y+xv.top))},[v,f]),w=dv(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+xv.left,e.y+xv.top)},[p]),S=dv(e=>{const t={opacity:i,r:r};return t.fill=a?Fe(e,a,s):oy,"hover"===h?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*i):g.isActive&&!g.predicate(e)&&(t.opacity=u),t},[i,r,a,h,s,b,g,u]);return bv("div",{style:{position:"relative",width:n,height:n},children:[yv(su,{ref:m,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:S,margin:xv,showAxes:!1,enableHover:"hover"===h,...Am({forceHoverBehavior:"hover"===h,forceClickBehavior:!!p,mobileInteraction:d,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&yv(kv,{frameRef:m,cellSize:n,xField:t,yField:o,onBrush:x})]})}function Sv({data:e,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=lg({name:c,clientId:"splom-diag-"+o,fields:[o]}),f=lg({name:u,clientId:`splom-diag-${o}-hover`,fields:[vv]}),p="hover"===d?f:h,m=p.isActive,g=p.predicate,y=uv(()=>{const r="string"==typeof s?s:null,l=[],c=new Set;for(const t of e){const e=t[o];if(null==e||isNaN(e)||l.push(Number(e)),r){const e=t[r];null!=e&&c.add(e+"")}}if(0===l.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[u,d]=n(l),h=(d-u)/a||1,f=Array.from(c),p=new Map(f.map((e,t)=>[e,t])),y=Array(a).fill(0),b=Array(a).fill(0),v=Array.from({length:a},()=>Array(f.length).fill(0)),x=Array.from({length:a},()=>Array(f.length).fill(0));for(const t of e){const e=t[o];if(null==e||isNaN(e))continue;const n=Math.min(Math.floor((e-u)/h),a-1);if(y[n]++,m&&!g(t)||b[n]++,r){const e=p.get(t[r]+"");void 0!==e&&(v[n][e]++,m&&!g(t)||x[n][e]++)}}const k=t(y,1),w=v.map((e,t)=>{let o=0;return e.map((e,n)=>{const r=e/k*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:o,category:f[n]};return o+=r,s})}),S=x.map((e,t)=>{let o=0;return e.map((e,n)=>{const r=e/k*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:o,category:f[n]};return o+=r,s})});return{bars:y.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/k*(i-24),count:e})),selectedBars:b.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/k*(i-24),count:e})),categoryBars:w,selectedCategoryBars:S,max:k,categories:f}},[e,o,a,i,m,g,s]);return bv("svg",{width:i,height:i,style:{overflow:"hidden"},children:[yv("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:r}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>yv("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:l?l(e.category):oy,opacity:m?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>yv("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:oy,opacity:m?.3:.6},"bg-"+t)),m&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>yv("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:l?l(e.category):oy,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>yv("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:oy,opacity:.7},"sel-"+t)))]})}function Av({label:e,cellSize:t}){return yv("svg",{width:t,height:t,children:yv("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Cv(e){const{data:t,fields:o,fieldLabels:n={},colorBy:r,colorScheme:i,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:m=!1,tooltip:g,showLegend:y,idAccessor:b,width:v,className:x,onObservation:k,onClick:w,chartId:S}=e,A="splom",C="splom-hover",M=iy(e.mobileInteraction,{mode:e.mode,width:v??o.length*a,mobileSemantics:e.mobileSemantics}),_=f?"hover":h?"brush":"hover",P=rg(e=>e.clearSelection),[R,L]=hv(null),T=dv(()=>{P(C),L(null)},[P,C]),$=uv(()=>(t||[]).map((e,t)=>void 0!==e[vv]?e:{...e,[vv]:t}),[t]),I=ly($,r,i),N=dv((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),D=void 0!==y?y:!!r,E=uv(()=>{if(!D||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set($.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:I?I(e+""):oy})):null},[D,r,$,I]),B=uv(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return bv("div",{className:x,style:{position:"relative"},children:[E&&yv("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:E.map(e=>bv("div",{style:{display:"flex",alignItems:"center",gap:4},children:[yv("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),yv("span",{style:{fontSize:11},children:e.label})]},e.label))}),bv("div",{style:B,onMouseLeave:"hover"===_?T:void 0,children:[o.map((e,t)=>bv(cv.Fragment,{children:[yv("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,i)=>t===i?"label"===u?yv(Av,{label:n[e]||e,cellSize:a},"diag-"+e):yv(Sv,{data:$,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:r,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:p,mode:_},"diag-"+e):yv(wv,{data:$,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:p,showGrid:m,tooltip:g,mobileInteraction:M,mode:_,onPointHover:"hover"===_?(n,r,a)=>{if(n){if(L({datum:n,xField:o,yField:e,colIndex:i,rowIndex:t,px:r??0,py:a??0}),k){const[e,o]=N(i,t,r,a);k({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else L(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:w||k?(e,o,n)=>{if(!e)return;const[r,a]=N(i,t,o,n);w&&w(e,{x:r,y:a}),k&&k({type:"click",datum:e,x:r,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),yv("div",{})," ",o.map(e=>yv("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),R&&"hover"===_&&(()=>{const e=R.datum,t=n[R.xField]||R.xField,o=n[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[vv];return bv("div",{style:{position:"absolute",left:40+R.colIndex*(a+s)+R.px,top:R.rowIndex*(a+s)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[yv("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),bv("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),bv("div",{children:[o,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&bv("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Mv(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),yv(Lg,{selections:n,children:yv(Cv,{...e})})}Mv.displayName="ScatterplotMatrix";import{useState as _v,useRef as Pv,useEffect as Rv,useMemo as Lv,useCallback as Tv}from"react";import{brushX as $v,brushY as Iv}from"d3-brush";import{select as Nv}from"d3-selection";import{jsx as Dv,jsxs as Ev}from"react/jsx-runtime";function Bv({width:e,height:t,margin:o,scales:n,brushDirection:r,extent:i,onBrush:a}){const s=Pv(null),l=Pv(null),c=Pv(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return Rv(()=>{if(!s.current||!n)return;const o=Nv(s.current).select(".brush-group"),i="x"===r?$v().extent([[0,0],[e,t]]):Iv().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void a(null);const o=("x"===r?n.x:n.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];a(i)}),o.call(i),l.current=e=>{o.call(i.move,e)},o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[n,e,t,r,a]),Rv(()=>{if(!l.current||!n||!s.current)return;const e="x"===r?n.x:n.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,n,r]),Dv("svg",{ref:s,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:Dv("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Fv(e){const{data:t,width:o=600,height:n=400,margin:r,className:i,title:a,description:s,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",lineBy:m,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:_,legendPosition:P,tooltip:R,minimap:L={},renderBefore:$=!1,onBrush:I,brushExtent:N,yExtent:D,frameProps:E={},loading:B,loadingContent:F,emptyContent:H}=e,z=zp(B,o,n,F),O=z?null:Hp(t,o,n,H),W=Lv(()=>T(t),[t]),[j,Y]=_v(null),G=N??j,V=Tv(e=>{N||Y(e),I?.(e)},[N,I]),X=Pv(null),[q,U]=_v(null);Rv(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=X.current?.getScales?.();n?U(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==W[0]?.[g],Z=Lv(()=>{if(K)return W;if(m){const e=W.reduce((e,t)=>{const o="function"==typeof m?m(t):t[m];if(!e[o]){const t={[g]:[]};"string"==typeof m&&(t[m]=o),e[o]=t}return e[o][g].push(t),e},{});return Object.values(e)}return[{[g]:W}]},[W,m,g,K]),Q=Lv(()=>K||m?Z.flatMap(e=>{const t=e[g]||[];return m&&"string"==typeof m?t.map(t=>({...t,[m]:e[m]})):t}):W,[Z,g,K,m,W]),J=ly(W,y,b),ee=Ab({lineWidth:x,colorBy:y,colorScale:J,fillArea:k,areaOpacity:w}),te=Lv(()=>{if(L.lineStyle)return L.lineStyle},[L.lineStyle]),oe=Ab({lineWidth:1,colorBy:y,colorScale:J}),ne=te??oe,re=Lv(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?Fe(e.parentLine||e,y,J):oy,t}},[S,A,y,J]),{legend:ie,margin:ae,legendPosition:se}=hy({data:Z,colorBy:y,colorScale:J,showLegend:_,legendPosition:P,userMargin:r}),le=L.height||60,ce=Lv(()=>({top:L.margin?.top??0,bottom:L.margin?.bottom??20,left:L.margin?.left??ae.left,right:L.margin?.right??ae.right}),[L.margin,ae]),ue=L.brushDirection||"x",de=Lv(()=>$c([{label:c||_c(f),accessor:f,role:"x",format:d},{label:u||_c(p),accessor:p,role:"y",format:h}]),[f,p,c,u,d,h]),he=xy({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(he)return Dv(Tp,{componentName:"MinimapChart",message:he,width:o,height:n});const fe=k?"area":"line",pe={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:v,lineStyle:ee,...S&&{pointStyle:re},size:[o,n],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:se},...a&&{title:a},...s&&{description:s},...l&&{summary:l},tooltipContent:!1===R?()=>null:il(R)||de,...G&&{xExtent:G},...D&&{yExtent:D},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...E},me={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:v,lineStyle:ne,size:[o,le+ce.top+ce.bottom],margin:ce,showAxes:L.showAxes??!1,background:L.background,enableHover:!1,...D&&{yExtent:D}},ge=Ev("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[Dv(su,{ref:X,...me}),Dv(Bv,{width:o-ce.left-ce.right,height:le,margin:ce,scales:q,brushDirection:ue,extent:G,onBrush:V})]},"minimap"),ye=Dv("div",{style:{overflow:"hidden"},children:Dv(su,{...pe})},"main");return z||O||Dv(Ep,{componentName:"MinimapChart",width:o,height:n,children:Ev("div",{className:"minimap-chart"+(i?" "+i:""),children:[$?ge:ye,$?ye:ge]})})}Fv.displayName="MinimapChart";import{useMemo as Hv,forwardRef as zv,useRef as Ov}from"react";var Wv={label:"Low / High",color:"#E9C46A",opacity:.08},jv={label:"High / High",color:"#2A9D8F",opacity:.08},Yv={label:"Low / Low",color:"#E76F51",opacity:.08},Gv={label:"High / Low",color:"#86BBD8",opacity:.08};import{Fragment as Vv,jsx as Xv,jsxs as qv}from"react/jsx-runtime";function Uv(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Kv=zv(function(e,t){const o=Ov(null);Ly(t,{variant:"xy",frameRef:o});const r=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",xCenter:h,yCenter:f,quadrants:p,centerlineStyle:m={},showQuadrantLabels:g=!0,quadrantLabelSize:y=12,colorBy:b,colorScheme:v,styleRules:x,sizeBy:k,sizeRange:w=[3,15],pointRadius:S=5,pointOpacity:A=.8,tooltip:C,pointIdAccessor:M,annotations:_,frameProps:P={},selection:R,linkedHover:L,onObservation:$,onClick:I,hoverHighlight:N,chartId:D,loading:E,loadingContent:B,emptyContent:F,legendInteraction:H,legendPosition:z,color:O,stroke:W,strokeWidth:j,opacity:Y}=e,{width:G,height:V,enableHover:X,showGrid:q,showLegend:U,title:K,description:Z,summary:Q,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=Hv(()=>({topLeft:Uv(Wv,p?.topLeft),topRight:Uv(jv,p?.topRight),bottomLeft:Uv(Yv,p?.bottomLeft),bottomRight:Uv(Gv,p?.bottomRight)}),[p]),ne=Hv(()=>T(i),[i]),re=Py({data:ne,rawData:i,colorBy:b,colorScheme:v,legendInteraction:H,legendPosition:z,selection:R,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:$,onClick:I,hoverHighlight:N,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:D,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:E,loadingContent:B,emptyContent:F,width:G,height:V});Op("QuadrantChart",ne,"xAccessor",u),Op("QuadrantChart",ne,"yAccessor",d);const ie=Hv(()=>{if(!ne.length)return;const e="function"==typeof u?u:e=>+e[u],t="function"==typeof d?d:e=>+e[d];let o=1/0,n=-1/0,r=1/0,i=-1/0;for(const a of ne){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>n&&(n=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(o>h&&(o=h),h>n&&(n=h)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),o===1/0)return;const a=.1*(n-o)||1,s=.1*(i-r)||1;return{xExtent:[o-a,n+a],yExtent:[r-s,i+s]}},[ne,u,d,h,f]),ae=Hv(()=>{if(!k||0===ne.length)return;const e=ne.map(e=>"function"==typeof k?k(e):e[k]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?n(e):void 0},[ne,k]),se=Hv(()=>"function"==typeof u?u:e=>+e[u],[u]),le=Hv(()=>"function"==typeof d?d:e=>+e[d],[d]),ce=Hv(()=>e=>{const t=se(e),o=le(e),n=null!=h?t>=h:void 0,r=null!=f?o>=f:void 0;return void 0===r||void 0===n?O||oy:r&&n?oe.topRight.color:r&&!n?oe.topLeft.color:!r&&n?oe.bottomRight.color:oe.bottomLeft.color},[se,le,h,f,oe,O]),ue=Hv(()=>k?e=>Oe(e,k,w,ae):void 0,[k,w,ae]),de=Hv(()=>Ny(u,d),[u,d]),he=Gy({colorBy:b,colorScale:re.colorScale,color:O,pointRadius:S,fillOpacity:A,radiusFn:ue,fallbackFill:ce,stroke:W,strokeWidth:j,opacity:Y,styleRules:x,ruleContext:de,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),fe=Hv(()=>{if(!ne.length)return;const e=new Set;"string"==typeof u&&e.add(u),"string"==typeof d&&e.add(d),"string"==typeof b&&e.add(b),"string"==typeof k&&e.add(k);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,u,d,b,k]),pe=Hv(()=>$c([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ee||_c(u),accessor:u,role:"x",format:l},{label:te||_c(d),accessor:d,role:"y",format:c},...b?[{label:_c(b),accessor:b,role:"color"}]:[],...k?[{label:_c(k),accessor:k,role:"size"}]:[]]),[fe,u,d,ee,te,b,k,l,c]),me=xy({componentName:"QuadrantChart",data:i,accessors:{xAccessor:u,yAccessor:d}}),ge=Hv(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray||[]};return[(t,o,n,r)=>{if(!n?.x||!n?.y)return;const i=r.width,a=r.height,s=null!=h?n.x(h):i/2,l=null!=f?n.y(f):a/2;if(null!=h&&!isFinite(s))return;if(null!=f&&!isFinite(l))return;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,l)),d=[{config:oe.topLeft,x:0,y:0,w:c,h:u},{config:oe.topRight,x:c,y:0,w:i-c,h:u},{config:oe.bottomLeft,x:0,y:u,w:c,h:a-u},{config:oe.bottomRight,x:c,y:u,w:i-c,h:a-u}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,f,oe,m]),ye=Hv(()=>g?[...ge,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const r=n.width,i=n.height,a=null!=h?o.x(h):r/2,s=null!=f?o.y(f):i/2;(null==h||isFinite(a))&&(null==f||isFinite(s))&&(e.font=`600 ${y}px sans-serif`,e.globalAlpha=.5,e.fillStyle=oe.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(oe.topLeft.label,8,8),e.fillStyle=oe.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(oe.topRight.label,r-8,8),e.fillStyle=oe.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(oe.bottomLeft.label,8,i-8),e.fillStyle=oe.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(oe.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:ge,[ge,g,y,oe,h,f]),be=Hv(()=>{const e=P.canvasPreRenderers||[];return[...ye,...e]},[ye,P.canvasPreRenderers]),ve=Hv(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray?Array.isArray(m.strokeDasharray)?m.strokeDasharray.join(","):m.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const r=n.width,i=n.height,a=null!=h?o.x(h):r/2,s=null!=f?o.y(f):i/2;if(null!=h&&!isFinite(a))return null;if(null!=f&&!isFinite(s))return null;const l=Math.max(0,Math.min(r,a)),c=Math.max(0,Math.min(i,s));return qv(Vv,{children:[[{config:oe.topLeft,x:0,y:0,w:l,h:c},{config:oe.topRight,x:l,y:0,w:r-l,h:c},{config:oe.bottomLeft,x:0,y:c,w:l,h:i-c},{config:oe.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?Xv("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),Xv("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),Xv("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),g&&qv(Vv,{children:[Xv("text",{x:8,y:8+y,fill:oe.topLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:oe.topLeft.label}),Xv("text",{x:r-8,y:8+y,fill:oe.topRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:oe.topRight.label}),Xv("text",{x:8,y:i-8,fill:oe.bottomLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:oe.bottomLeft.label}),Xv("text",{x:r-8,y:i-8,fill:oe.bottomRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:oe.bottomRight.label})]})]})}]},[h,f,oe,m,g,y]);if(re.earlyReturn)return re.earlyReturn;const xe={chartType:"scatter",...null!=i&&{data:ne},xAccessor:u,yAccessor:d,colorAccessor:b||void 0,sizeAccessor:k||void 0,sizeRange:w,pointStyle:he,colorScheme:v,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:l,yFormat:c,enableHover:X,showGrid:q,...ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent},...re.legendBehaviorProps,...K&&{title:K},...Z&&{description:Z},...Q&&{summary:Q},...void 0!==J&&{accessibleTable:J},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===C?()=>null:!0===C||void 0===C?pe:il(C)||pe,...Am({linkedHover:L,selection:R,onObservation:$,onClick:I,hoverHighlight:N,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&{pointIdAccessor:M},..._&&_.length>0&&{annotations:_},canvasPreRenderers:be,...re.crosshairProps,...P,...be.length>0&&{canvasPreRenderers:be},svgPreRenderers:ve};return me?Xv(Tp,{componentName:"QuadrantChart",message:me,width:G,height:V}):Xv(Ep,{componentName:"QuadrantChart",width:G,height:V,children:Xv(su,{ref:o,...xe})})});Kv.displayName="QuadrantChart";import*as Zv from"react";import{useMemo as Qv,useCallback as Jv,forwardRef as ex,useRef as tx,useImperativeHandle as ox}from"react";import{jsx as nx}from"react/jsx-runtime";var rx="__ma_unitized",ix="__ma_series";function ax(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function sx(e,t){return t[0]+e*(t[1]-t[0])}var lx=ex(function(e,t){const o=tx(null),n=tx([]),r=tx(e.series);r.current=e.series,ox(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],a=t.extent||n.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&o.current.push({...i,[rx]:ax(s,a),[ix]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const o=r[t],a=o.extent||n.current[t];if(!a)continue;const s=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[rx]:ax(s,a),[ix]:o.label||"Series "+(t+1)})}o.current.pushMany(i)},remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>o.current?.clear(),getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}},[]);const i=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:a,margin:s,className:l,xFormat:c,xAccessor:u="x",series:d,colorScheme:h,curve:f="monotoneX",lineWidth:p=2,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,stroke:R,strokeWidth:L,opacity:$}=e,{width:I,height:N,enableHover:D,showGrid:E,showLegend:B=!0,title:F,description:H,summary:z,accessibleTable:O,xLabel:W}=i,j=Qv(()=>T(a),[a]),Y=Qv(()=>T(d),[d]),G=Y,V=2===Y.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||V||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Y.length}. Rendering as a standard multi-line chart.`);const X=zp(A,I,N,C),q=X?null:Hp(a,I,N,M),U=ay(),K=Qv(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=Ie[h];e=Array.isArray(t)?t:Ne}return G.map((t,o)=>t.color||e[o%e.length])},[G,h,U]),Z=Qv(()=>Y.map((e,t)=>e.label||"Series "+(t+1)),[Y]),{unitizedData:Q,extents:J}=Qv(()=>{if(0===j.length){const e=Y.map(e=>e.extent||null).filter(Boolean);return e.length===Y.length&&(n.current=e),{unitizedData:[],extents:e.length===Y.length?e:[]}}const e=Y.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(j,e.yAccessor));if(n.current=e,!V){const t=[];for(const e of j)for(let o=0;Y.length>o;o++){const n=Y[o],r=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=r&&t.push({...e,[rx]:r,[ix]:Z[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of j)for(let n=0;2>n;n++){const r=Y[n],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(o);null!=i&&t.push({...o,[rx]:ax(i,e[n]),[ix]:Z[n]})}return{unitizedData:t,extents:e}},[j,Y,V,Z]),ee=Qv(()=>{if(V&&J.length>=2)return[{orient:"left",label:Z[0],tickFormat:Y[0].format||(e=>{const t=sx(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Z[1],tickFormat:Y[1].format||(e=>{const t=sx(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[V,J,Y,Z]),te=Py({data:Qv(()=>Q.length>0?Q:Z.map(e=>({[ix]:e})),[Q,Z]),rawData:a,colorBy:ix,colorScheme:K,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:[ix],unwrapData:!1,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:B,userMargin:s,marginDefaults:V?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:I,height:N}),oe=Qv(()=>{const e=new Map;return Z.forEach((t,o)=>e.set(t,K[o])),e},[Z,K]),ne=Ab({lineWidth:p,resolveStroke:Jv(e=>oe.get(e[ix])||K[0],[oe,K]),stroke:R,strokeWidth:L,opacity:$,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=Qv(()=>{if(!1===m)return()=>null;return il(m)||(e=>{const t=e.data||e,o=t[ix],n=Z.indexOf(o),r=t[rx],i=V&&n>=0&&J[n]?sx(r,J[n]):r,a=n>=0&&Y[n]?.format?Y[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof u?u(t):t[u];return Zv.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Zv.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[n]||"inherit"}},o),Zv.createElement("div",null,`${"string"==typeof u?u:"x"}: ${s}`),Zv.createElement("div",null,`${o}: ${a(i)}`))})},[m,Z,K,J,V,Y,u]);if(te.earlyReturn)return te.earlyReturn;const ie=xy({componentName:"MultiAxisLineChart",data:a,accessors:{xAccessor:u}}),ae=V?[0,1]:void 0,se={chartType:"line",...null!=a&&{data:Q},xAccessor:u,yAccessor:rx,groupAccessor:ix,lineStyle:ne,colorScheme:K,size:[I,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:W,...V?{}:{yLabel:Z[0]},xFormat:c,...V&&ae&&{yExtent:ae},enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:E,curve:f,...te.legendBehaviorProps,...F&&{title:F},...H&&{description:H},...z&&{summary:z},...void 0!==O&&{accessibleTable:O},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...g&&{annotations:g},...Am({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y};return X||q||(ie?nx(Tp,{componentName:"MultiAxisLineChart",message:ie,width:I,height:N}):nx(Ep,{componentName:"MultiAxisLineChart",width:I,height:N,children:nx(su,{ref:o,...se})}))});lx.displayName="MultiAxisLineChart";import{useMemo as cx,forwardRef as ux,useRef as dx}from"react";function hx(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}import{jsx as fx}from"react/jsx-runtime";var px=ux(function(e,t){const o=dx(null);Ly(t,{variant:"xy",frameRef:o});const n=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:d="low",openAccessor:h,closeAccessor:f,candlestickStyle:p,tooltip:m,annotations:g,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:_}=e,{width:P,height:R,enableHover:L,showGrid:$,title:I,description:N,summary:D,accessibleTable:E,xLabel:B,yLabel:F}=n,H=zp(C,P,R,M),z=H?null:Hp(r,P,R,_),O=cx(()=>T(r),[r]),W=null==h||null==f;Op("CandlestickChart",O,"xAccessor",c),Op("CandlestickChart",O,"highAccessor",u),Op("CandlestickChart",O,"lowAccessor",d),W||(Op("CandlestickChart",O,"openAccessor",h),Op("CandlestickChart",O,"closeAccessor",f));const{customHoverBehavior:j,customClickBehavior:Y,crosshairSourceId:G}=uy({selection:x,linkedHover:k,onObservation:w,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:n.mobileInteraction}),V=dy(k,G),X=cx(()=>{const t=n.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?o:{...o,...hx(i)}},[i,n.marginDefaults,e.mode]),q=cx(()=>{const e=[{label:B||_c(c),accessor:c,role:"x",format:s}];return W?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:d,format:l})):(e.push({label:"Open",accessor:h,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:d,format:l}),e.push({label:"Close",accessor:f,format:l})),$c(e)},[c,B,s,l,u,d,h,f,W]),U=xy({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!W&&{openAccessor:h,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:O},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!W&&{openAccessor:h,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(P/40))),extentPadding:P>200?.1:.02,size:[P,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X,showAxes:n.showAxes,xLabel:B,yLabel:F,xFormat:s,yFormat:l,enableHover:L,showGrid:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Sm({title:I,description:N,summary:D,accessibleTable:E,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:m,defaultTooltipContent:q}),...Am({linkedHover:k,selection:x,onObservation:w,onClick:S,mobileInteraction:n.mobileInteraction,customHoverBehavior:j,customClickBehavior:Y}),...g&&g.length>0&&{annotations:g},...y&&{xExtent:y},...b&&{yExtent:b},...V,...v};return H||z||(U?fx(Tp,{componentName:"CandlestickChart",message:U,width:P,height:R}):fx(Ep,{componentName:"CandlestickChart",width:P,height:R,children:fx(su,{ref:o,...K})}))});px.displayName="CandlestickChart";import{forwardRef as mx,useMemo as gx}from"react";import{useMemo as yx,useRef as bx}from"react";function vx(e){const t=bx(null);return Ly(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:yx(()=>hx(e.margin),[e.margin])}}function xx(e){const t=vx(e),{resolved:o,normalizedMargin:n}=t,r=Py({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:n,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}import{jsx as kx}from"react/jsx-runtime";var wx=mx(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,xExtent:a,yExtent:s,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:f,selection:p,linkedHover:m,chartId:g,loading:y,loadingContent:b,emptyContent:v,colorBy:x,colorScheme:k,frameProps:w={}}=e,{frameRef:S,resolved:A,safeData:C,setup:M,earlyReturn:_}=xx({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:x,colorScheme:k,selection:p,linkedHover:m,onObservation:h,onClick:f,chartId:g,loading:y,loadingContent:b,emptyContent:v,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),P=M.effectiveSelectionHook,R=gx(()=>P?.isActive?{isActive:!0,predicate:P.predicate}:null,[P?.isActive,P?.predicate]);if(_)return _;const{width:L,height:T,enableHover:$,showGrid:I,title:N,description:D,summary:E,accessibleTable:B,xLabel:F,yLabel:H}=A,z={chartType:"custom",...null!=o&&{data:C},customLayout:n,layoutConfig:r,onLayoutError:i,...R&&{layoutSelection:R},xExtent:a,yExtent:s,colorAccessor:x,colorScheme:k,size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:F,yLabel:H,enableHover:$,showGrid:I,...M.legendBehaviorProps,...Sm({title:N,description:D,summary:E,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...Am({linkedHover:m,selection:p,onObservation:h,onClick:f,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...d&&d.length>0&&{annotations:d},...M.crosshairProps,...w};return kx(Ep,{componentName:"XYCustomChart",width:L,height:T,children:kx(su,{ref:S,...z})})});wx.displayName="XYCustomChart";import{forwardRef as Sx,useMemo as Ax}from"react";import{jsx as Cx}from"react/jsx-runtime";var Mx=Sx(function(e,t){const{nodes:o,edges:n,layout:r,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:f,selection:p,linkedHover:m,onObservation:g,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=vx({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),C=Ax(()=>T(o),[o]),M=Ax(()=>T(n),[n]),_=Ax(()=>void 0===o&&void 0===n?void 0:[...C,...M],[n,o,M,C]),P=iy(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:R,customClickBehavior:L,activeSelectionHook:$}=uy({selection:p,linkedHover:m,fallbackFields:"string"==typeof h?[h]:[],onObservation:g,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:P}),I=Ax(()=>$?.isActive?{isActive:!0,predicate:$.predicate}:null,[$?.isActive,$?.predicate]),{width:N,height:D,enableHover:E,title:B,description:F,summary:H,accessibleTable:z}=S,O=zp(e.loading,N,D,e.loadingContent),W=O?null:Hp(_,N,D,e.emptyContent);if(O||W)return O||W;const j={chartType:"force",...null!=o&&{nodes:C},...null!=n&&{edges:M},customNetworkLayout:r,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,enableHover:E,...Sm({title:B,description:F,summary:H,accessibleTable:z,className:d,animate:e.animate,autoPlaceAnnotations:x}),...Am({linkedHover:m,selection:p,onObservation:g,onClick:y,mobileInteraction:P,customHoverBehavior:R,customClickBehavior:L,linkedHoverInClickPredicate:!1}),layoutSelection:I,...null!=v&&{annotations:v},...k};return Cx(Ep,{componentName:"NetworkCustomChart",width:N,height:D,children:Cx(wm,{ref:w,...j})})});Mx.displayName="NetworkCustomChart";import{forwardRef as _x,useMemo as Px}from"react";import{jsx as Rx}from"react/jsx-runtime";var Lx=_x(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:a="category",valueAccessor:s="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:p,showAxes:m=!1,annotations:g,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:_,safeData:P,setup:R,earlyReturn:L}=xx({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:f,colorScheme:p,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:k,loading:w,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),T=R.effectiveSelectionHook,$=Px(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(L)return L;const{width:I,height:N,enableHover:D,showGrid:E,title:B,description:F,summary:H,accessibleTable:z}=_,O={chartType:"custom",...null!=o&&{data:P},customLayout:n,layoutConfig:r,onLayoutError:i,...$&&{layoutSelection:$},oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:p,size:[I,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:D,showAxes:m,showGrid:E,annotations:g,...Sm({title:B,description:F,summary:H,accessibleTable:z,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Am({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...C};return Rx(Ep,{componentName:"OrdinalCustomChart",width:I,height:N,children:Rx(Yd,{ref:M,...O})})});Lx.displayName="OrdinalCustomChart";import{useMemo as Tx,forwardRef as $x,useRef as Ix}from"react";import{useImperativeHandle as Nx}from"react";function Dx({ref:e,frameRef:t,setup:o}){return Nx(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}import{useMemo as Ex}from"react";function Bx(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:a,userPieceStyle:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:m=!1,styleRules:g,resolveRuleValue:y}=e,b=Ex(()=>(e,s)=>{const l="function"==typeof p?p(e,s):p,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Fe(e,t,o)}else c.fill=sy(n,r,i,f?s:void 0,a);if(g&&g.length>0){const t=Hy(e,g,{value:y?y(e):void 0,category:s});Object.assign(c,t)}return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,a,f,p,m,g,y]),v=Ex(()=>$y(s?"function"==typeof s?(e,t)=>({...b(e,t),...s(e,t)||{}}):(e,t)=>({...b(e,t),...s}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,s,l,c,u]);return Ex(()=>Ig(v,d??null,h),[v,d,h])}import{jsx as Fx}from"react/jsx-runtime";var Hx=$x(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ix(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:p=40,roundedTop:m,gradientFill:g=!1,styleRules:y,baselinePadding:b=!1,tooltip:v,annotations:x,regression:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:$,emptyContent:I,legendInteraction:N,legendPosition:D,color:E,stroke:B,strokeWidth:F,opacity:H,showCategoryTicks:z,categoryFormat:O,dataIdAccessor:W}=e,{width:j,height:Y,enableHover:G,showGrid:V,showLegend:X,title:q,description:U,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:J}=o,ee=Tx(()=>T(r),[r]),te=Py({data:ee,rawData:r,colorBy:d,colorScheme:h,legendInteraction:N,legendPosition:D,selection:A,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:R,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:$,emptyContent:I,width:j,height:Y}),{effectiveLegendProps:oe,effectiveMargin:ne}=Dx({ref:t,frameRef:n,setup:te});Op("BarChart",ee,"categoryAccessor",s),Op("BarChart",ee,"valueAccessor",l);const re=cy(ee,f,l),ie=ay(),ae=Tx(()=>new Map,[]),se=Tx(()=>Iy(l),[l]),le=Bx({colorBy:d,colorScale:te.colorScale,color:E,themeCategorical:ie,colorScheme:h,categoryIndexMap:ae,userPieceStyle:S?.pieceStyle,stroke:B,strokeWidth:F,opacity:H,styleRules:y,resolveRuleValue:se,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=Tx(()=>Ic({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[s,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=xy({componentName:"BarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ue)return Fx(Tp,{componentName:"BarChart",message:ue,width:j,height:Y});const de=Zy(k),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[j,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,barPadding:p,...null!=m&&{roundedTop:m},...g&&{gradientFill:!0===g?{topOpacity:.8,bottomOpacity:.05}:g},...W&&{dataIdAccessor:W},baselinePadding:b,enableHover:G,showAxes:o.showAxes,oLabel:Q,rLabel:J,rFormat:u,...O&&{oFormat:O},showGrid:V,showCategoryTicks:z,oSort:f,...oe,...Sm({title:q,description:U,summary:K,accessibleTable:Z,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:v,defaultTooltipContent:ce}),...Am({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return Fx(Ep,{componentName:"BarChart",width:j,height:Y,children:Fx(Yd,{ref:n,...fe})})});Hx.displayName="BarChart";import{useMemo as zx,forwardRef as Ox,useRef as Wx}from"react";import{jsx as jx}from"react/jsx-runtime";var Yx=Ox(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Wx(null),{data:r,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:p=!1,sort:m=!1,barPadding:g=40,roundedTop:y,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:$,emptyContent:I,legendInteraction:N,legendPosition:D,color:E,stroke:B,strokeWidth:F,opacity:H,categoryFormat:z}=e,{width:O,height:W,enableHover:j,showGrid:Y,showLegend:G,title:V,description:X,summary:q,accessibleTable:U,categoryLabel:K,valueLabel:Z}=o,Q=zx(()=>T(r),[r]),J=h||l,ee=Py({data:Q,rawData:r,colorBy:J,colorScheme:f,legendInteraction:N,legendPosition:D,selection:A,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:R,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:$,emptyContent:I,width:O,height:W}),te=ay(),oe=zx(()=>new Map,[]),ne=zx(()=>Iy(c),[c]),re=Bx({colorBy:J,colorScale:ee.colorScale,color:E,themeCategorical:te,colorScheme:f,categoryIndexMap:oe,userPieceStyle:S?.pieceStyle,stroke:B,strokeWidth:F,opacity:H,styleRules:b,resolveRuleValue:ne,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=zx(()=>Ic({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),ae=xy({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:se,effectiveMargin:le}=Dx({ref:t,frameRef:n,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Q},oAccessor:s,rAccessor:c,stackBy:l,normalize:p,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:v,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...z&&{oFormat:z},showGrid:Y,...se,...Sm({title:V,description:X,summary:q,accessibleTable:U,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:x,defaultTooltipContent:ie}),...Am({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...k&&k.length>0&&{annotations:k},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ae?jx(Tp,{componentName:"StackedBarChart",message:ae,width:O,height:W}):jx(Ep,{componentName:"StackedBarChart",width:O,height:W,children:jx(Yd,{ref:n,...ce})})});Yx.displayName="StackedBarChart";import*as Gx from"react";import{useMemo as Vx,useCallback as Xx,forwardRef as qx,useRef as Ux,useImperativeHandle as Kx}from"react";import{useRef as Zx,useState as Qx,useCallback as Jx,useMemo as ek}from"react";import{useMemo as tk,useCallback as ok,useRef as nk}from"react";var rk={RdBu:Me,PiYG:_e,PRGn:Pe,BrBG:Re,RdYlBu:Le,RdYlGn:Te,Spectral:$e},ik="__likert_neutral_neg",ak="__likert_neutral_pos";function sk(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function lk(e,t,o,n,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=o(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of a){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],a=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/n*100,__likertLevelIndex:r})}}return l}function ck(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:ik,__likertPct:-e}),i.push({...t,__likertLevel:ak,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function uk(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const o of e)o.__likertLevel===ik?i=o:o.__likertLevel===ak?s=o:t.set(o.__likertLevelIndex,o);n&&i&&a.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&a.push(o)}n&&s&&a.push(s);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&a.push(o)}}return a}var dk=["Very Low","Low","Neutral","High","Very High"];import{jsx as hk}from"react/jsx-runtime";var fk=new Map,pk=qx(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ux(null),{data:r,margin:i,className:a,categoryAccessor:s="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=dk,orientation:h="horizontal",colorScheme:f,barPadding:p=20,tooltip:m,annotations:g,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:k,onClick:w,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,categoryFormat:T,stroke:$,strokeWidth:I,opacity:N}=e,{width:D,height:E,enableHover:B,showGrid:F,showLegend:H,title:z,description:O,summary:W,accessibleTable:j,categoryLabel:Y,valueLabel:G}=o,V="horizontal"===h,X=void 0===r,q=!c,U=function(){const e=Ug();return e?.colors?.diverging||void 0}(),K=Vx(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=rk[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);i&&s.push(r);for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);return s}(d.length,U),[f,d.length,U]),Z=Vx(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Q,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:r,countAccessor:i,isDiverging:a,frameRef:s}){const l=!r,c=tk(()=>sk(o,"question"),[o]),u=tk(()=>l?sk(n,"score"):null,[l,n]),d=tk(()=>l?null:sk(r,"level"),[l,r]),h=tk(()=>l?null:sk(i,"count"),[l,i]),f=nk([]);return{processedData:tk(()=>{const o=e||[];if(0===o.length)return[];let n=lk(o,t,c,u,d,h);return a&&(n=ck(n,t),n=uk(n,t)),n},[e,t,c,u,d,h,a]),reAggregate:ok(e=>{let o=lk(e,t,c,u,d,h);a&&(o=ck(o,t),o=uk(o,t)),s.current?.replace(o)},[t,c,u,d,h,a,s]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:s,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:V,frameRef:n}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=Zx(new Set),a=Zx([]),[s,l]=Qx(0),c=jm(),u=ay(),d=Jx(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=Jx(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=Jx(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=a.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),a.current=n,l(e=>e+1))},[e,t]),p=Jx(e=>t=>{h([t]),e(t)},[h]),m=Jx(e=>t=>{h(t),e(t)},[h]),g=Jx(()=>{i.current=new Set,a.current=[],l(e=>e+1)},[]);Mg(e&&t?a.current:[]);const y=ek(()=>{if(!e||!t||!1===n)return;const r=a.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:De,s="string"==typeof t?t:"__streamCat",l=r.map(e=>({[s]:e})),d=ze(l,s,i);return Tg({data:l,colorBy:s,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Fe})},[e,t,n,o,c,u,s]),b=ek(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:p,wrapPushMany:m,resetCategories:g,categories:a.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:X,colorBy:te,colorScheme:K,showLegend:H,legendPosition:L}),{wrapPush:ne,wrapPushMany:re}=oe,ie=Xx(e=>ne(e=>{ee.current.push(e),J(ee.current)})(e),[ne,J,ee]),ae=Xx(e=>re(e=>{ee.current.push(...e),J(ee.current)})(e),[re,J,ee]);Kx(t,()=>({push:ie,pushMany:ae,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ee.current=[],oe.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[ie,ae,ee,oe]);const se=Py({data:Q,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:L,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:H,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:D,height:E}),le=Vx(()=>{const e=d.length;return e%2!=0&&Z.get(d[Math.floor(e/2)])||"#888"},[d,Z]),ce=Bx({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:fk,userPieceStyle:b?.pieceStyle,stroke:$,strokeWidth:I,opacity:N,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===ik||o===ak)return{fill:le};const n=t||o;return n&&Z.has(n)?{fill:Z.get(n)}:{fill:"#888"}}}),ue=Vx(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),de=Vx(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===ik||o===ak?ue:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),a=o===ik||o===ak?2*i:i,s=t.__likertCount||0;return Gx.createElement("div",{className:"semiotic-tooltip",style:Js},Gx.createElement("div",{style:{fontWeight:"bold"}},r),Gx.createElement("div",{style:{marginTop:4}},`${n}: ${a.toFixed(1)}% (n=${s})`))},[ue]),he=Vx(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:s};return q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),xy({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,s,l,c,u,d,q]),fe=Vx(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Z]),pe=Vx(()=>!1!==H?{...se.legendBehaviorProps,legend:{legendGroups:fe},legendPosition:L||se.legendPosition||"bottom"}:se.legendBehaviorProps,[se.legendBehaviorProps,se.legendPosition,L,H,fe]),me=Vx(()=>{const e={...se.margin};if(X&&!1!==H){const t=L||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(oe.streamingMarginAdjust)for(const[t,o]of Object.entries(oe.streamingMarginAdjust))o>e[t]&&(e[t]=o);return V&&100>e.left&&(e.left=100),e},[se.margin,oe.streamingMarginAdjust,V,X,H,L]),ge=Vx(()=>C||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,C]);if(se.earlyReturn)return se.earlyReturn;const ye={chartType:"bar",...null!=r&&{data:Q},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:ce,size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:p,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Y,rLabel:G||(V?void 0:"Percentage"),rFormat:ge,...T&&{oFormat:T},showGrid:F,...pe,...z&&{title:z},...O&&{description:O},...W&&{summary:W},...void 0!==j&&{accessibleTable:j},...a&&{className:a},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===m?()=>null:!0===m?de:il(m)||de,...Am({linkedHover:x,selection:v,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:se.mobileInteraction,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior}),...g&&g.length>0&&{annotations:g},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return he?hk(Tp,{componentName:"LikertChart",message:he,width:D,height:E}):hk(Ep,{componentName:"LikertChart",width:D,height:E,children:hk(Yd,{ref:n,...ye})})});pk.displayName="LikertChart";import{useMemo as mk,forwardRef as gk,useRef as yk}from"react";import{useCallback as bk,useRef as vk}from"react";function xk({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=$g("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),i="string"==typeof n?n:"value",a=hg({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||i}),s=vk(a.brushInteraction);s.current=a.brushInteraction;const l=bk(e=>{if(r){s.current.end(e?e.r:null)}t?.(e)},[t,r]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}import{jsx as kk}from"react/jsx-runtime";var wk=gk(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=yk(null);Ly(t,{variant:"xy",frameRef:r});const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sizeBy:p,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:S,brush:A,onBrush:C,linkedBrush:M,frameProps:_={},selection:P,linkedHover:R,onObservation:L,onClick:$,hoverHighlight:I,chartId:N,loading:D,loadingContent:E,emptyContent:B,legendInteraction:F,legendPosition:H,color:z,stroke:O,strokeWidth:W,opacity:j,showCategoryTicks:Y,categoryFormat:G}=e,{width:V,height:X,enableHover:q,showGrid:U,showLegend:K,title:Z,description:Q,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,ne=mk(()=>T(i),[i]),re=Py({data:ne,rawData:i,colorBy:h,colorScheme:f,legendInteraction:F,legendPosition:H,selection:P,linkedHover:R,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:N,showLegend:K,userMargin:a,marginDefaults:o.marginDefaults,loading:D,loadingContent:E,emptyContent:B,width:V,height:X}),ie=xk({brushProp:A,onBrushProp:C,linkedBrush:M,valueAccessor:c}),ae=mk(()=>{if(!p)return;const e=ne.map(e=>"function"==typeof p?p(e):e[p]);return n(e)},[ne,p]),se=ay(),le=mk(()=>new Map,[]),ce=Bx({colorBy:h,colorScale:re.colorScale,color:z,themeCategorical:se,colorScheme:f,categoryIndexMap:le,userPieceStyle:_?.pieceStyle,stroke:O,strokeWidth:W,opacity:j,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:p?Oe(e,p,m,ae):b})}),ue=mk(()=>Ic({categoryAccessor:l,valueAccessor:c,groupAccessor:h||void 0,valueFormat:d}),[l,c,h,d]);if(re.earlyReturn)return re.earlyReturn;const de=xy({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(de)return kk(Tp,{componentName:"SwarmPlot",message:de,width:V,height:X});const he={chartType:"swarm",...null!=i&&{data:ne},oAccessor:l,rAccessor:c,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:d,...G&&{oFormat:G},showGrid:U,showCategoryTicks:Y,...re.legendBehaviorProps,...Sm({title:Z,description:Q,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:k,defaultTooltipContent:ue}),...Am({linkedHover:R,selection:P,onObservation:L,onClick:$,hoverHighlight:I,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...w&&w.length>0&&{annotations:w},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e))};return kk(Ep,{componentName:"SwarmPlot",width:V,height:X,children:kk(Yd,{ref:r,...he})})});wk.displayName="SwarmPlot";import{useMemo as Sk,forwardRef as Ak,useRef as Ck}from"react";import{jsx as Mk,jsxs as _k}from"react/jsx-runtime";function Pk(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return _k("div",{className:"semiotic-tooltip",style:Js,children:[o&&Mk("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&_k("div",{children:["n = ",n.n]}),null!=n.min&&_k("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&_k("div",{children:["Q1: ",n.q1.toLocaleString()]}),_k("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&_k("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&_k("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&_k("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,a=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return _k("div",{className:"semiotic-tooltip",style:Js,children:[o&&Mk("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&_k("div",{children:["n = ",i]}),null!=a&&_k("div",{children:["Median: ",a.toLocaleString()]})]})}return Mk("div",{className:"semiotic-tooltip",style:Js,children:Mk("div",{style:{fontWeight:"bold"},children:o+""})})}}import{jsx as Rk}from"react/jsx-runtime";var Lk=Ak(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ck(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:p=3,categoryPadding:m=20,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:$,stroke:I,strokeWidth:N,opacity:D,showCategoryTicks:E,categoryFormat:B}=e,{width:F,height:H,enableHover:z,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:q}=o,U=Sk(()=>T(r),[r]),K=Py({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:R,legendPosition:L,selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:F,height:H}),Z=ay(),Q=Sk(()=>new Map,[]),J=Bx({colorBy:d,colorScale:K.colorScale,color:$,themeCategorical:Z,colorScheme:h,categoryIndexMap:Q,userPieceStyle:void 0,stroke:I,strokeWidth:N,opacity:D,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=Sk(()=>Pk(),[]);if(K.earlyReturn)return K.earlyReturn;const te=xy({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Rk(Tp,{componentName:"BoxPlot",message:te,width:F,height:H});const oe={chartType:"boxplot",...null!=r&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[F,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:q,rFormat:u,...B&&{oFormat:B},showGrid:O,showCategoryTicks:E,...K.legendBehaviorProps,...Sm({title:j,description:Y,summary:G,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:g,defaultTooltipContent:ee}),...Am({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return Rk(Ep,{componentName:"BoxPlot",width:F,height:H,children:Rk(Yd,{ref:n,...oe})})});Lk.displayName="BoxPlot";import{useMemo as Tk,forwardRef as $k,useRef as Ik}from"react";import{jsx as Nk,jsxs as Dk}from"react/jsx-runtime";var Ek=e=>{const t=e?.category;return null==t?"All":t+""},Bk=$k(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ik(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s=Ek,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:p=20,tooltip:m,annotations:g,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:$,legendPosition:I,color:N,stroke:D,strokeWidth:E,opacity:B,showCategoryTicks:F,categoryFormat:H}=e,{width:z,height:O,enableHover:W,showGrid:j,showLegend:Y,title:G,description:V,summary:X,accessibleTable:q,categoryLabel:U,valueLabel:K}=o,Z=Tk(()=>T(r),[r]),Q=Py({data:Z,rawData:r,colorBy:h,colorScheme:f,legendInteraction:$,legendPosition:I,selection:w,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:L,width:z,height:O}),J=xk({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=Tk(()=>{if(0===Z.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const n of Z){const r=e(n);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[Z,l]),te=ay(),oe=Tk(()=>new Map,[]),ne=Bx({colorBy:h,colorScale:Q.colorScale,color:N,themeCategorical:te,colorScheme:f,categoryIndexMap:oe,userPieceStyle:void 0,stroke:D,strokeWidth:E,opacity:B,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=Tk(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return Dk("div",{className:"semiotic-tooltip",style:Js,children:[o&&Nk("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&Dk("div",{children:["Count: ",n]}),r&&2===r.length&&Dk("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const ie=xy({componentName:"Histogram",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ie)return Nk(Tp,{componentName:"Histogram",message:ie,width:z,height:O});const ae={chartType:"histogram",...null!=r&&{data:Z},oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:ne,bins:c,normalize:u,...y?{rExtent:y}:ee&&{rExtent:ee},size:[z,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:p,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...H&&{oFormat:H},showGrid:j,showCategoryTicks:F,...Q.legendBehaviorProps,...Sm({title:G,description:V,summary:X,accessibleTable:q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:m,defaultTooltipContent:re}),...Am({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior}),...g&&g.length>0&&{annotations:g},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return Nk(Ep,{componentName:"Histogram",width:z,height:O,children:Nk(Yd,{ref:n,...ae})})});Bk.displayName="Histogram";import{useMemo as Fk,forwardRef as Hk,useRef as zk}from"react";import{jsx as Ok}from"react/jsx-runtime";var Wk=Hk(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=zk(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:p,colorScheme:m,categoryPadding:g=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:k,linkedBrush:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:$,emptyContent:I,legendInteraction:N,legendPosition:D,color:E,stroke:B,strokeWidth:F,opacity:H,showCategoryTicks:z,categoryFormat:O}=e,{width:W,height:j,enableHover:Y,showGrid:G,showLegend:V,title:X,description:q,summary:U,accessibleTable:K,categoryLabel:Z,valueLabel:Q}=o,J=Fk(()=>T(r),[r]),ee=Py({data:J,rawData:r,colorBy:p,colorScheme:m,legendInteraction:N,legendPosition:D,selection:A,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:$,emptyContent:I,width:W,height:j}),te=xk({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:l}),oe=ay(),ne=Fk(()=>new Map,[]),re=Bx({colorBy:p,colorScale:ee.colorScale,color:E,themeCategorical:oe,colorScheme:m,categoryIndexMap:ne,userPieceStyle:void 0,stroke:B,strokeWidth:F,opacity:H,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=Fk(()=>Pk({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const ae=xy({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ae)return Ok(Tp,{componentName:"ViolinPlot",message:ae,width:W,height:j});const se={chartType:"violin",...null!=r&&{data:J},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:h,size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:g,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Z,rLabel:Q,rFormat:f,...O&&{oFormat:O},showGrid:G,showCategoryTicks:z,...ee.legendBehaviorProps,...Sm({title:X,description:q,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:y,defaultTooltipContent:ie}),...Am({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return Ok(Ep,{componentName:"ViolinPlot",width:W,height:j,children:Ok(Yd,{ref:n,...se})})});Wk.displayName="ViolinPlot";import{useMemo as jk,forwardRef as Yk,useRef as Gk}from"react";import{jsx as Vk}from"react/jsx-runtime";var Xk=Yk(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Gk(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:p,categoryPadding:m=5,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:$,stroke:I,strokeWidth:N,opacity:D,showCategoryTicks:E,categoryFormat:B}=e,{width:F,height:H,enableHover:z,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:q}=o,U=jk(()=>T(r),[r]),K=Py({data:U,rawData:r,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:L,selection:x,linkedHover:k,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:F,height:H}),Z=ay(),Q=jk(()=>new Map,[]),J=Bx({colorBy:f,colorScale:K.colorScale,color:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:Q,userPieceStyle:void 0,stroke:I,strokeWidth:N,opacity:D,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=jk(()=>Pk(),[]);if(K.earlyReturn)return K.earlyReturn;const te=xy({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Vk(Tp,{componentName:"RidgelinePlot",message:te,width:F,height:H});const oe={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[F,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:q,rFormat:h,...B&&{oFormat:B},showGrid:O,showCategoryTicks:E,oSort:!1,amplitude:d,...K.legendBehaviorProps,...Sm({title:j,description:Y,summary:G,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:g,defaultTooltipContent:ee}),...Am({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return Vk(Ep,{componentName:"RidgelinePlot",width:F,height:H,children:Vk(Yd,{ref:n,...oe})})});Xk.displayName="RidgelinePlot";import{useMemo as qk,forwardRef as Uk,useRef as Kk}from"react";import{jsx as Zk,jsxs as Qk}from"react/jsx-runtime";var Jk=Uk(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Kk(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,stepAccessor:s="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:p=!0,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:$,opacity:I,categoryFormat:N}=e,D="vertical"===h,{width:E,height:B,enableHover:F,showLegend:H,title:z,description:O,summary:W,accessibleTable:j}=o,Y=D?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},G=qk(()=>T(r),[r]),V=u||c,X=!V,q=Py({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:H,userMargin:i,marginDefaults:Y,loading:A,loadingContent:C,emptyContent:M,width:E,height:B});Op("FunnelChart",G,"stepAccessor",s),Op("FunnelChart",G,"valueAccessor",l);const U=ay(),K=qk(()=>new Map,[]),Z=qk(()=>{if(X)return R||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[X,R,U,d]),Q=Bx({colorBy:Z?void 0:V,colorScale:q.colorScale,color:Z??R,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:$,opacity:I,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection}),J=qk(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,a=t?.__barFunnelIsDropoff,s=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return Qk("div",{className:"semiotic-tooltip",style:Js,children:[o&&Zk("div",{style:{fontWeight:"bold"},children:o+""}),s&&s!==o&&Zk("div",{style:{marginTop:2,opacity:.8},children:s+""}),a&&Zk("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),Qk("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(q.earlyReturn)return q.earlyReturn;const ee=xy({componentName:"FunnelChart",data:r,accessors:{stepAccessor:s,valueAccessor:l}});if(ee)return Zk(Tp,{componentName:"FunnelChart",message:ee,width:E,height:B});const te={chartType:D?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:s,rAccessor:l,...c&&{stackBy:c},projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:Q,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:D,showCategoryTicks:D,...N&&{oFormat:N},showGrid:D,...!D&&{connectorOpacity:f},showLabels:p,...q.legendBehaviorProps,...z&&{title:z},...O&&{description:O},...W&&{summary:W},...void 0!==j&&{accessibleTable:j},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===m?()=>null:!0===m||null==m?J:il(m)||J,...Am({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return Zk(Ep,{componentName:"FunnelChart",width:E,height:B,children:Zk(Yd,{ref:n,...te})})});Jk.displayName="FunnelChart";import{useMemo as ew,forwardRef as tw,useRef as ow}from"react";import{jsx as nw}from"react/jsx-runtime";var rw=tw(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=ow(null);Ly(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:p=5,categoryPadding:m=10,tooltip:g,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:$,color:I,stroke:N,strokeWidth:D,opacity:E,categoryFormat:B}=e,{width:F,height:H,enableHover:z,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:q}=o,U=ew(()=>T(r),[r]),K=Py({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:$,selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:F,height:H}),Z=cy(U,f,l),Q=ay(),J=ew(()=>new Map,[]),ee=Bx({colorBy:d,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:N,strokeWidth:D,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:p,fillOpacity:.8}}),te=ew(()=>Ic({categoryAccessor:s,valueAccessor:l,valueFormat:u}),[s,l,u]);if(K.earlyReturn)return K.earlyReturn;const oe=xy({componentName:"DotPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(oe)return nw(Tp,{componentName:"DotPlot",message:oe,width:F,height:H});const ne=Zy(b),re=ne?[ne,...y||[]]:y,ie={chartType:"point",...null!=r&&{data:Z},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[F,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:q,rFormat:u,...B&&{oFormat:B},showGrid:O,oSort:f,...K.legendBehaviorProps,...Sm({title:j,description:Y,summary:G,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:g,defaultTooltipContent:te}),...Am({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return nw(Ep,{componentName:"DotPlot",width:F,height:H,children:nw(Yd,{ref:n,...ie})})});rw.displayName="DotPlot";import{useMemo as iw,forwardRef as aw,useRef as sw}from"react";import{jsx as lw}from"react/jsx-runtime";var cw=aw(function(e,t){const o=my(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=sw(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:p,frameProps:m={},selection:g,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:_,stroke:P,strokeWidth:R,opacity:L}=e,{width:$,height:I,enableHover:N,showLegend:D,title:E,description:B,summary:F,accessibleTable:H}=o,z=iw(()=>T(r),[r]),O=c||s,W=Py({data:z,rawData:r,colorBy:O,colorScheme:u,legendInteraction:C,legendPosition:M,selection:g,linkedHover:y,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:D,userMargin:i,marginDefaults:o.marginDefaults,loading:w,loadingContent:S,emptyContent:A,width:$,height:I}),j=ay(),Y=iw(()=>new Map,[]),G=Bx({colorBy:O,colorScale:W.colorScale,color:_,themeCategorical:j,colorScheme:u,categoryIndexMap:Y,userPieceStyle:m?.pieceStyle,stroke:P,strokeWidth:R,opacity:L,effectiveSelectionHook:W.effectiveSelectionHook,resolvedSelection:W.resolvedSelection,cycleByCategory:!0}),V=iw(()=>Ic({categoryAccessor:s,valueAccessor:l,groupAccessor:c&&c!==s?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[s,l,c]),X=xy({componentName:"PieChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:q,effectiveMargin:U}=Dx({ref:t,frameRef:n,setup:W});if(W.earlyReturn)return W.earlyReturn;const K={chartType:"pie",...null!=r&&{data:z},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=h&&{cornerRadius:h},size:[$,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...q,...Sm({title:E,description:B,summary:F,accessibleTable:H,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:f,defaultTooltipContent:V}),...Am({linkedHover:y,selection:g,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(m).filter(([e])=>"pieceStyle"!==e))};return X?lw(Tp,{componentName:"PieChart",message:X,width:$,height:I}):lw(Ep,{componentName:"PieChart",width:$,height:I,children:lw(Yd,{ref:n,...K})})});cw.displayName="PieChart";import{useMemo as uw,forwardRef as dw,useRef as hw}from"react";import{jsx as fw}from"react/jsx-runtime";var pw=dw(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=hw(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:p,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:$,opacity:I}=e,{width:N,height:D,enableHover:E,showLegend:B,title:F,description:H,summary:z,accessibleTable:O}=o,W=uw(()=>T(r),[r]),j=d||s,Y=Py({data:W,rawData:r,colorBy:j,colorScheme:h,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:B,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:N,height:D}),G=c??Math.max(2,.15*Math.min(N,D)),V=ay(),X=uw(()=>new Map,[]),q=Bx({colorBy:j,colorScale:Y.colorScale,color:R,themeCategorical:V,colorScheme:h,categoryIndexMap:X,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:$,opacity:I,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection,cycleByCategory:!0}),U=uw(()=>Ic({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[s,l,d]),K=xy({componentName:"DonutChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Z,effectiveMargin:Q}=Dx({ref:t,frameRef:n,setup:Y});if(Y.earlyReturn)return Y.earlyReturn;const J={chartType:"donut",...null!=r&&{data:W},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:q,innerRadius:G,startAngle:f,...null!=p&&{cornerRadius:p},centerContent:u,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Z,...Sm({title:F,description:H,summary:z,accessibleTable:O,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:m,defaultTooltipContent:U}),...Am({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return K?fw(Tp,{componentName:"DonutChart",message:K,width:N,height:D}):fw(Ep,{componentName:"DonutChart",width:N,height:D,children:fw(Yd,{ref:n,...J})})});pw.displayName="DonutChart";import{useMemo as mw,forwardRef as gw,useRef as yw}from"react";function bw(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function vw(e){return Math.max(0,Math.min(1,e))}function xw(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function kw(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function ww(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:vw(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=vw(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>n||n>r.offset)continue;const i=r.offset-t.offset,a=i>0?(n-t.offset)/i:0,s=xw(t.color),l=xw(r.color);if(!s||!l)return.5>a?t.color:r.color;const[c,u,d]=s,[h,f,p]=l;return kw(c+(h-c)*a,u+(f-u)*a,d+(p-d)*a)}return o[o.length-1].color}function Sw(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}import{jsx as Aw,jsxs as Cw}from"react/jsx-runtime";var Mw=gw(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),r=yw(null),i="context"===e.mode,{compactMode:a}=o,{value:s,min:l=0,max:c=100,thresholds:u,gradientFill:d,color:h,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:b,valueFormat:v,showScaleLabels:x=!a,sweep:k=240,fillZones:w=!0,tooltip:S,annotations:A,frameProps:C={},className:M,stroke:_,strokeWidth:P,opacity:R}=e,{width:L,height:T,title:$,description:I,summary:N,accessibleTable:D}=o,E=d&&"object"==typeof d?d:void 0,B=Math.max(l,Math.min(c,s)),F=c-l||1,H=(B-l)/F,{gaugeData:z,pieceStyle:O,gaugeAnnotations:W}=mw(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const p=!!c&&c.colorStops.length>=2,m=[],g=new Map,y=[];if(p){const e=s?h:1,t=Sw("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),g.set(t,{fill:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(ww(c.colorStops,e*(t+.5)/o));const r=Sw("fill",0);m.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),g.set(r,{fill:n[0]||a})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-i),u=s?Math.max(0,r-c):0;if(c>0){const e=Sw("fill",o);m.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),g.set(e,{fill:n.color})}if(u>0){const e=Sw("bg",o);m.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),g.set(e,{fill:a,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>g.get(t||e.category)||{fill:a},gaugeAnnotations:y}}({min:l,max:c,value:s,thresholds:u,fillColor:h,backgroundColor:f,fillZones:w,showScaleLabels:x,gradientFill:E}),[s,l,c,u,h,f,x,w,E]),j=mw(()=>$y(O,{stroke:_,strokeWidth:P,opacity:R}),[O,_,P,R]),{sweepRad:Y,startAngleDeg:G}=bw(k),V=function(e=240){const{sweepRad:t,offsetRad:o}=bw(e),r=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||r.push([Math.cos(e),Math.sin(e)]);const i=r.map(e=>e[0]),a=r.map(e=>e[1]),[s,l]=n(i),[c,u]=n(a);return{minX:s,maxX:l,minY:c,maxY:u,width:l-s,height:u-c,cx:(s+l)/2,cy:(c+u)/2}}(k),X=Math.min(10,Math.max(1,Math.min(L,T)/12)),q=V.cx,U=V.cy,K=Math.max(4,Math.min((L-2*X)/V.width,(T-2*X)/V.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-p))),Q=L/2-q*K,J=T/2-U*K,ee=2*(K+4),te=mw(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(B,l,c):b;const e=v?v(B):Math.round(B)+"";return Cw("div",{style:{textAlign:"center",lineHeight:1.2},children:[Aw("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&Cw("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[l," – ",c]})]})},[b,B,l,c,v,x,K,a]),oe=mw(()=>i&&null==b?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[i,b,B,v]),ne=mw(()=>{if(!g)return null;const e=-Math.PI/2+G*Math.PI/180+H*Y,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,G,H,Y,Z,K,y]),re=mw(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||L)/2,r=(o.height||T)/2,i=Math.max(1,K-Z),a=Math.max(1,Math.min(2.5,.4*i)),s=Math.max(1,Math.min(5,.6*i));return Cw("g",{transform:`translate(${n},${r})`,children:[Aw("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:a,strokeLinecap:"round"}),Aw("circle",{cx:0,cy:0,r:s,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+G*Math.PI/180+(e.value-l)/F*Y,r=(o.width||L)/2,i=(o.height||T)/2,a=Z-1,s=K+1,c=Math.cos(n)*a,u=Math.sin(n)*a,d=Math.cos(n)*s,h=Math.sin(n)*s,f=K+10,p=Math.cos(n)*f,m=Math.sin(n)*f,g=((n+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return g>=11||1>g?(y="middle",b="auto"):g>=1&&5>g?(y="start",b="middle"):g>=5&&7>g?(y="middle",b="hanging"):(y="end",b="middle"),Cw("g",{transform:`translate(${r},${i})`,children:[Aw("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),Aw("text",{x:p,y:m,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?Aw("text",{x:(o.width||L)/2,y:(o.height||T)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,T,l,F,G,Y,Z,K]),ie=mw(()=>{const e=[...W,...A||[]];return ne&&e.push(ne),oe&&e.push(oe),e},[W,A,ne,oe]),ae=mw(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return Cw("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[Aw("div",{style:{fontWeight:600},children:o}),Aw("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===z.length)return Aw(Tp,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const se={chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:j,innerRadius:Z,startAngle:G,sweepAngle:k,...null!=m&&{cornerRadius:m},centerContent:te,size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:T-J-ee/2,left:Q-ee/2,right:L-Q-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:il(S)||ae,svgAnnotationRules:re,...ie.length>0&&{annotations:ie},...$&&{title:$},...I&&{description:I},...N&&{summary:N},...void 0!==D&&{accessibleTable:D},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...C};return Aw(Ep,{componentName:"GaugeChart",width:L,height:T,children:Aw(Yd,{ref:r,...se})})});Mw.displayName="GaugeChart";import{useMemo as _w,forwardRef as Pw,useRef as Rw}from"react";import{jsx as Lw}from"react/jsx-runtime";var Tw=Pw(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Rw(null),{data:r,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:p=!1,barPadding:m=60,roundedTop:g,styleRules:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:_,chartId:P,loading:R,loadingContent:L,emptyContent:$,legendInteraction:I,legendPosition:N,color:D,stroke:E,strokeWidth:B,opacity:F,categoryFormat:H}=e,{width:z,height:O,enableHover:W,showGrid:j,showLegend:Y,title:G,description:V,summary:X,accessibleTable:q,categoryLabel:U,valueLabel:K}=o,Z=_w(()=>T(r),[r]),Q=h||l,J=Py({data:Z,rawData:r,colorBy:Q,colorScheme:f,legendInteraction:I,legendPosition:N,selection:S,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:P,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:L,emptyContent:$,width:z,height:O}),ee=ay(),te=_w(()=>new Map,[]),oe=_w(()=>Iy(c),[c]),ne=Bx({colorBy:Q,colorScale:J.colorScale,color:D,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:w.pieceStyle,stroke:E,strokeWidth:B,opacity:F,styleRules:y,resolveRuleValue:oe,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=_w(()=>Ic({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),ie=xy({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:ae,effectiveMargin:se}=Dx({ref:t,frameRef:n,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Z},oAccessor:s,rAccessor:c,groupBy:l,oSort:p,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ne,size:[z,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:m,...null!=g&&{roundedTop:g},baselinePadding:b,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...H&&{oFormat:H},showGrid:j,...ae,...Sm({title:G,description:V,summary:X,accessibleTable:q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:v,defaultTooltipContent:re}),...Am({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return ie?Lw(Tp,{componentName:"GroupedBarChart",message:ie,width:z,height:O}):Lw(Ep,{componentName:"GroupedBarChart",width:z,height:O,children:Lw(Yd,{ref:n,...le})})});Tw.displayName="GroupedBarChart";import{useMemo as $w,forwardRef as Iw,useRef as Nw}from"react";import{jsx as Dw}from"react/jsx-runtime";var Ew=Iw(function(e,t){const o=my(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Nw(null),{data:r,margin:i,className:a,categoryAccessor:s="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:p,tooltip:m,annotations:g,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:$,color:I,stroke:N,strokeWidth:D,opacity:E,categoryFormat:B,rTickValues:F,tickLabelEdgeAlign:H,showCategoryTicks:z,gradientFill:O,trackFill:W,roundedTop:j,valueExtent:Y}=e,{width:G,height:V,enableHover:X,showGrid:q,showLegend:U,title:K,description:Z,summary:Q,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=$w(()=>T(r),[r]),ne=h||l,re=$w(()=>{if(null!=p)return p;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof s?s(e):e[s])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*o)/(o-1))):1},[p,e.mode,oe,s,u,G,V]),ie=Py({data:oe,rawData:r,colorBy:ne,colorScheme:f,legendInteraction:L,legendPosition:$,selection:k,linkedHover:w,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:M,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:G,height:V}),ae=xk({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),se=ay(),le=$w(()=>new Map,[]),ce=Bx({colorBy:ne,colorScale:ie.colorScale,color:I,themeCategorical:se,colorScheme:f,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:N,strokeWidth:D,opacity:E,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=$w(()=>Ic({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),de=xy({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:s,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=Dx({ref:t,frameRef:n,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const pe={chartType:"swimlane",...null!=r&&{data:oe},oAccessor:s,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===z?void 0:ee,rLabel:te,rFormat:d,...F&&{rTickValues:F},...null!=H&&{tickLabelEdgeAlign:H},...B&&{oFormat:B},...void 0!==z&&{showCategoryTicks:z},showGrid:q,...he,...Sm({title:K,description:Z,summary:Q,accessibleTable:J,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Cm({tooltip:m,defaultTooltipContent:ue}),...Am({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...g&&g.length>0&&{annotations:g},...O&&{gradientFill:!0===O?{topOpacity:.8,bottomOpacity:.05}:O},...null!=W&&{trackFill:W},...null!=j&&{roundedTop:j},...Y&&{rExtent:Y},...ae.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?Dw(Tp,{componentName:"SwimlaneChart",message:de,width:G,height:V}):Dw(Ep,{componentName:"SwimlaneChart",width:G,height:V,children:Dw(Yd,{ref:n,...pe})})});Ew.displayName="SwimlaneChart";import{useMemo as Bw,forwardRef as Fw,useRef as Hw}from"react";import{useMemo as zw}from"react";function Ow(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(n)};return n(e),o}function Ww(e,t,o,n){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],i="function"==typeof n?n(e):e[n];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function jw(e){return"function"==typeof e?e:t=>t[e]||1}function Yw({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:r,baseStyle:i={}}){return a=>{const s={fillOpacity:r,...i};if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Fe(e.data||e,t,o):e&&(s.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Fe(e.data||e,t,o):e&&(s.fill=n(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}function Gw(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:r="source",targetAccessor:i="target",colorBy:a,colorScheme:s,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:f,onClick:p,mobileInteraction:m,mobileSemantics:g,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:k,height:w,loading:S,loadingContent:A,emptyContent:C,emptyDataKey:M="edges"}=e,_=zw(()=>T(o),[o]),P=zw(()=>T(t),[t]),R=zp(S,k,w,A),L=R?null:Hp("nodes"===M?void 0===t?void 0:P:void 0===o?void 0:_,k,w,C),$=zw(()=>n?Ww(P,_,r,i):P,[n,P,_,r,i]),I=ly($,a,s),N=ay(),D=zw(()=>{if(Array.isArray(s))return s;if(N&&N.length>0)return N;if("string"==typeof s){const e=Ie[s];if(Array.isArray(e)&&e.length>0)return e}return Ne},[s,N]),E=zw(()=>{if(!a)return[];const e=new Set;for(const t of $){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[$,a]),B=fy(u,a,E),{legend:F,margin:H,legendPosition:z}=hy({data:$,colorBy:a,colorScale:I,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:E}),O=zw(()=>iy(m,{width:k,mobileSemantics:g}),[m,k,g]),W=uy({selection:d,linkedHover:h,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,mobileInteraction:O,chartType:y,chartId:b}),{customHoverBehavior:j,customClickBehavior:Y,activeSelectionHook:G,hoverSelectionHook:V,crosshairSourceId:X}=W;return{safeNodes:$,safeEdges:_,colorScale:I,effectivePalette:D,themeCategorical:N,allCategories:E,legendState:B,legend:F,margin:H,legendPosition:z,mobileInteraction:O,customHoverBehavior:j,customClickBehavior:Y,activeSelectionHook:G,hoverSelectionHook:V,crosshairSourceId:X,loadingEl:R,emptyEl:L}}import{jsx as Vw}from"react/jsx-runtime";var Xw=Fw(function(e,t){const o=Hw(null);Ly(t,{variant:"network",frameRef:o});const n=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:r,edges:i,margin:a,className:s,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:f,colorScheme:p,styleRules:m,nodeSize:g=8,nodeSizeRange:y=[5,20],edgeWidth:b=1,edgeColor:v="#999",edgeOpacity:x=.6,iterations:k=300,forceStrength:w=.1,layoutExecution:S="auto",layoutLoadingContent:A,onLayoutStateChange:C,tooltip:M,frameProps:_={},onObservation:P,onClick:R,chartId:L,selection:T,linkedHover:$,loading:I,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:B,stroke:F,strokeWidth:H,opacity:z}=e,O=l??c??"id",{width:W,height:j,enableHover:Y,showLegend:G,showLabels:V=!1,title:X,description:q,summary:U,accessibleTable:K}=n,Z=Gw({nodes:r,edges:i,inferNodes:!1,nodeIdAccessor:O,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:G,legendPosition:B,legendInteraction:E,selection:T,linkedHover:$,onObservation:P,onClick:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ForceDirectedGraph",chartId:L,marginDefaults:n.marginDefaults,userMargin:a,width:W,height:j,loading:I,loadingContent:N,emptyContent:D,emptyDataKey:"nodes"}),Q=Bw(()=>new Map,[]),J=Bw(()=>e=>{const t={};return t.fill=f?Fe(e.data||e,f,Z.colorScale):sy(void 0,Z.themeCategorical,p,void 0,Q),"number"==typeof g&&(t.r=g),t},[f,Z.colorScale,g,Z.themeCategorical,p,Q]),ee=Bw(()=>Dy(f,"number"==typeof g?void 0:g),[f,g]),te=Bw(()=>$y(zy(J,m,ee,e=>e.data||e),{stroke:F,strokeWidth:H,opacity:z}),[J,m,ee,F,H,z]),oe=Bw(()=>e=>{const t=e.data||e;let o;if("number"==typeof b)o=b;else if("function"==typeof b)o=b(t);else{const e=t[b],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:v,strokeWidth:o,opacity:x}},[b,v,x]),ne=Bw(()=>$y(oe,{stroke:F,strokeWidth:H,opacity:z}),[oe,F,H,z]),re=Bw(()=>{if(V&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[V,h]),ie=wy({componentName:"ForceDirectedGraph",nodes:r,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:O}});return ie?Vw(Tp,{componentName:"ForceDirectedGraph",message:ie,width:W,height:j}):Z.loadingEl?Z.loadingEl:Z.emptyEl?Z.emptyEl:Vw(Ep,{componentName:"ForceDirectedGraph",width:W,height:j,children:Vw(wm,{ref:o,chartType:"force",...null!=r&&{nodes:Z.safeNodes},...null!=i&&{edges:Z.safeEdges},size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,nodeIDAccessor:O,sourceAccessor:u,targetAccessor:d,iterations:k,forceStrength:w,layoutExecution:S,layoutLoadingContent:A,onLayoutStateChange:C,nodeStyle:te,edgeStyle:ne,colorBy:f,colorScheme:Z.effectivePalette,nodeSize:g,nodeSizeRange:y,nodeLabel:re,showLabels:V,enableHover:Y,tooltipContent:!1===M?()=>null:il(M)||void 0,...Am({linkedHover:$,selection:T,onObservation:P,onClick:R,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:Z.legend,legendPosition:Z.legendPosition,...E&&"none"!==E&&{legendHoverBehavior:Z.legendState.onLegendHover,legendClickBehavior:Z.legendState.onLegendClick,legendHighlightedCategory:Z.legendState.highlightedCategory,legendIsolatedCategories:Z.legendState.isolatedCategories},className:s,title:X,description:q,summary:U,accessibleTable:K,...null!=e.animate&&{animate:e.animate},..._})})});Xw.displayName="ForceDirectedGraph";import{useMemo as qw,forwardRef as Uw,useRef as Kw}from"react";import{jsx as Zw}from"react/jsx-runtime";var Qw=Uw(function(e,t){const o=Kw(null);Ly(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:r,edges:i,margin:a,className:s,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:p,edgeColorBy:m="source",padAngle:g=.01,groupWidth:y=20,sortGroups:b,nodeLabel:v,edgeOpacity:x=.5,tooltip:k,frameProps:w={},onObservation:S,onClick:A,chartId:C,selection:M,linkedHover:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:T,stroke:$,strokeWidth:I,opacity:N}=e,{width:D,height:E,enableHover:B,showLabels:F=!0,title:H,description:z,summary:O,accessibleTable:W}=n,j=Gw({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:!1,legendInteraction:T,selection:M,linkedHover:_,onObservation:S,onClick:A,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ChordDiagram",chartId:C,marginDefaults:n.marginDefaults,userMargin:a,width:D,height:E,loading:P,loadingContent:R,emptyContent:L}),Y=qw(()=>new Map,[]),G=j.safeNodes.length>0,V=qw(()=>{if(G)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=Fe(e.data||e,h,j.colorScale);else{const n=Array.isArray(f)?f:Ie[f]||Ne,r=Array.isArray(n)?n:Ne;o.fill=r[(e.index??t??0)%r.length]}return o}},[G,h,j.colorScale,f]),X=qw(()=>Dy(h),[h]),q=qw(()=>{if(V||p&&p.length>0)return $y(zy(V,p,X,e=>e.data||e),{stroke:$,strokeWidth:I,opacity:N})},[V,p,X,$,I,N]),U=qw(()=>{if(G)return Yw({edgeColorBy:m,colorBy:h,colorScale:j.colorScale,nodeStyleFn:q||(e=>({fill:sy(void 0,j.themeCategorical,f,void 0,Y)})),edgeOpacity:x,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:x}})},[G,m,h,j.colorScale,q,x,j.themeCategorical,f,Y]),K=qw(()=>U?$y(U,{stroke:$,strokeWidth:I,opacity:N}):void 0,[U,$,I,N]),Z=qw(()=>{if(!F)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[F,v,d]),Q=wy({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return Q?Zw(Tp,{componentName:"ChordDiagram",message:Q,width:D,height:E}):j.loadingEl?j.loadingEl:j.emptyEl?j.emptyEl:Zw(Ep,{componentName:"ChordDiagram",width:D,height:E,children:Zw(wm,{ref:o,chartType:"chord",...j.safeNodes.length>0&&{nodes:j.safeNodes},...null!=i&&{edges:j.safeEdges},size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:j.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:g,groupWidth:y,sortGroups:b,nodeStyle:q,edgeStyle:K,colorBy:h,colorScheme:j.effectivePalette,edgeColorBy:m,edgeOpacity:x,nodeLabel:Z,showLabels:F,enableHover:B,tooltipContent:!1===k?()=>null:il(k)||void 0,...Am({linkedHover:_,selection:M,onObservation:S,onClick:A,mobileInteraction:j.mobileInteraction,customHoverBehavior:j.customHoverBehavior,customClickBehavior:j.customClickBehavior,linkedHoverInClickPredicate:!1}),...T&&"none"!==T&&{legendHoverBehavior:j.legendState.onLegendHover,legendClickBehavior:j.legendState.onLegendClick,legendHighlightedCategory:j.legendState.highlightedCategory,legendIsolatedCategories:j.legendState.isolatedCategories},className:s,title:H,description:z,summary:O,accessibleTable:W,...null!=e.animate&&{animate:e.animate},...w})})});Qw.displayName="ChordDiagram";import{useMemo as Jw,forwardRef as eS,useRef as tS}from"react";import{jsx as oS}from"react/jsx-runtime";var nS=eS(function(e,t){const o=tS(null);Ly(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:600}),{nodes:r,edges:i,margin:a,className:s,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:p,edgeColorBy:m="source",orientation:g="horizontal",nodeAlign:y="justify",nodePaddingRatio:b=.05,nodeWidth:v=15,nodeLabel:x,edgeOpacity:k=.5,edgeSort:w,tooltip:S,frameProps:A={},onObservation:C,onClick:M,chartId:_,selection:P,linkedHover:R,loading:L,loadingContent:T,emptyContent:$,showLegend:I,legendPosition:N,legendInteraction:D,stroke:E,strokeWidth:B,opacity:F}=e,{width:H,height:z,enableHover:O,showLabels:W=!0,title:j,description:Y,summary:G,accessibleTable:V}=n,X=Gw({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:I,legendPosition:N,legendInteraction:D,selection:P,linkedHover:R,onObservation:C,onClick:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SankeyDiagram",chartId:_,marginDefaults:n.marginDefaults,userMargin:a,width:H,height:z,loading:L,loadingContent:T,emptyContent:$}),q=Jw(()=>new Map,[]),U=Jw(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Fe(e.data||e,h,X.colorScale):sy(void 0,X.themeCategorical,f,void 0,q),t},[h,X.colorScale,X.themeCategorical,f,q]),K=Jw(()=>Dy(h,u),[h,u]),Z=Jw(()=>$y(zy(U,p,K,e=>e.data||e),{stroke:E,strokeWidth:B,opacity:F}),[U,p,K,E,B,F]),Q=Jw(()=>Yw({edgeColorBy:m,colorBy:h,colorScale:X.colorScale,nodeStyleFn:Z,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[m,h,X.colorScale,Z,k]),J=Jw(()=>$y(Q,{stroke:E,strokeWidth:B,opacity:F}),[Q,E,B,F]),ee=Jw(()=>{if(!W)return;const e=x||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[W,x,d]),te=wy({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return te?oS(Tp,{componentName:"SankeyDiagram",message:te,width:H,height:z}):X.loadingEl?X.loadingEl:X.emptyEl?X.emptyEl:oS(Ep,{componentName:"SankeyDiagram",width:H,height:z,children:oS(wm,{ref:o,chartType:"sankey",...X.safeNodes.length>0&&{nodes:X.safeNodes},...null!=i&&{edges:X.safeEdges},size:[H,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:g,nodeAlign:y,nodePaddingRatio:b,nodeWidth:v,nodeStyle:Z,edgeStyle:J,colorBy:h,colorScheme:X.effectivePalette,edgeColorBy:m,edgeOpacity:k,edgeSort:w,nodeLabel:ee,showLabels:W,enableHover:O,tooltipContent:!1===S?()=>null:il(S)||void 0,...Am({linkedHover:R,selection:P,onObservation:C,onClick:M,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:X.legend,legendPosition:X.legendPosition,...D&&"none"!==D&&{legendHoverBehavior:X.legendState.onLegendHover,legendClickBehavior:X.legendState.onLegendClick,legendHighlightedCategory:X.legendState.highlightedCategory,legendIsolatedCategories:X.legendState.isolatedCategories},className:s,title:j,description:Y,summary:G,accessibleTable:V,...null!=e.animate&&{animate:e.animate},...A})})});nS.displayName="SankeyDiagram";import{useMemo as rS,useState as iS,useRef as aS,useCallback as sS}from"react";import{scaleTime as lS}from"d3-scale";import{forwardRef as cS}from"react";function uS(e,t,n){const r=t.incoming[e.id],i=t.outgoing[e.id],a=[];for(const e of r)a.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of i)a.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},l=()=>{a.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},c=a.length?o(a.map(e=>e.time)):null,u=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=u?u-1:null!=c&&Number.isFinite(c)?c-1:null,h=[...new Set(a.map(e=>e.time))].sort((e,t)=>e-t),f=new Map;for(let e=1;h.length>e;e++)f.set(h[e],h[e-1]);const p=e=>{const t=f.get(e);return null!=t?(t+e)/2:null!=d?d:e};l();const m=[];let g=0,y=0;for(const e of a)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?g:y);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?g:y);if(n>0){const r=p(e.time);m.push({time:r,delta:-n,kind:"transfer-out",side:t}),m.push({time:r,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?g-=n:y-=n,"top"===e.side?g+=n:y+=n,o-=n}o>0&&null!==d&&(m.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?g+=o:y+=o)}"top"===e.side?g-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?g+=t:y+=t}a.push(...m),l();let b=0,v=0,x=0,k=0,w=0;const S=[],A=new Map;for(const e of a){if(S.push({t:e.time,topMass:b,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?b:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?b+=e.delta:v+=e.delta,b+v>x&&(x=b+v),b>k&&(k=b),v>w&&(w=v),S.push({t:e.time,topMass:b,botMass:v})}const C=[];let M=0;for(;S.length>M;){let e=M;for(;S.length>e+1&&S[e+1].t===S[M].t;)e++;C.push(S[M]);for(let t=M+1;e>=t;t++){const e=C[C.length-1];S[t].topMass===e.topMass&&S[t].botMass===e.botMass||C.push(S[t])}M=e+1}const _=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let P=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===P||P>e.systemInTime)&&(P=e.systemInTime);let R=null;for(const e of r)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===R||e.systemOutTime>R)&&(R=e.systemOutTime);if(C.length>0){const e=C[C.length-1],t=Math.max(null!=_?_:-1/0,null!=R?R:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&C.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=C[0],n=Math.min(null!=u?u:1/0,null!=P?P:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&C.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:C,peak:x,topPeak:k,botPeak:w,localAttachments:A}}function dS(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function hS(e,t){return e.map(e=>({t:dS(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function fS(e,t,o){const n=e.value*o;if("out"===e.kind){const r=e.sideMassBefore*o;if("top"===e.side){const e=t-r;return[e,e+n]}const i=t+r;return[i-n,i]}const r=e.sideMassAfter*o;if("top"===e.side){const e=t-r;return[e,e+n]}const i=t+r;return[i-n,i]}function pS(e,t){let o=0;for(let n=0;t.length>n;n++)for(let r=n+1;t.length>r;r++){const i=t[n],a=t[r];i.source!==a.source&&i.target!==a.target&&i.source!==a.target&&i.target!==a.source&&(Math.min(i.endTime,a.endTime)>Math.max(i.startTime,a.startTime)&&e[a.source]>e[i.source]!=e[a.target]>e[i.target]&&o++)}return o}function mS(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function gS(e,t){return 1e3*pS(e,t)+mS(e,t)}function yS(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function bS(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const r=e.length;if(1>=r)return;let i=yS(e,t),a=gS(t,o);for(let s=0;n>s;s++){const n=Array(r).fill(0),s=Array(r).fill(0);for(const e of o){const o=t[e.source],r=t[e.target];n[o]+=r*(e.value||1),s[o]+=e.value||1,n[r]+=o*(e.value||1),s[r]+=e.value||1}const l=Array.from({length:r},(e,t)=>t).sort((e,t)=>(s[e]>0?n[e]/s[e]:e)-(s[t]>0?n[t]/s[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=gS(t,o);if(a>d)a=d,i=yS(e,t);else if(d===a)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,i)}(e,t,o,6),function(e,t,o,n=6){const r=e.length;if(1>=r)return;let i=gS(t,o);for(let a=0;n>a;a++){let n=!1;for(let a=0;r-1>a;a++){const r=e[a];e[a]=e[a+1],e[a+1]=r;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=gS(t,o);if(i>s)i=s,n=!0;else{const o=e[a];e[a]=e[a+1],e[a+1]=o;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const r={...t},i=Object.keys(r),a=Array.from({length:n},(e,t)=>t),s=a.slice(),l={...r};let c=a.slice(),u=1/0;const d=()=>{for(const e of i)l[e]=s[r[e]];const e=gS(l,o);u>e&&(u=e,c=a.slice())},h=(e,t)=>{const o=a[e],n=a[t];a[e]=n,a[t]=o,s[o]=t,s[n]=e};d();const f=Array(n).fill(0);let p=0;for(;n>p;)p>f[p]?(h(p%2==0?0:f[p],p),d(),f[p]++,p=0):(f[p]=0,p++);const m=c.map(t=>e[t]),g=new Map;c.forEach((e,t)=>g.set(e,t));for(const e of Object.keys(t))t[e]=g.get(t[e]);e.length=0;for(const t of m)e.push(t)}(e,t,o)}function vS(e,t,o,n,r){const{plotH:i,padding:a,valueScale:s,packing:l,laneOrder:c,lifetimeMode:u="full"}=r,d={},h={};for(const t of e)d[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const f="half"===u,p={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let r=null!=e&&Number.isFinite(e)?e:1/0,i=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){r>e.startTime&&(r=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&r>e.systemInTime&&(r=e.systemInTime);const t=f?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of n.incoming[t.id]){const t=f?(e.startTime+e.endTime)/2:e.startTime;r>t&&(r=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}p[t.id]={start:Number.isFinite(r)?r:null,end:Number.isFinite(i)?i:null}}const m={},g=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const r=new Map;for(const t of e)r.set(t.id,0);for(const e of t)r.set(e.target,(r.get(e.target)??0)+1);const i=[];for(const t of e)0===(r.get(t.id)??0)&&i.push(t.id);for(;i.length;){const e=i.shift();for(const t of n.outgoing[e]??[]){const n=(o.get(e)??0)+1;n>(o.get(t.target)??0)&&o.set(t.target,n),r.set(t.target,r.get(t.target)-1),0===r.get(t.target)&&i.push(t.target)}}const a=[...e].filter(e=>null!==p[e.id].start).sort((e,t)=>{const n=o.get(e.id)??0,r=o.get(t.id)??0;return n!==r?n-r:p[e.id].start-p[t.id].start}),s=e.filter(e=>null===p[e.id].start);for(const e of[...a,...s]){const t=p[e.id];let o=-1;for(let e=0;g.length>e;e++){const n=g[e].occupants[g[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(g.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=g.length-1),g[o].occupants.push({id:e.id,end:t?.end??-1/0}),g[o].peak.topPeak=Math.max(g[o].peak.topPeak,d[e.id]),g[o].peak.botPeak=Math.max(g[o].peak.botPeak,h[e.id]),m[e.id]=o}}else e.forEach((e,t)=>{g.push({occupants:[{id:e.id,end:p[e.id]?.end??-1/0}],peak:{topPeak:d[e.id],botPeak:h[e.id]}}),m[e.id]=t});let y=null,b=null,v=null,x=null;const k=()=>{y=pS(m,t),v=mS(m,t)},w=()=>{b=pS(m,t),x=mS(m,t)};"crossing-min"===c?(k(),bS(g,m,t),w()):"inside-out"===c?(k(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,r=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),i=Array(o),a=Math.floor((o-1)/2);i[a]=r[0].idx;let s=a-1,l=a+1;for(let e=1;r.length>e;e++)e%2==1&&o>l||0>s?i[l++]=r[e].idx:i[s--]=r[e].idx;const c=i.map(t=>e[t]),u=new Map;i.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(g,m),w()):"crossing-min+inside-out"===c&&(k(),bS(g,m,t),function(e,t,o){const n=e.length;if(1>=n)return;const r=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),i=Math.floor((n-1)/2);let a=gS(t,o);for(const{slot:s}of r){const r=e.indexOf(s);if(0>r)continue;const l=i;if(r===l)continue;const c=e[r];e.splice(r,1),e.splice(l,0,c);const u=new Map;for(let e=0;n>e;e++)u.set(e,e);if(l>r){for(let e=r+1;l>=e;e++)u.set(e,e-1);u.set(r,l)}else{for(let e=l;r>e;e++)u.set(e,e+1);u.set(r,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=gS(t,o);if(d>a){const o=e[l];e.splice(l,1),e.splice(r,0,o);const i=new Map;for(let e=0;n>e;e++)i.set(e,e);if(r>l){for(let e=l+1;r>=e;e++)i.set(e,e-1);i.set(l,r)}else{for(let e=r;l>e;e++)i.set(e,e+1);i.set(l,r)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else a=d}}(g,m,t),w());const S=g.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),A=(e,t)=>{let o={top:0,bot:0};for(const[n,r]of e){if(n>t)break;o=r}return o},C=[];for(let e=0;g.length-1>e;e++){const t=S[e],o=S[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let r=0;for(const e of n){const n=A(t,e),i=A(o,e);n.bot+i.top>r&&(r=n.bot+i.top)}C.push(r)}const M=[];let _=a+(g[0]?.peak.topPeak??0)*s;g.length>0&&M.push(_);for(let e=1;g.length>e;e++)_+=C[e-1]*s+a,M.push(_);if(g.length>0&&(_+=g[g.length-1].peak.botPeak*s+a),_>i){const e=i/_;for(let t=0;M.length>t;t++)M[t]*=e}const P=0===g.length?0:g[0].peak.topPeak+C.reduce((e,t)=>e+t,0)+g[g.length-1].peak.botPeak,R={};for(const t of e)R[t.id]=M[m[t.id]];return{effectiveSlotsHeight:P,centerlines:R,laneLifetime:p,slots:g,slotByNode:m,slotCenter:M,crossingsBefore:y,crossingsAfter:b,lengthBefore:v,lengthAfter:x}}var xS=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0}=e.config,r=[];for(const e of o)r.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}});for(const e of t)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];r.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of t)r.push({type:"bezier",pathD:e.pathD,style:{...e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86},stroke:e.stroke??e.fill,strokeWidth:e.strokeWidth??.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const i=n?t.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:r,labels:i}};function kS(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as wS,jsx as SS,jsxs as AS}from"react/jsx-runtime";function CS(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function MS(e,t){return"function"==typeof e?e(t):t[e]}var _S=cS(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:i=[],nodeIdAccessor:a="id",sourceAccessor:s="source",targetAccessor:l="target",valueAccessor:c="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:f,xExtentAccessor:p="xExtent",edgeIdAccessor:m="id",colorBy:g,colorScheme:y,showLegend:b,legendPosition:v="right",pairing:x="temporal",packing:k="reuse",laneOrder:w="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:C=!1,showQualityReadout:M=!1,showLabels:_=!0,width:P=600,height:R=400,margin:L,title:$,description:I,summary:N,accessibleTable:D,responsiveWidth:E,responsiveHeight:B,loading:F,loadingContent:H,emptyContent:z,edgeOpacity:O=.35,timeFormat:W,valueFormat:j,tooltip:Y,enableHover:G=!0,onObservation:V,onClick:X,showParticles:q=!1,particleStyle:U,chartId:K,frameProps:Z={}}=e,[Q,J]=iS([]),[ee,te]=iS([]),oe=aS(Q),ne=aS(ee);oe.current=Q,ne.current=ee;const re=sS(e=>{oe.current=e,J(e)},[]),ie=sS(e=>{ne.current=e,te(e)},[]),ae=void 0!==n,se=T(ae?n:Q),le=rS(()=>{const e=T(o??[]),t=ee;if(0===e.length&&0===t.length)return Ww([],se,s,l);const n=new Set,r=[];for(const t of e){const e=MS(a,t)+"";n.has(e)||(n.add(e),r.push(t))}for(const e of t){const t=MS(a,e)+"";n.has(t)||(n.add(t),r.push(e))}const i=Ww([],se,s,l);for(const e of i)n.has(e.id)||(n.add(e.id),r.push(e));return r},[o,ee,se,a,s,l]),ce=aS(null),ue=sS((e,t)=>{const o=MS(m,e);return null!=o?o+"":`${MS(s,e)}-${MS(l,e)}-${t}`},[m,s,l]),de=sS(e=>{if(null==e)return!1;const t=e;return null!=MS(s,t)&&null!=MS(l,t)},[s,l]);Ly(t,{variant:"network",frameRef:ce,overrides:{push(e){if(de(e)){if(ae)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");re([...oe.current,e])}else ie([...ne.current,e])},pushMany(e){const t=[],o=[];for(const n of e)de(n)?t.push(n):o.push(n);t.length>0&&(ae?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):re([...oe.current,...t])),o.length>0&&ie([...ne.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!ae){const e=oe.current,n=[];for(let r=0;e.length>r;r++){const i=e[r];t.has(ue(i,r))?o.push(i):n.push(i)}n.length!==e.length&&re(n)}const n=ne.current,r=[];for(const e of n){const n=MS(a,e)+"";t.has(n)?o.push(e):r.push(e)}return r.length!==n.length&&ie(r),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!ae){let e=!1;const r=oe.current.map((r,i)=>o.has(ue(r,i))?(n.push(r),e=!0,t(r)):r);e&&re(r)}let r=!1;const i=ne.current.map(e=>{const i=MS(a,e)+"";return o.has(i)?(n.push(e),r=!0,t(e)):e});return r&&ie(i),n},clear(){ae||re([]),ie([]),ce.current?.clear()},getData:()=>se??[],getScales:()=>null}});const he=ue,fe=sS(e=>MS(a,e)+"",[a]),{nodes:pe,edges:me,domain:ge,rawNodeById:ye,rawEdgeById:be}=rS(()=>{const e=(le??[]).map(e=>{const t={id:fe(e),__raw:e},o=p?MS(p,e):null;if(Array.isArray(o)&&2===o.length){const e=CS(o[0]),n=CS(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(se??[]).map((e,t)=>{const o={id:he(e,t),source:MS(s,e)+"",target:MS(l,e)+"",value:Number(MS(c,e)),startTime:CS(MS(u,e)),endTime:CS(MS(d,e)),__raw:e};if(h){const t=CS(MS(h,e));Number.isFinite(t)&&(o.systemInTime=t)}if(f){const t=CS(MS(f,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[CS(r[0]),CS(r[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[le,se,r,fe,he,p,s,l,c,u,d,h,f]),ve=Gw({nodes:le,edges:se,inferNodes:!1,nodeIdAccessor:a,sourceAccessor:s,targetAccessor:l,colorBy:g,colorScheme:y,showLegend:!1,legendPosition:v,selection:void 0,linkedHover:void 0,onObservation:V,onClick:X,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:K,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:L,width:P,height:R,loading:F,loadingContent:H,emptyContent:z}),xe=(b??!!g)&&!!g,ke=sS(e=>null!=L&&("number"==typeof L||null!=L[e]),[L]),we=rS(()=>{const e={...ve.margin};return xe&&("right"===v&&!ke("right")&&140>e.right?e.right=140:"bottom"===v&&!ke("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,xe,v,ke]),Se=P-we.left-we.right,Ae=R-we.top-we.bottom,Ce=rS(()=>function(e,t,o){const n=[],r=new Set(e.map(e=>e.id)),i=Array.isArray(o)&&2===o.length,a=i&&Number.isFinite(o[0])&&Number.isFinite(o[1]);i&&a&&a&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)r.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),r.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}(pe,me,ge),[pe,me,ge]),Me=rS(()=>Ce.length>0?null:function(e,t,o){const{plotH:n,pairing:r="temporal",packing:i="reuse",laneOrder:a="crossing-min",lifetimeMode:s="half"}=o,l=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),c=function(e,t,o,n="value"){const r="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const r=o.get(e);r.edges.push(n),r.total+=n.value,r.earliestStart=Math.min(r.earliestStart,n.startTime),r.latestEnd=Math.max(r.latestEnd,n.endTime)}const a=[...o.values()];a.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?i:r);return a};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)s(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=o});else if(0===e.length)s(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=o});else{const t=s(n,"source"),o=s(e,"target"),r=Math.max(t.length,o.length);for(let e=0;r>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)a.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)a.get(t.id).sourceSide=n}}}return a}(e,t,l,r);let u={};for(const t of e)u[t.id]=uS(t,l,c);const d=vS(e,t,u,l,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),h=new Set;for(const e of t){const t=d.slotByNode[e.source],o=d.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=c.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(h.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],n=new Set(e.map(e=>c.get(e.id).sourceSide)),r=new Set(o.map(e=>c.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)d.slotByNode[t.source]===d.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===r.size&&e.length>0){const t=[...r][0];for(const o of e)d.slotByNode[o.source]===d.slotByNode[o.target]&&(c.get(o.id).sourceSide=t)}}for(const t of e){const e=l.incoming[t.id],o=l.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===c.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===c.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},r=(e,t)=>{const r=n(),i="top"===e?r.outTop-r.inTop:r.outBot-r.inBot,a="top"===t?r.inTop-r.outTop:r.inBot-r.outBot;if(0>=i||0>=a)return!1;const s=Math.min(i,a),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let i=o.length+1;for(;i-- >0&&(r("top","bot")||r("bot","top")););}u={};for(const t of e)u[t.id]=uS(t,l,c);const f=vS(e,t,u,l,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),p=f.effectiveSlotsHeight??f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),m=Math.min(12,.35*n/Math.max(f.slots.length+1,1)),g=p>0?Math.max(0,(n-m*(f.slots.length+1))/p):1,y=vS(e,t,u,l,{plotH:n,padding:m,valueScale:g,packing:i,laneOrder:a,lifetimeMode:s});return{nodeData:u,sides:c,valueScale:g,padding:m,compressedPadding:12>m,centerlines:y.centerlines,laneLifetime:y.laneLifetime,slots:y.slots,slotByNode:y.slotByNode,crossingsBefore:y.crossingsBefore,crossingsAfter:y.crossingsAfter,lengthBefore:y.lengthBefore,lengthAfter:y.lengthAfter}}(pe,me,{plotH:Ae,pairing:x,packing:k,laneOrder:w,lifetimeMode:A}),[Ce,pe,me,Ae,x,k,w,A]),_e=rS(()=>lS().domain(ge).range([0,Se]),[ge,Se]),Pe=sS((e,t)=>{if(g&&le){const t=ye.get(e);if(t)return Fe(t,g,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[g,le,ye,ve.colorScale,ve.effectivePalette]),Re=rS(()=>{const e=new Map;return pe.forEach((t,o)=>e.set(t.id,o)),e},[pe]),Le=rS(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,n=[],r=[];return pe.forEach((r,i)=>{const a=t[r.id];if(!a||0===a.samples.length)return;const s=function(e,t,o,n,r){if(0===e.length)return null;const i=hS(e,r),a=e=>t-i[e].topMass*o,s=e=>t+i[e].botMass*o;let l=`M${n(i[0].t)},${a(0)}`;for(let e=1;i.length>e;e++)l+=` L${n(i[e].t)},${a(e)}`;l+=` L${n(i[i.length-1].t)},${s(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${n(i[e].t)},${s(e)}`;return l+" Z"}(a.samples,e[r.id],o,_e,ge);if(!s)return;const l=hS(a.samples,ge),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=e[r.id]+(c.botMass-c.topMass)*o/2,d=Pe(r.id,i),h=ye.get(r.id)??r,f=function(e,t,o,n,r){const i=o.nodeData[e];if(!i||0===i.samples.length)return[];const a=o.valueScale,s=o.centerlines[e],l=hS(i.samples,r),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=n(c.t),h=n(u.t),f=e=>n(dS(e,r)),p=[],m=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=i.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=f(o.systemInTime),n=f(o.startTime),r=t-20,i=Math.max(d,r);if(n>i){const[o,l]=fS(e,s,a);p.push({pathD:m(i,o,n,l),x0:r,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=i.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=f(o.systemOutTime),n=f(o.endTime),r=t+20,i=Math.min(h,r);if(i>n){const[o,l]=fS(e,s,a);p.push({pathD:m(n,o,i,l),x0:t,x1:r,from:1,to:0})}}}}return p}(r.id,me,Me,_e,ge);n.push({id:r.id,pathD:s,fill:d,stroke:d,strokeWidth:.5,...f.length>0&&{gradientStubs:f},rawDatum:h,labelX:_e(c.t)-4,labelY:u,labelText:r.id})}),me.forEach(n=>{const i=t[n.source]?.localAttachments.get(n.id),a=t[n.target]?.localAttachments.get(n.id);if(!i||!a)return;const s=Re.get(n.source)??0,l=Pe(n.source,s),c=function(e,t,o,n,r,i,a,s){const l=r,c=e=>s?Math.max(s[0],Math.min(s[1],e)):e,u=i(c(e.time)),d=i(c(o.time)),h=e.value*l,f=o.value*l,p=e.sideMassBefore*l,m=o.sideMassAfter*l;let g,y,b,v;"top"===e.side?(g=t-p,y=g+h):(y=t+p,g=y-h),"top"===o.side?(b=n-m,v=b+f):(v=n+m,b=v-f);const x="source"===a?u+.85*(d-u):"target"===a?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:g,sBot:y,tx:d,tTop:b,tBot:v,cp1X:x,cp2X:x}}(i,e[n.source],a,e[n.target],o,_e,S,ge),{pathD:u,bezier:d}=Jh(c),h=be.get(n.id)??n;r.push({id:n.id,pathD:u,fill:l,opacity:O,rawDatum:h,bezier:d})}),{bands:n,ribbons:r}},[Me,pe,me,_e,ge,Pe,ye,be,S,O,Re]),Te=rS(()=>({bands:Le.bands,ribbons:Le.ribbons,showLabels:_}),[Le,_]),$e=rS(()=>{if(!xe||!g)return;const e=new Map;(le??[]).forEach((t,o)=>{const n=MS(g,t),r=null==n?"":n+"";r&&!e.has(r)&&e.set(r,{label:r,color:Pe(fe(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[xe,g,le,Pe,fe]),Ie=rS(()=>!1!==Y&&G?void 0===Y||!0===Y?null:il(Y)||null:null,[Y,G]),Ne=sS(e=>W?W(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[W]),De=sS(e=>j?j(e):e+"",[j]),Ee=sS(e=>{if(!e||!e.data)return null;const t=e.data;if(!kS(t))return null;const o=t.data;if(Ie)return Ie(o);if("band"===t.__kind){const e=t.id,o=Me?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,r=`${n.t}:${e}`;t.has(r)||(t.add(r),o.push({t:n.t,total:e}))}return o}(Me.nodeData[e]):[],n=5,r=o.length>n?o.length:null,i=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,r=[{...o[0],mark:"min"},{...o[Math.floor(.25*n)],mark:"q25"},{...o[Math.floor(.5*n)],mark:"median"},{...o[Math.floor(.75*n)],mark:"q75"},{...o[n],mark:"max"}],i=new Set,a=[];for(const e of r)i.has(e.t)||(i.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,n);return AS("div",{style:{minWidth:160},children:[SS("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&AS("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[SS("thead",{children:AS("tr",{style:{opacity:.6},children:[SS("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),SS("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&SS("th",{})]})}),SS("tbody",{children:i.map((e,t)=>AS("tr",{children:[SS("td",{style:{paddingRight:8},children:Ne(e.t)}),SS("td",{style:{textAlign:"right"},children:De(e.total)}),null!=r&&SS("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=r&&AS("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",r," samples"]})]})}const n=o,r=MS(s,n),i=MS(l,n),a=MS(c,n),h=MS(u,n),f=MS(d,n);return AS("div",{style:{minWidth:160},children:[AS("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",i+""]}),AS("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&AS(wS,{children:[SS("span",{style:{opacity:.6},children:"value"}),SS("span",{style:{textAlign:"right"},children:De(Number(a))})]}),null!=h&&AS(wS,{children:[SS("span",{style:{opacity:.6},children:"start"}),SS("span",{style:{textAlign:"right"},children:Ne(CS(h))})]}),null!=f&&AS(wS,{children:[SS("span",{style:{opacity:.6},children:"end"}),SS("span",{style:{textAlign:"right"},children:Ne(CS(f))})]})]})]})},[Me,Ie,Ne,De,s,l,c,u,d]),Be=rS(()=>{if(!Me)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:n,compressedPadding:r,crossingsBefore:a,crossingsAfter:s,lengthBefore:l,lengthAfter:c}=Me;let u=null,d=null;for(const e of pe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const n=_e(o.start),r=_e(o.end);(null===u||u>n)&&(u=n),(null===d||r>d)&&(d=r)}const h=e=>Math.max(0,Math.min(Se,e)),f=h(u??0),p=Math.max(f,h(d??Se));return AS("g",{children:[M&&null!==(s??null)&&AS("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",s," ","edge length: ",Math.round(l)," → ",Math.round(c)]}),r&&SS("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const o=_e(CS(e.date));return f-.5>o||o>p+.5?null:SS("line",{x1:o,y1:0,x2:o,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),C&&pe.map((r,i)=>{const a=t[r.id];if(!a||null===a.start)return null;const s=o[r.id],l=s?{topPeak:s.topPeak,botPeak:s.botPeak}:{topPeak:0,botPeak:0},c=e[r.id]+(l.botPeak-l.topPeak)*n/2,u=_e(a.start),d=_e(a.end),h=Pe(r.id,i);return AS("g",{children:[SS("line",{x1:u,y1:c,x2:d,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),SS("line",{x1:u,y1:c-4,x2:u,y2:c+4,stroke:h,strokeOpacity:.5}),SS("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+r.id)}),SS("line",{x1:f,y1:Ae+4,x2:p,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const o=CS(e.date),n=_e(o);if(f-.5>n||n>p+.5)return null;const r=null!=e.label?e.label:W?W(new Date(o)):"";return AS("g",{transform:`translate(${n},${Ae+4})`,children:[SS("line",{y2:6,stroke:"#94a3b8"}),SS("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},t)})]})},[Me,i,_e,Se,Ae,C,pe,Pe,M,W]),He=rS(()=>(le??[]).map(e=>({id:fe(e),data:e})),[le,fe]),ze=rS(()=>{const e=new Map;for(const t of Le.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Le]),Oe=rS(()=>(se??[]).map((e,t)=>{const o=he(e,t),n=Number(MS(c,e));return{id:o,source:MS(s,e)+"",target:MS(l,e)+"",value:Number.isFinite(n)?n:0,bezier:ze.get(o),data:e}}),[se,he,s,l,c,ze]),We=ve.loadingEl,je=ve.emptyEl;return Ce.length>0?AS("svg",{width:P,height:R,role:"img","aria-label":$??"Process Sankey validation failed",children:[SS("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ce.map((e,t)=>{return SS("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+(o=e,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},t);var o})]}):We||je||SS(wm,{ref:ce,chartType:"force",nodes:He,edges:Oe,customNetworkLayout:xS,layoutConfig:Te,size:[P,R],responsiveWidth:E,responsiveHeight:B,margin:we,title:$,description:I??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:N,accessibleTable:D,enableHover:G,tooltipContent:!1===Y?()=>null:Ee,backgroundGraphics:Be,showParticles:q,particleStyle:U,legend:$e,legendPosition:v,onObservation:V,...X&&{customClickBehavior:e=>{if(!e||!e.data||!X)return;const t=e.data;kS(t)&&X(t.data,{x:e.x,y:e.y})}},chartId:K,colorScheme:Array.isArray(y)?y:void 0,...Z})});_S.displayName="ProcessSankey";import{useMemo as PS}from"react";import{jsx as RS}from"react/jsx-runtime";function LS(e){const t=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,layout:i="tree",orientation:a="vertical",childrenAccessor:s="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:f="curve",nodeLabel:p,nodeSize:m=5,tooltip:g,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:P}=e,{width:R,height:L,enableHover:T,showLabels:$=!0,title:I,description:N,summary:D,accessibleTable:E}=t,B=Gw({nodes:PS(()=>Ow(o??null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:k,linkedHover:w,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:n,width:R,height:L,loading:S,loadingContent:A}),F=PS(()=>new Map,[]),H=PS(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Ee[(e.depth||0)%Ee.length]:u?Fe(e.data||e,u,B.colorScale):sy(void 0,B.themeCategorical,d,void 0,F),t},[u,h,B.colorScale,B.themeCategorical,d,F]),z=PS(()=>$y(H,{stroke:M,strokeWidth:_,opacity:P}),[H,M,_,P]),O=PS(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),W=PS(()=>$y(O,{stroke:M,strokeWidth:_,opacity:P}),[O,M,_,P]),j=PS(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return jw(l)},[i,l]),Y=ky({componentName:"TreeDiagram",data:o});return Y?RS(Tp,{componentName:"TreeDiagram",message:Y,width:R,height:L}):B.loadingEl?B.loadingEl:RS(Ep,{componentName:"TreeDiagram",width:R,height:L,children:RS(wm,{chartType:i,...null!=o&&{data:o},size:[R,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:B.margin,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:j,treeOrientation:a,edgeType:f,nodeStyle:z,edgeStyle:W,colorBy:u,colorScheme:B.effectivePalette,colorByDepth:h,nodeSize:m,nodeLabel:$?p||c:void 0,showLabels:$,enableHover:T,tooltipContent:!1===g?()=>null:il(g)||void 0,...Am({linkedHover:w,selection:k,onObservation:b,onClick:v,mobileInteraction:B.mobileInteraction,customHoverBehavior:B.customHoverBehavior,customClickBehavior:B.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},className:r,title:I,description:N,summary:D,accessibleTable:E,...null!=e.animate&&{animate:e.animate},...y})})}LS.displayName="TreeDiagram";import{useMemo as TS,useCallback as $S}from"react";import{jsx as IS}from"react/jsx-runtime";function NS(e){const t=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",valueAccessor:a="value",nodeIdAccessor:s="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:f=4,paddingTop:p,nodeStyle:m,tooltip:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:P}=e,{nodeStyle:R,...L}=y,{width:T,height:$,enableHover:I,showLabels:N=!0,title:D,description:E,summary:B,accessibleTable:F}=t,H=Gw({nodes:TS(()=>Ow(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:C,selection:b,linkedHover:v,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:n,width:T,height:$,loading:S,loadingContent:A}),z=_y(b),O=H.customHoverBehavior,W=$S(e=>{if(!e)return O(null);const t=e.data||e;O({data:t?.data||t})},[O]),j=TS(()=>new Map,[]),Y=TS(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?Ee[(e.depth||0)%Ee.length]:l?Fe(e.data||e,l,H.colorScale):sy(void 0,H.themeCategorical,c,void 0,j),t},[l,u,H.colorScale,H.themeCategorical,c,j]),G=TS(()=>m||R?e=>({...Y(e),...R?R(e)??{}:{},...m?m(e)??{}:{}}):Y,[Y,m,R]),V=TS(()=>$y(G,{stroke:M,strokeWidth:_,opacity:P}),[G,M,_,P]),X=TS(()=>H.activeSelectionHook?e=>{const t={...V(e)};if(H.activeSelectionHook.isActive)if(H.activeSelectionHook.predicate(e.data||e))z?.selectedStyle&&Object.assign(t,z.selectedStyle);else{const e=z?.unselectedOpacity??.5;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,z?.unselectedStyle&&Object.assign(t,z.unselectedStyle)}return t}:V,[V,H.activeSelectionHook,z]),q=TS(()=>jw(a),[a]),U=void 0!==p?p:!N||"parent"!==d&&"all"!==d?void 0:18,K=ky({componentName:"Treemap",data:o});return K?IS(Tp,{componentName:"Treemap",message:K,width:T,height:$}):H.loadingEl?H.loadingEl:IS(Ep,{componentName:"Treemap",width:T,height:$,children:IS(wm,{chartType:"treemap",...null!=o&&{data:o},size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:H.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:q,padding:f,paddingTop:U,nodeStyle:X,colorBy:l,colorScheme:H.effectivePalette,colorByDepth:u,nodeLabel:N?h||s:void 0,showLabels:N,labelMode:d,enableHover:I,tooltipContent:!1===g?()=>null:il(g)||void 0,...Am({linkedHover:v,selection:b,onObservation:x,onClick:k,mobileInteraction:H.mobileInteraction,customHoverBehavior:W,customClickBehavior:H.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},className:r,title:D,description:E,summary:B,accessibleTable:F,...null!=e.animate&&{animate:e.animate},...L})})}NS.displayName="Treemap";import{useMemo as DS}from"react";import{jsx as ES}from"react/jsx-runtime";function BS(e){const t=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",valueAccessor:a="value",nodeIdAccessor:s="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:f=4,tooltip:p,frameProps:m={},onObservation:g,onClick:y,chartId:b,selection:v,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:_,height:P,enableHover:R,showLabels:L=!0,title:T,description:$,summary:I,accessibleTable:N}=t,D=Gw({nodes:DS(()=>Ow(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:S,selection:v,linkedHover:x,onObservation:g,onClick:y,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:b,marginDefaults:t.marginDefaults,userMargin:n,width:_,height:P,loading:k,loadingContent:w}),E=DS(()=>new Map,[]),B=DS(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?Ee[(e.depth||0)%Ee.length]:l?Fe(e.data||e,l,D.colorScale):sy(void 0,D.themeCategorical,c,void 0,E),t},[l,u,D.colorScale,h,D.themeCategorical,c,E]),F=DS(()=>$y(B,{stroke:A,strokeWidth:C,opacity:M}),[B,A,C,M]),H=DS(()=>jw(a),[a]),z=ky({componentName:"CirclePack",data:o});return z?ES(Tp,{componentName:"CirclePack",message:z,width:_,height:P}):D.loadingEl?D.loadingEl:ES(Ep,{componentName:"CirclePack",width:_,height:P,children:ES(wm,{chartType:"circlepack",...null!=o&&{data:o},size:[_,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:D.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:H,padding:f,nodeStyle:F,colorBy:l,colorScheme:D.effectivePalette,colorByDepth:u,nodeLabel:L?d||s:void 0,showLabels:L,enableHover:R,tooltipContent:!1===p?()=>null:il(p)||void 0,...Am({linkedHover:x,selection:v,onObservation:g,onClick:y,mobileInteraction:D.mobileInteraction,customHoverBehavior:D.customHoverBehavior,customClickBehavior:D.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:D.legendState.onLegendHover,legendClickBehavior:D.legendState.onLegendClick,legendHighlightedCategory:D.legendState.highlightedCategory,legendIsolatedCategories:D.legendState.isolatedCategories},className:r,title:T,description:$,summary:I,accessibleTable:N,...null!=e.animate&&{animate:e.animate},...m})})}BS.displayName="CirclePack";import{useMemo as FS}from"react";import{jsx as HS}from"react/jsx-runtime";var zS=Ee;function OS(e){const t=my(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",nodeIdAccessor:a="name",colorBy:s,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:f,revolutionStyle:p,eccentricity:m=1,showRings:g=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:_,linkedHover:P,loading:R,loadingContent:L,stroke:T,strokeWidth:$,opacity:I}=e,{width:N,height:D,enableHover:E,title:B,description:F,summary:H,accessibleTable:z}=t,O=Gw({nodes:FS(()=>Ow(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:s,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:n,width:N,height:D,loading:R,loadingContent:L}),W=FS(()=>new Map,[]),{colorScale:j,customClickBehavior:Y,customHoverBehavior:G,themeCategorical:V}=O,X=FS(()=>{if(Array.isArray(l))return l;const e=Ie[l];return Array.isArray(e)?e:Ne},[l]),q=FS(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?X[0]:zS[(e.depth||0)%zS.length]:s?Fe(e.data||e,s,j):sy(void 0,V,l,void 0,W),t.opacity=o?1:.85,t},[s,c,j,X,V,l,W]),U=FS(()=>$y(q,{stroke:T,strokeWidth:$,opacity:I}),[q,T,$,I]),K=FS(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Z=FS(()=>e=>{G(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[G]),Q=FS(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),J=ky({componentName:"OrbitDiagram",data:o});return J?HS(Tp,{componentName:"OrbitDiagram",message:J,width:N,height:D}):O.loadingEl?O.loadingEl:HS(Ep,{componentName:"OrbitDiagram",width:N,height:D,children:HS(wm,{chartType:"orbit",...null!=o&&{data:o},size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,nodeIDAccessor:a,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:s,colorScheme:O.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?a:void 0,showLabels:b,enableHover:!v&&E,tooltipContent:v?void 0:!1===x?()=>null:il(x)||void 0,...Am({linkedHover:P,selection:_,onObservation:A,onClick:C,mobileInteraction:O.mobileInteraction,customHoverBehavior:Z,customClickBehavior:Q,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:r,title:B,description:F,summary:H,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:f,orbitRevolutionStyle:p,orbitEccentricity:m,orbitShowRings:g,orbitAnimated:v,accessibleTable:z,...null!=e.animate&&{animate:e.animate},...S})})}OS.displayName="OrbitDiagram";import{useRef as WS,useImperativeHandle as jS,forwardRef as YS,useCallback as GS,useState as VS,useEffect as XS}from"react";import{jsx as qS,jsxs as US}from"react/jsx-runtime";var KS={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"},ZS={opacity:.7,marginRight:4};function QS(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function JS(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function eA(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,a=QS(i,t,"time"),s=QS(i,o,"value");return US("div",{className:"semiotic-tooltip",style:KS,children:[US("div",{children:[US("span",{style:ZS,children:[n,":"]}),JS(a)]}),US("div",{children:[US("span",{style:ZS,children:[r,":"]}),JS(s)]})]})}}function tA(e,t){return null!=e?e:Math.max(t?.length??0,200)}var oA=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,o=e._mean-this._mean;this._mean+=o*e._count/t,this._m2+=e._m2+o*o*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}},nA=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 o=this.hop,n=Math.floor(e/o);for(let r=Math.floor((e-this.size)/o)+1;n>=r;r++)this.bump(r*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new oA,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new oA;n.push(t);let r=e,i=e;const a=[],s={start:r,end:i,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?a.push(t):(s.stats.merge(t.stats),r>t.start&&(r=t.start),t.end>i&&(i=t.end));s.start=r,s.end=i,a.push(s),a.sort((e,t)=>e.start-t.start),this.sessions=a}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 o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const n=t+this.size;e.push(this.row(t,n,o,n>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,o,n){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:n}}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 rA(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}}var iA={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},aA=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function sA(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;aA.lastIndex=0;let o,n=0,r=0;for(;null!==(o=aA.exec(t));){const e=parseFloat(o[1]),t=iA[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,r+=o[0].length}return r!==t.length?null:n>0?n:null}var lA="time",cA="value",uA="__aggLower",dA="__aggUpper",hA="__aggPartial",fA="count",pA="__aggStart",mA="__aggEnd";function gA(e,t){const o=t.stat??"mean",n=t.band??"none",r=t.sigma??1;return e.emit().map(e=>{const t={[lA]:(e.start+e.end)/2,[cA]:rA(e,o),[fA]:e.count,[hA]:e.partial,[pA]:e.start,[mA]:e.end},i=function(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const r=rA(e,o),i=e.stddev*n;return[r-i,r+i]}(e,n,o,r);return i&&(t[uA]=i[0],t[dA]=i[1]),t})}var yA=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 o=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,o.push(e),"drop"===this.latePolicy?{released:[],late:o}:{released:[e],late:o}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:o})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],o=[];for(const n of this.held)this.getTime(n)>e?o.push(n):t.push(n);return this.held=o,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{jsx as bA}from"react/jsx-runtime";function vA(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();const r=Number(n);return Number.isFinite(r)?r:null}var xA=YS(function(e,t){const o=my(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:p,stroke:m="#007bff",strokeWidth:g=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:L,transition:T,linkedHover:$,selection:I,onObservation:N,chartId:D,loading:E,loadingContent:B,emptyContent:F,emphasis:H,legendPosition:z,aggregate:O,eventTime:W}=e,j=o.showAxes,Y=o.enableHover,G=r??o.marginDefaults,V=n??[o.width,o.height],X=x??k??eA({timeAccessor:u,valueAccessor:d}),q=WS(null),{customHoverBehavior:U}=uy({selection:I,linkedHover:$,unwrapData:!0,onObservation:N,chartType:"RealtimeLineChart",chartId:D}),K=GS(e=>{w&&w(e),U(e)},[w,U]),Z=null!=O,[Q,J]=VS([]),ee=WS(null),te=WS(O);te.current=O;const oe=WS(Z);oe.current=Z;const ne=WS(Q);ne.current=Q;const re=WS({timeAccessor:u,valueAccessor:d});re.current={timeAccessor:u,valueAccessor:d},XS(()=>{if(!Z)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=sA("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?sA(e.hop):void 0,r=null!=e.gap?sA(e.gap):void 0;return new nA({window:t,size:o,hop:n??void 0,gap:r??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=re.current;for(const n of c){const r=vA(n,e,"time"),i=vA(n,o,"value");null!=r&&null!=i&&t.push(r,i)}}J(t?gA(t,e):[])},[Z?[O.window??"tumbling",O.size,O.hop??"",O.gap??"",O.retain??""].join("|"):"",Z,c]),XS(()=>{Z&&ee.current&&J(gA(ee.current,te.current))},[O?.stat,O?.band,O?.sigma]);const ie=GS(e=>{const t=ee.current,o=te.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:r}=re.current;for(const o of e){const e=vA(o,n,"time"),i=vA(o,r,"value");null!=e&&null!=i&&t.push(e,i)}J(gA(t,o))},[]),ae=null!=W,se=WS(null),le=WS(W);le.current=W;const ce=WS(ae);ce.current=ae;const ue=WS(N);ue.current=N;const de=WS(D);de.current=D,XS(()=>{se.current=ae?function(e){const t=sA(e.lateness);return null==t?null:new yA({lateness:t,getTime:e=>vA(e,re.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[ae?`${W.lateness}|${W.latePolicy??"drop"}`:"",ae]);const he=GS(e=>{0!==e.length&&(oe.current?ie(e):q.current?.pushMany(e))},[ie]),fe=GS(e=>{const t=se.current;if(!ce.current||!t)return void he(e);const o=[];for(const n of e){const e=t.push(n);if(e.released.length&&o.push(...e.released),e.late.length){const o=ue.current;if(o){const{timeAccessor:n}=re.current,r=le.current?.latePolicy??"drop";for(const i of e.late)o({type:"late-data",datum:i,eventTime:vA(i,n,"time")??NaN,watermark:t.watermark,policy:r,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);jS(t,()=>({push:e=>fe([e]),pushMany:e=>fe(e),remove:e=>oe.current?[]:q.current?.remove(e)??[],update:(e,t)=>oe.current?[]:q.current?.update(e,t)??[],clear:()=>{se.current?.clear(),oe.current?(ee.current?.clear(),J([])):q.current?.clear()},getData:()=>oe.current?ne.current:q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[fe]);const pe=zp(E,V[0],V[1],B),me=pe?null:Hp(Z?void 0:c,V[0],V[1],F),ge={stroke:m,strokeWidth:g,strokeDasharray:y};null!=b&&(ge.opacity=b);const ye=tA(l,c),be=Z?Q:c,ve=Z?lA:u,xe=Z?cA:d,ke=Z&&O&&"none"!==(O.band??"none")?{y0Accessor:uA,y1Accessor:dA,perSeries:!1}:void 0;return pe||me||bA(su,{ref:q,chartType:"line",runtimeMode:"streaming",size:V,margin:G,className:H?`${i||""} semiotic-emphasis-${H}`.trim():i,arrowOfTime:a,windowMode:Z?"growing":s,windowSize:Z?Math.max(1,O?.retain??Math.max(Q.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:f,extentPadding:p,band:ke,lineStyle:ge,showAxes:j,background:v,hoverAnnotation:Y,tooltipContent:X,...Am({linkedHover:$,selection:I,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:L,transition:T,pointIdAccessor:e.pointIdAccessor,legendPosition:z})});xA.displayName="RealtimeLineChart";import{useRef as kA,useImperativeHandle as wA,forwardRef as SA,useCallback as AA,useMemo as CA}from"react";import{jsx as MA}from"react/jsx-runtime";function _A(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const r=Number(n);return Number.isFinite(r)?r:null}var PA=SA(function(e,t){const o=my(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:n,size:r,margin:i,className:a,arrowOfTime:s="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:f="up",timeExtent:p,valueExtent:m,extentPadding:g,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:k,opacity:w,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:$,linkedHover:I,selection:N,decay:D,pulse:E,staleness:B,transition:F,onObservation:H,chartId:z,loading:O,loadingContent:W,emptyContent:j,emphasis:Y,legendPosition:G,brush:V,onBrush:X,linkedBrush:q}=e,U=o.showAxes,K=o.enableHover,Z=i??o.marginDefaults,Q=r??[o.width,o.height],J=C??M??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=QS(n,t,"time"),r=QS(n,o,"value");return US("div",{className:"semiotic-tooltip",style:KS,children:[US("div",{children:[qS("span",{style:ZS,children:"x:"}),JS(e)]}),US("div",{children:[qS("span",{style:ZS,children:"y:"}),JS(r)]})]})}return US("div",{className:"semiotic-tooltip",style:KS,children:[US("div",{children:[qS("span",{style:ZS,children:"range:"}),JS(n.binStart),"–",JS(n.binEnd)]}),null!=n.total&&US("div",{children:[qS("span",{style:ZS,children:"count:"}),JS(n.total)]}),null!=n.category&&US("div",{children:[qS("span",{style:ZS,children:"category:"}),JS(n.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ee=kA(null),{customHoverBehavior:te}=uy({selection:N,linkedHover:I,unwrapData:!0,onObservation:H,chartType:"RealtimeHistogram",chartId:z}),oe=AA(e=>{_&&_(e),te(e)},[_,te]),ne=!0===V?{dimension:"x",snap:"bin"}:"x"===V?{dimension:"x"}:"object"==typeof V?V:void 0,re=$g(q),ie="string"==typeof d?d:"time",ae=hg({name:re?.name||"__unused_hist_brush__",xField:re?.xField||ie,...re?.yField?{yField:re.yField}:{}}),se=kA(ae.brushInteraction);se.current=ae.brushInteraction;const le=AA(e=>{if(X&&X(e),H&&H(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}),re){const t=se.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)}},[X,H,z,re]);wA(t,()=>({push:e=>ee.current?.push(e),pushMany:e=>ee.current?.pushMany(e),remove:e=>ee.current?.remove(e)??[],update:(e,t)=>ee.current?.update(e,t)??[],clear:()=>ee.current?.clear(),getData:()=>ee.current?.getData()??[],getScales:()=>ee.current?.getScales()??null}),[]);const ce=zp(O,Q[0],Q[1],W),ue=ce?null:Hp(u,Q[0],Q[1],j),de={};null!=v&&(de.fill=v),null!=x&&(de.stroke=x),null!=k&&(de.strokeWidth=k),null!=w&&(de.opacity=w),null!=S&&(de.gap=S);const he=Y?`${a||""} semiotic-emphasis-${Y}`.trim():a,fe=tA(c,u),pe=CA(()=>"down"!==f?m:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,valueExtent:r,extentPadding:i}){if(r)return[r[1],r[0]];if(!e||0===e.length)return;const a=new Map;for(const r of e){const e=_A(r,o,"time"),i=_A(r,t,"value");if(null==e||null==i)continue;const s=Math.floor(e/n)*n;a.set(s,(a.get(s)??0)+i)}let s=0;for(const e of a.values())e>s&&(s=e);return[s>0?s+s*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:n,valueExtent:m,extentPadding:g}),[f,u,h,d,n,m,g]);return ce||ue||MA(su,{ref:ee,chartType:"bar",runtimeMode:"streaming",size:Q,margin:Z,className:he,arrowOfTime:s,windowMode:l,windowSize:fe,data:u,timeAccessor:d,valueAccessor:h,xExtent:p,yExtent:pe,extentPadding:g,binSize:n,categoryAccessor:y,barColors:b,barStyle:de,showAxes:U,background:A,hoverAnnotation:K,tooltipContent:J,...Am({linkedHover:I,selection:N,onObservation:H,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:oe}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:$,decay:D,pulse:E,staleness:B,transition:F,pointIdAccessor:e.pointIdAccessor,legendPosition:G,brush:ne||(q?{dimension:"x"}:void 0),onBrush:ne||q?le:void 0})});function RA(e){return MA(PA,{...e,windowMode:"growing"})}PA.displayName="RealtimeHistogram",RA.displayName="TemporalHistogram";var LA=PA;import{useRef as TA,useImperativeHandle as $A,forwardRef as IA,useCallback as NA}from"react";import{jsx as DA}from"react/jsx-runtime";var EA=IA(function(e,t){const o=my(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,yScaleType:p,extentPadding:m,categoryAccessor:g,colors:y,radius:b,fill:v,opacity:x,stroke:k,strokeWidth:w,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:$,linkedHover:I,selection:N,onObservation:D,chartId:E,loading:B,loadingContent:F,emptyContent:H,emphasis:z,legendPosition:O}=e,W=o.showAxes,j=o.enableHover,Y=r??o.marginDefaults,G=n??[o.width,o.height],V=C??M??eA({timeAccessor:u,valueAccessor:d}),X=TA(null),{customHoverBehavior:q}=uy({selection:N,linkedHover:I,unwrapData:!0,onObservation:D,chartType:"RealtimeSwarmChart",chartId:E}),U=NA(e=>{_&&_(e),q(e)},[_,q]);$A(t,()=>({push:e=>X.current?.push(e),pushMany:e=>X.current?.pushMany(e),remove:e=>X.current?.remove(e)??[],update:(e,t)=>X.current?.update(e,t)??[],clear:()=>X.current?.clear(),getData:()=>X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[]);const K=zp(B,G[0],G[1],F),Z=K?null:Hp(c,G[0],G[1],H),Q={};null!=b&&(Q.radius=b),null!=v&&(Q.fill=v),null!=x&&(Q.opacity=x),null!=k&&(Q.stroke=k),null!=w&&(Q.strokeWidth=w);const J=S,ee=z?`${i||""} semiotic-emphasis-${z}`.trim():i,te=tA(l,c);return K||Z||DA(su,{ref:X,chartType:"swarm",runtimeMode:"streaming",size:G,margin:Y,className:ee,arrowOfTime:a,windowMode:s,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,yScaleType:p,extentPadding:m,categoryAccessor:g,barColors:y,swarmStyle:Q,pointStyle:J,showAxes:W,background:A,hoverAnnotation:j,tooltipContent:V,...Am({linkedHover:I,selection:N,onObservation:D,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:L,tickFormatTime:T,tickFormatValue:$,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});EA.displayName="RealtimeSwarmChart";import{useRef as BA,useImperativeHandle as FA,forwardRef as HA,useCallback as zA}from"react";import{jsx as OA}from"react/jsx-runtime";var WA=HA(function(e,t){const o=my(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:p,positiveColor:m,negativeColor:g,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:k,opacity:w,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:_,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:L,tickFormatValue:T,linkedHover:$,selection:I,onObservation:N,chartId:D,loading:E,loadingContent:B,emptyContent:F,emphasis:H,legendPosition:z}=e,O=o.showAxes,W=o.enableHover,j=r??o.marginDefaults,Y=n??[o.width,o.height],G=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,r=QS(n,t,"time"),i=n?.delta??QS(n,o,"value"),a=n?.cumEnd,s="number"==typeof i?0>i?JS(i):"+"+JS(i):JS(i);return US("div",{className:"semiotic-tooltip",style:KS,children:[US("div",{children:[qS("span",{style:ZS,children:"x:"}),JS(r)]}),US("div",{children:[qS("span",{style:ZS,children:"Δ:"}),s]}),null!=a&&US("div",{children:[qS("span",{style:ZS,children:"total:"}),JS(a)]})]})}}({timeAccessor:u,valueAccessor:d}),V=BA(null),{customHoverBehavior:X}=uy({selection:I,linkedHover:$,unwrapData:!0,onObservation:N,chartType:"RealtimeWaterfallChart",chartId:D}),q=zA(e=>{M&&M(e),X(e)},[M,X]);FA(t,()=>({push:e=>V.current?.push(e),pushMany:e=>V.current?.pushMany(e),remove:e=>V.current?.remove(e)??[],update:(e,t)=>V.current?.update(e,t)??[],clear:()=>V.current?.clear(),getData:()=>V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[]);const U=zp(E,Y[0],Y[1],B),K=U?null:Hp(c,Y[0],Y[1],F),Z={};null!=m&&(Z.positiveColor=m),null!=g&&(Z.negativeColor=g),null!=y&&(Z.connectorStroke=y),null!=b&&(Z.connectorWidth=b),null!=v&&(Z.gap=v),null!=x&&(Z.stroke=x),null!=k&&(Z.strokeWidth=k),null!=w&&(Z.opacity=w);const Q=H?`${i||""} semiotic-emphasis-${H}`.trim():i,J=tA(l,c);return U||K||OA(su,{ref:V,chartType:"waterfall",runtimeMode:"streaming",size:Y,margin:j,className:Q,arrowOfTime:a,windowMode:s,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,extentPadding:p,waterfallStyle:Z,showAxes:O,background:S,hoverAnnotation:W,tooltipContent:G,...Am({linkedHover:$,selection:I,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:q}),annotations:_,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:L,tickFormatValue:T,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});WA.displayName="RealtimeWaterfallChart";import{useRef as jA,useImperativeHandle as YA,forwardRef as GA,useCallback as VA}from"react";import{jsx as XA}from"react/jsx-runtime";var qA=GA(function(e,t){const o=my(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:f,valueExtent:p,extentPadding:m,heatmapXBins:g=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:L,linkedHover:T,selection:$,onObservation:I,chartId:N,loading:D,loadingContent:E,emptyContent:B,emphasis:F,legendPosition:H}=e,z=o.showAxes,O=o.enableHover,W=r??o.marginDefaults,j=n??[o.width,o.height],Y=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,a=i?.xCenter??QS(i,t,"time"),s=i?.yCenter??QS(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return US("div",{className:"semiotic-tooltip",style:KS,children:[US("div",{children:[US("span",{style:ZS,children:[n,":"]}),JS(a)]}),US("div",{children:[US("span",{style:ZS,children:[r,":"]}),JS(s)]}),null!=l&&US("div",{children:[qS("span",{style:ZS,children:"count:"}),JS(l)]}),"sum"===d&&null!=c&&US("div",{children:[qS("span",{style:ZS,children:"sum:"}),JS(c)]}),"mean"===d&&null!=u&&US("div",{children:[qS("span",{style:ZS,children:"mean:"}),JS(u)]})]})}}({timeAccessor:u,valueAccessor:d}),G=jA(null),{customHoverBehavior:V}=uy({selection:$,linkedHover:T,unwrapData:!0,onObservation:I,chartType:"RealtimeHeatmap",chartId:N}),X=VA(e=>{w&&w(e),V(e)},[w,V]);YA(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const q=zp(D,j[0],j[1],E),U=q?null:Hp(c,j[0],j[1],B),K=F?`${i||""} semiotic-emphasis-${F}`.trim():i,Z=tA(l,c);return q||U||XA(su,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:j,margin:W,className:K,arrowOfTime:a,windowMode:s,windowSize:Z,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:f,yExtent:p,extentPadding:m,heatmapXBins:g,heatmapYBins:y,heatmapAggregation:b,showAxes:z,background:v,hoverAnnotation:O,tooltipContent:Y,...Am({linkedHover:T,selection:$,onObservation:I,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:L,legendPosition:H,pointIdAccessor:e.pointIdAccessor})});qA.displayName="RealtimeHeatmap";import*as UA from"react";function KA(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}function ZA(e){return 10>e?"0"+e:e+""}var QA=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function JA(e){let t,o=e;return(n,r,i)=>{const a=n instanceof Date?n:new Date(n);e||!i||2>i.length||i===t||(t=i,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":1728e5>o?"hours":5184e6>o?"days":3456e7>o?"months":"years"}(i));const s=o||"days";return null!=r&&0!==r&&i&&0!==i.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),r=n||e.getUTCMonth()!==t.getUTCMonth(),i=r||e.getUTCDate()!==t.getUTCDate(),a=i||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=QA[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=ZA(e.getUTCHours()),h=ZA(e.getUTCMinutes()),f=ZA(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${f}`:i?`${l} ${c} ${d}:${h}:${f}`:a?`${d}:${h}:${f}`:s?`${h}:${f}`:":"+f;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:r?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:r?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(i[r-1]),s):function(e,t){const o=QA[e.getUTCMonth()],n=e.getUTCDate(),r=e.getUTCFullYear(),i=ZA(e.getUTCHours()),a=ZA(e.getUTCMinutes()),s=ZA(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${r} ${i}:${a}:${s}`;case"minutes":case"hours":return`${o} ${n}, ${r} ${i}:${a}`;case"days":return`${o} ${n}, ${r}`;case"months":return`${o} ${r}`;case"years":return""+r}}(a,s)}}async function eC(e,t){const{format:o="png",filename:n="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),tC(a,s),"svg"===o){const e=(new XMLSerializer).serializeToString(s);oC(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*r,o=l.height*r,a=document.createElement("canvas");a.width=t,a.height=o;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,o),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(h),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),a.toBlob(o=>{o?(oC(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(f)},p.onerror=()=>{URL.revokeObjectURL(f),t(Error("Failed to load SVG image"))},p.src=f})}}function tC(e,t){const o=e.children,n=t.children,r=window.getComputedStyle(e),i=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of i){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&t.style?.setProperty(e,o)}for(let e=0;Math.min(o.length,n.length)>e;e++)tC(o[e],n[e])}function oC(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}var nC=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","PhysicsPileChart","CollisionSwarmChart","GauntletChart","ProcessFlowChart","PhysicalFlowChart","BigNumber"],rC=new Set(nC);function iC(e){return rC.has(e)}var aC=["value","threshold","partition-boundary","time-window","range-boundary"];function sC({controlType:e,controlId:t,chartId:o,chartType:n="VisualizationControl",onObservation:r}){return(i,a,s)=>{r?.({type:i,controlType:e,value:a,chartType:n,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...s?{source:s}:{}})}}function lC(e,t,o,n,r){return{id:e,...t?{controlId:t}:{},status:o,message:n,...r?{remediation:r}:{}}}function cC({controls:e=[],minimumTargetSize:t=24}){const o=[],n=new Set;for(const r of e){const e=r?.id,i="controls."+(e||"unknown"),a=r?.domain,s=Array.isArray(a)&&2===a.length&&Number.isFinite(a[0])&&Number.isFinite(a[1])&&a[1]>a[0],l=aC.includes(r?.type),c="string"==typeof r?.target&&r.target.trim().length>0,u=["slider","buttons","native-range"].includes(r?.keyboard??""),d=r?.minimumTargetSize;o.push(lC(i+".semantic-type",e,l?"pass":"fail",l?`Control uses the semantic type "${r.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(lC(i+".state-binding",e,c?"pass":"fail",c?`Control is bound to "${r.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(lC(i+".domain",e,s?"pass":"fail",s?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(lC(i+".keyboard",e,u?"pass":"fail",u?`Control declares a ${r.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(lC(i+".value-text",e,"string"==typeof r?.valueText&&r.valueText.trim().length>0?"pass":"fail","string"==typeof r?.valueText&&r.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),o.push(lC(i+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=r?.step&&o.push(lC(i+".step",e,Number.isFinite(r.step)&&r.step>0?"pass":"fail",Number.isFinite(r.step)&&r.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),r?.observations?.length&&o.push(lC(i+".observations",e,r.observations.includes("control-change")?"pass":"warn",r.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!n.has(e)||o.push(lC(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&n.add(e)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}function uC(e,t=new Set){if(null===e)return!0;const o=typeof e;if("string"===o||"boolean"===o)return!0;if("number"===o)return Number.isFinite(e);if("object"!==o)return!1;if(t.has(e))return!1;t.add(e);const n=Array.isArray(e)?e.every(e=>uC(e,t)):Object.entries(e).every(([,e])=>uC(e,t));return t.delete(e),n}var dC=Symbol.for("semiotic.chartRecipeRegistry");function hC(e){return function(){const e=globalThis;return e[dC]||(e[dC]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[dC]}().recipes.get(e)}function fC(e){return"string"==typeof e?hC(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function pC(e){return"string"==typeof e?e:e.id??e.name}function mC(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function gC(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function yC(e,t,o){return o??fC(t.recipe)??fC(t.recipeId)??hC(e)}function bC(e,t,o=[]){const n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;const r=o.find(e=>e&&"object"==typeof e);if(!r)return;const i=Object.entries(r).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in r):i.find(([,e])=>"string"==typeof e)?.[0]}function vC(e,t){return e.dataRoles.find(e=>e.role===t)}function xC(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function kC(e,t,o,n,r,i={}){const a={...i};if(t)for(const[e,o]of Object.entries(t))a[e]=o;for(const e of o.dataRoles){const o=bC(e,n,r),i=t&&o?t[o]:o;void 0!==i&&(a[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=a[t];return null==o?`{${t}}`:o+""})}var wC=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),SC=new Set(["data","nodes","edges","points","areas","lines","flows"]);function AC(e,t){return!!SC.has(e)&&("areas"!==e||"string"!=typeof t)}var CC="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function MC(e,t,o){const n=hC(e)??fC(t.recipe)??fC(t.recipeId);if(n)return function(e,t,o){const n=function(e,t,o){const n={};for(const[r,i]of Object.entries(e))if(null!=i&&!wC.has(r)&&"recipeId"!==r&&(t||!AC(r,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`)}else if(uC(i))n[r]=CC(i);else if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`);return n}(t,!1!==o?.includeData,"portable"===e.portability),r=e.intents.map(pC).filter(e=>!!e),i={name:e.name,intents:r,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!uC(n))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:n,manifest:i,version:"1",createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:n,manifest:i,version:"1",createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(n,t,o);if(!iC(e))throw Error(`Unknown component "${e}". Known components: ${nC.join(", ")}`);const r=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))null!=o&&(wC.has(e)||!r&&AC(e,o)||"function"!=typeof o&&(o?.$$typeof||(i[e]=CC(o))));return{component:e,props:i,version:"1",createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function _C(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=hC(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...CC(e.props),recipeId:e.recipeId}}}if(!iC(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:CC(e.props)}}function PC(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function RC(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}async function LC(e,t="json"){const o="jsx"===t?TC(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(o)}function TC(e){const{props:t}=e,o=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&o.push(` recipeId="${e.recipeId}"`);for(const[e,n]of Object.entries(t))if("string"==typeof n)o.push(` ${e}="${n}"`);else if("boolean"==typeof n&&!0===n)o.push(" "+e);else if("boolean"==typeof n&&!1===n)o.push(` ${e}={false}`);else if("number"==typeof n)o.push(` ${e}={${n}}`);else{const t=JSON.stringify(n);o.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(n,null,2)}}`)}return o.push("/>"),o.join("\n")}function $C(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function IC(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function NC(e){return"nominal"===e||"ordinal"===e}function DC(e){return"quantitative"===e||"temporal"===e}var EC={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},BC={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},FC={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function HC(e){e=function(e){if(!function(e){return e.usermeta?.idid}(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:o,...n}=e,{usermeta:r,...i}=t[0];return{...n,...i}}(e);const t=[],{type:o,markProps:r}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...o}=e;return{type:t,markProps:o}}(e.mark),i=e.encoding||{},a=i.x,s=i.y,l=i.color,c=i.size,u=i.theta,d=i.opacity;let h;e.data?.values?h=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||i.facet||i.row||i.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const f={};e.width&&(f.width=e.width),e.height&&(f.height=e.height);const p=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(p&&(f.title=p),l?.field&&(f.colorBy=l.field,l.scale?.scheme)){const e=EC[l.scale.scheme];e&&(f.colorScheme=e)}void 0!==d?.value&&(f.pointOpacity=d.value);const m=a?.aggregate,g=s?.aggregate;if(h&&(m||g)){const e=g?s:a,t=g?a:s,o=FC[e.aggregate];if(o&&t?.field&&e.field)h=function(e,t){const{groupBy:o,value:r,agg:i="sum"}=t,a=new Map;for(const t of e){const e=t[o]+"";a.has(e)||a.set(e,[]),a.get(e).push(Number(t[r]))}const s=[];for(const[e,t]of a){let r;switch(i){case"count":r=t.length;break;case"mean":r=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":r=n(t)[0];break;case"max":r=n(t)[1];break;default:r=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:r})}return s}(h,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&t?.field&&h){const e=new Map;for(const o of h){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}h=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if(a?.bin||s?.bin){const e="Histogram";h&&(f.data=h),a?.bin?(f.valueAccessor=a.field,s?.field&&(f.categoryAccessor=s.field),a.axis?.title&&(f.valueLabel=a.axis.title)):s?.bin&&(f.valueAccessor=s.field,a?.field&&(f.categoryAccessor=a.field),s.axis?.title&&(f.valueLabel=s.axis.title));const o=a?.bin||s?.bin,n="object"==typeof o?o.maxbins:void 0;return n&&(f.bins=n),OC(e,f,t)}let y;switch(o){case"bar":y=function(e,t,o,n,r,i,a){let s;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",n.stackBy=o.field):s="BarChart",NC(e?.type)&&DC(t?.type)?(n.categoryAccessor=e.field,n.valueAccessor=a?"value":t.field,e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)):DC(e?.type)&&NC(t?.type)?(n.categoryAccessor=t.field,n.valueAccessor=i?"value":e.field,n.orientation="horizontal",t?.axis?.title&&(n.categoryLabel=t.axis.title),e?.axis?.title&&(n.valueLabel=e.axis.title)):(e?.field&&(n.categoryAccessor=e.field),t?.field&&(n.valueAccessor=a?"value":t.field),e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)),r&&(n.data=r),s}(a,s,l,f,h,m,g);break;case"line":if(y="LineChart",zC(a,s,f,m,g),l?.field&&(f.lineBy=l.field),r.interpolate){const e=BC[r.interpolate];e&&(f.curve=e)}!0===r.point&&(f.showPoints=!0),h&&(f.data=h);break;case"area":if(l?.field?(y="StackedAreaChart",f.areaBy=l.field):y="AreaChart",zC(a,s,f,m,g),r.interpolate){const e=BC[r.interpolate];e&&(f.curve=e)}void 0!==r.opacity&&(f.areaOpacity=r.opacity),h&&(f.data=h);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",f.sizeBy=c.field,c.scale?.range&&(f.sizeRange=c.scale.range)):y="Scatterplot",zC(a,s,f,m,g),h&&(f.data=h);break;case"rect":y="Heatmap",a?.field&&(f.xAccessor=a.field),s?.field&&(f.yAccessor=s.field),l?.field&&(f.valueAccessor=l.field,delete f.colorBy),a?.axis?.title&&(f.xLabel=a.axis.title),s?.axis?.title&&(f.yLabel=s.axis.title),h&&(f.data=h);break;case"arc":r.innerRadius&&r.innerRadius>0?(y="DonutChart",f.innerRadius=r.innerRadius):y="PieChart",u?.field?f.valueAccessor=u.field:s?.field&&(f.valueAccessor=g?"value":s.field),l?.field&&(f.categoryAccessor=l.field),a?.field&&!u?.field&&(f.categoryAccessor=a.field),h&&(f.data=h);break;case"tick":y="DotPlot",NC(a?.type)?(f.categoryAccessor=a.field,s?.field&&(f.valueAccessor=g?"value":s.field),a?.axis?.title&&(f.categoryLabel=a.axis.title),s?.axis?.title&&(f.valueLabel=s.axis.title)):NC(s?.type)?(f.categoryAccessor=s.field,a?.field&&(f.valueAccessor=m?"value":a.field),f.orientation="horizontal",s?.axis?.title&&(f.categoryLabel=s.axis.title),a?.axis?.title&&(f.valueLabel=a.axis.title)):(a?.field&&(f.categoryAccessor=a.field),s?.field&&(f.valueAccessor=g?"value":s.field)),h&&(f.data=h);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),y="Scatterplot",zC(a,s,f,m,g),h&&(f.data=h)}return OC(y,f,t)}function zC(e,t,o,n,r){e?.field&&(o.xAccessor=n?"value":e.field),t?.field&&(o.yAccessor=r?"value":t.field),e?.axis?.title&&(o.xLabel=e.axis.title),t?.axis?.title&&(o.yLabel=t.axis.title)}function OC(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}import*as WC from"react";var jC=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),YC=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),GC=new Set(["PieChart","DonutChart","FunnelChart"]),VC=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function XC(e,t){return YC.has(e)||GC.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function qC(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function UC(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function KC(e,t={}){const o=!0===t.showRetractedAnnotations,n=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!o)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!n)})}var ZC={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",PhysicsPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PhysicalFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",PhysicsCustomChart:"custom physics chart"},QC=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),JC=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function eM(e){return ZC[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function tM(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var oM=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),nM={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},rM={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},iM=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],aM={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var sM=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),lM=new Set(["system","agent","watcher"]),cM=new Set(["ai","agent","system","computed","dbt","great-expectations"]),uM=new Set(["rule","statistical-test","llm-inference","computed"]);function dM(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!sM.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(lM.has(o.authorKind)||cM.has(o.source)||uM.has(o.basis))})}function hM(e="en"){let t,o;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?o.format(e):t.format(e):e+""}var fM={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function pM(e){const t=fM["string"==typeof e.type?e.type:"annotation"]||"an annotation",o=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,o=t?.authorKind??t?.source??t?.basis;return"watcher"===o?"a watcher-flagged ":"agent"===o||"ai"===o||"llm-inference"===o?"an AI-suggested ":""}(e),n=o?o+t.replace(/^an? /,""):t,r="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return r?`${n} labeled "${r}"`:n}function mM(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=KC(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const n=o.map(pM),r=n.slice(0,5),i=n.length-r.length,a=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(r)+(i>0?`, and ${i} more`:""),s=o.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}function gM(e,t,o={}){const n=void 0!==o.levels,r=new Set(o.levels??["l1","l2","l3"]);n||!o.capability&&!dM(t)||r.add("l4");const i=yC(e,t,o.recipe);if(i){const e=["l1","l2","l3","l4"].filter(e=>r.has(e));n||e.includes("l4")||e.push("l4");const a=function(e,t,o={}){const n=gC(t),r=mC(t),i=o.locale??"en",a="function"==typeof e.description?e.description({data:n,config:r,locale:i}):void 0,s=a?.levels??function(e,t,o,n){const r=xC(e,["nominal","ordinal"]),i=xC(e,["quantitative"]),a=r?bC(r,o,t):void 0,s=i?bC(i,o,t):void 0,l=r?.role??a??"category",c=i?.role??s??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:f}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(n),p=new Map;if(a&&s)for(const e of t){const t=(e[a]??"Uncategorized")+"",o=Number(e[s]);Number.isFinite(o)&&p.set(t,(p.get(t)??0)+o)}const m=[...p].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,x=e.intents.map(e=>({id:pC(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,k=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=d,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:m.length>0?`${m.length} categories total ${h.format(g)}. ${y[0]} accounts for ${h.format(y[1])}${g>0?` (${f.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${m.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${f.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${k?` with a ${k} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,n,r,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=o.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}(i,t,{levels:e,locale:o.locale,audience:o.audience,includeCaveats:o.includeCaveats}),s=mM(t);return{...a,text:s?`${s} ${a.text}`.trim():a.text,...s?{annotations:s}:{}}}const a=hM(o.locale??"en"),s=eM(e),l=Array.isArray(t.data)?t.data:null,c=qC(t),u=JC.has(e)?function(e,t){const o=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,r=[e.settledProjectionRows,e.projectionRows,n?.rows,o?.settledProjectionRows,o?.projectionRows,o?.settledProjection&&"object"==typeof o.settledProjection?o.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(r)?r.map((e,o)=>{if(!e||"object"!=typeof e)return null;const n=e,r=tM(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return null;const i=n.label??n.id??n.name??"container "+(o+1),a=tM(n.secondary??n.secondaryCount),s=tM(n.observed??n.observedCount);return{label:UC(i,t),count:r,...null!=a?{secondary:a}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(t,a):null,{measure:d,measureFallback:h,dimension:f,dimensionFallback:p}=XC(e,t),m="string"==typeof d&&d?d:h,g="string"==typeof f&&f?f:p,y={};if(JC.has(e)&&function(e,t,o,n,r,i){const a=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PhysicalFlowChart"===e?"packet":"body"}(e);if(r.has("l1")&&(n.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"PhysicsPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PhysicalFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!r.has("l2")&&!r.has("l3"))return;if(!o||0===o.length)return void(r.has("l2")&&(n.l2="No settled projection is loaded yet."));const l=o.reduce((e,t)=>e+t.count,0),c=o.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??o.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const d=o.reduce((e,t)=>e+(t.secondary??0),0),h=o.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(r.has("l2"))if(0===c.length)n.l2=`The settled projection contains ${i(l)} ${bM(l,s)} across ${o.length} ${bM(o.length,a)}; no ${bM(2,a)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${bM(d,s)} ${1===d?"is":"are"} marked ${h}.`:"";n.l2=`The settled projection contains ${i(l)} ${bM(l,s)} across ${o.length} ${bM(o.length,a)}; ${c.length} ${bM(c.length,a)} ${1===c.length?"is":"are"} non-empty. The largest ${a} is ${u.label} with ${i(u.count)} ${bM(u.count,s)}.${e}`}if(r.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const o=e/t*100;return(10>o?Math.round(10*o)/10:Math.round(o))+"%"}(u.count,l);n.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${i(u.count)} ${bM(u.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${bM(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${bM(u.count,s)}.`}}(e,s,u,y,r,a),r.has("l1")&&!JC.has(e))if(jC.has(e)||YC.has(e))y.l1=`A ${s} of ${m} by ${g}`+(c?`, split by ${c}.`:".");else if(GC.has(e))y.l1=`A ${s} showing ${m} across ${g} categories.`;else if(VC.has(e))y.l1=`A ${s} of the distribution of ${m}`+(c?` by ${c}.`:".");else if(QC.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${bM(e,"node")}`:null,null!=o?`${o} ${bM(o,"edge")}`:null].filter(Boolean);y.l1=`A ${s}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:m;y.l1=`A single value${e?" for "+e:""}.`}else y.l1=`A ${s}.`;const b=jC.has(e)||YC.has(e)||GC.has(e)||VC.has(e);let v=null;if((r.has("l2")||r.has("l3")||r.has("l4"))&&b&&l&&l.length>0&&(v=function(e,t,o,n){let r=0,i=0,a=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,f=null,p=NaN,m=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===r&&(p=e,h=o),m=e,f=o,a>e&&(a=e,l=o,u=r),e>s&&(s=e,c=o,d=r),r++,i+=e)}return 0===r?null:{count:r,min:a,max:s,mean:i/r,minLabel:UC(null!=l?o(l):null,n),maxLabel:UC(null!=c?o(c):null,n),first:p,last:m,firstLabel:UC(null!=h?o(h):null,n),lastLabel:UC(null!=f?o(f):null,n),minIndex:u,maxIndex:d}}(l,ee(d,h),te(f,p),a)),r.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=GC.has(e)?`${v.count} segments totaling ${a(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${a(v.max)}; smallest is ${v.minLabel} at ${a(v.min)}.`:`${m} ranges from ${a(v.min)} (${v.minLabel}) to ${a(v.max)} (${v.maxLabel}), with a mean of ${a(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),r.has("l3")&&v&&!c&&jC.has(e)?y.l3=function(e,t,o){const{first:n,last:r,min:i,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:f}=e,p=a-i,m=r-n;if(0===p)return`${yM(t)} is constant at ${o(n)} across the series.`;if(.04>p/(Math.abs(e.mean)||1))return`${yM(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(a)}.`;const g=h>0&&f-1>h,y=d>0&&f-1>d,b=(a-Math.max(n,r))/p,v=(Math.min(n,r)-i)/p;return g&&b>.15?`Overall ${t} climbs to a peak of ${o(a)} (${s}), then falls to ${o(r)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${o(i)} (${l}), then recovers to ${o(r)} (${u}).`:.05>Math.abs(m)/p?`${yM(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(a)}.`:m>0?h===f-1?`Overall ${t} rises from ${o(n)} (${c}) to a peak of ${o(r)} (${u}).`:`Overall ${t} rises from ${o(n)} (${c}) to ${o(r)} (${u}), after peaking at ${o(a)} (${s}).`:d===f-1?`Overall ${t} falls from ${o(n)} (${c}) to a low of ${o(r)} (${u}).`:`Overall ${t} falls from ${o(n)} (${c}) to ${o(r)} (${u}), after dipping to ${o(i)} (${l}).`}(v,m,a):r.has("l3")&&v&&!c&&YC.has(e)&&(y.l3=`The highest ${g} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),r.has("l4")){const n=dM(t)?"alerting":function(e,t){const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,o={};for(const[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(o[e]=n);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(o?.act)return o.act;if(o?.intentScores){const e=function(e){let t,o=0;for(const[n,r]of Object.entries(e))if("number"==typeof r&&r>0)if(r>o)t=n,o=r;else if(r===o&&void 0!==t){const e=iM.indexOf(n),o=iM.indexOf(t);-1===e||-1!==o&&e>=o||(t=n)}return t}(o.intentScores);if(e&&nM[e]&&(o.intentScores[e]??0)>=3)return nM[e]}return o?.family?rM[o.family]:function(e){return GC.has(e)||"StackedAreaChart"===e?"apportioning":oM.has(e)?"relating":YC.has(e)?"comparing":VC.has(e)?"characterizing":jC.has(e)?"tracking":QC.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);n&&(y.l4=function(e,t,o,n,r,i,a,s){const l=aM[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof o.label&&o.label?o.label:r} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${i} and ${r} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,n,r,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+o;case"comparing":return`compare ${o} across ${n}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(YC.has(o)||GC.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:n,last:r,min:i,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,f=a-i;if(f>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,p=(a-Math.max(n,r))/f,m=(Math.min(n,r)-i)/f;if(e&&p>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(o&&m>.15)return`the dip to ${t(i)} at ${s} is the point to investigate`;if(r>=a)return`the climb to ${t(r)} at ${c} warrants a closer look`;if(i>=r)return`the drop to ${t(r)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(a)}) and ${s} (${t(i)}) — are the points to check`}(t,r,i);case"tracking":return`read it for the trajectory of ${o}, which ${function(e){const t=e.max-e.min,o=e.last-e.first;return 0===t||.05>Math.abs(o)/t?"holds roughly steady":o>0?"rises":"falls"}(t)} from ${r(t.first)} (${t.firstLabel}) to ${r(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${n}; ${t.maxLabel} leads at ${r(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${r(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${r(e)} total; ${t.maxLabel} is the largest at ${r(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${r(t.min)} to ${r(t.max)}`;default:return"read the highlighted features"}}(e,n,r,i,a,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${eM(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(n,e,t,c?null:v,m,g,a,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>r.has(e)&&y[e]).map(e=>y[e]).join(" "),k=mM(t);return{text:k?`${k} ${x}`.trim():x,levels:y,...k?{annotations:k}:{}}}function yM(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function bM(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function vM(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function xM(e,t,o={}){const n=o.locale??"en",r=Math.max(1,o.maxLeaves??200),i=hM(n),a=yC(e,t,o.recipe);if(a)return function(e,t,o={}){const n=gC(t),r=mC(t),i=Math.max(1,o.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:r,locale:o.locale??"en"});const a=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(a?.groupByRole?vC(e,a.groupByRole):void 0)??(a?.groupBy?.[0]?vC(e,a.groupBy[0])??e.dataRoles.find(e=>e.field===a.groupBy?.[0]):void 0)??xC(e,["nominal","ordinal"]),c=l?bC(l,r,n):void 0,u=(a?.idRole?vC(e,a.idRole):void 0)??xC(e,["identifier"]),d=u?bC(u,r,n):void 0,h={id:"root",role:"chart",label:a?.summaryTemplate?kC(a.summaryTemplate,void 0,e,r,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]};let f=0;const p=(t,o,i)=>{const s=d?t[d]:void 0,l=a?.itemLabelTemplate?kC(a.itemLabelTemplate,t,e,r,n,{count:n.length}):function(e,t,o,n){const r=xC(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),a=r?bC(r,o,n):void 0,s=[];a&&null!=e[a]&&s.push(e[a]+"");for(const t of i){const r=bC(t,o,n);r&&null!=e[r]&&s.push(`${t.role}: ${e[r]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,r,n);return{id:"datum-"+vM(s??o),role:"datum",label:l,level:i,datum:t}};if(c){const e=new Map;for(const t of n){const o=(t[c]??"Uncategorized")+"",n=e.get(o);n?n.push(t):e.set(o,[t])}h.children=[...e].map(([e,t],o)=>{const n=t.slice(0,Math.max(0,i-f));f+=n.length;const r=n.map((e,t)=>p(e,1e5*o+t,3));return t.length>n.length&&r.push({id:"more-"+vM(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+vM(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:r}})}else{const e=n.slice(0,i);h.children=e.map((e,t)=>p(e,t,2)),n.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return h}(a,t,{maxLeaves:r,locale:n});const s={id:"root",role:"chart",label:gM(e,t,{locale:n}).text||"Chart.",level:1,children:[]},l=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const n=KC(o.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let r=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,o=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+r++,role:"annotation",level:3,label:`${n=pM(e),n?n.charAt(0).toUpperCase()+n.slice(1):n}${o}.`,datum:e};var n});n.length>t&&i.push({id:"annotation-"+r++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const a=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:i}}(t,r),c=Array.isArray(t.data)?t.data:null,u=jC.has(e)||YC.has(e)||GC.has(e)||VC.has(e);if(!c||0===c.length||!u)return l&&(s.children=[l]),s;const{measure:d,measureFallback:h,dimension:f,dimensionFallback:p}=XC(e,t),m=ee(d,h),g=te(f,p),y="string"==typeof d&&d?d:h,b="string"==typeof f&&f?f:p,v=qC(t);let x=0;const k=e=>`${e}-${x++}`,w=(e,t)=>{const o=e.slice(0,r).map(e=>((e,t)=>{const o=m(e),n=UC(g(e),i);return{id:k("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(o)?i(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>r&&o.push({id:k("more"),role:"datum",level:t,label:`…and ${e.length-r} more points`}),o},S=[];if(jC.has(e)||YC.has(e)){let t=1/0,o=-1/0,n=1/0,r=-1/0;const a=[];let s=!0;for(const e of c){const i=m(e);Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));const l=g(e);a.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):s=!1}const l=new Set,u=[];for(const e of a){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=s?`${i(n)} to ${i(r)}`:`${UC(u[0],i)} to ${UC(u[u.length-1],i)} (${YC.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:k("axis"),role:"axis",level:2,label:`${YC.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:k("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=te(v,v),r=new Map;for(const e of c){const t=(o(e)??"—")+"",n=r.get(t);n?n.push(e):r.set(t,[e])}const i=[];for(const[o,a]of r){const r=gM(e,{...t,data:a},{levels:["l2","l3"],locale:n}).text;i.push({id:k("series"),role:"series",level:2,label:`Series ${o}: ${r}`,children:w(a,3)})}s.children=[...S,...i]}else s.children=[...S,...w(c,2)];return l&&s.children.push(l),s}import*as kM from"react";var wM=null,SM=new Set,AM=new Set;function CM(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function MM(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>CM(e,t))}catch(t){CM(e,t)}}var _M=Object.freeze([]),PM=_M,RM=!1;function LM(){RM=!0}var TM=new Set;function $M(){for(const e of TM)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function IM(){return wM}var NM={get enabled(){return wM?.enabled??!1},get sessionId(){return wM?.sessionId??null},get capacity(){return wM?.capacity??0},record(e){const t=IM();if(!t||!t.enabled)return null;const o={...e,timestamp:e.timestamp??Date.now(),sessionId:e.sessionId??t.sessionId};for(t.buffer.push(o);t.buffer.length>t.capacity;)t.buffer.shift();LM(),$M();for(const e of SM)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of AM)t.record&&MM("sink record",()=>t.record?.(e))}(o),o},flush(){const e=IM();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],LM(),$M(),function(e){for(const t of AM)t.flush&&MM("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>RM?(PM=wM?Object.freeze(wM.buffer.slice()):_M,RM=!1,PM):PM,subscribe:e=>(SM.add(e),()=>{SM.delete(e)}),clear(){const e=IM();e&&(e.buffer=[],LM(),$M()),function(){for(const e of AM)e.clear&&MM("sink clear",()=>e.clear?.())}()},reset(){if(SM.clear(),AM.clear(),PM=_M,RM=!1,!wM)return $M(),void TM.clear();wM.buffer=[],wM.enabled=!1,wM=null,$M(),TM.clear()}};import{jsx as DM,jsxs as EM}from"react/jsx-runtime";var BM={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function FM({tree:e,label:t,visible:o=!1,className:n,onActiveChange:r,activeId:i,chartId:a,onObservation:s,onAnnotationActivate:l}){const[c,u]=kM.useState(()=>new Set([e.id])),[d,h]=kM.useState(e.id),f=void 0!==i,p=f?i:d,m=kM.useRef(null),g=kM.useRef(new Map),y=ki(e=>e.pushObservation),b=kM.useCallback(e=>{s?.(e),y?.(e)},[s,y]),v=kM.useMemo(()=>function(e){const t=new Map,o=e=>{for(const n of e.children??[])t.set(n.id,e),o(n)};return o(e),t}(e),[e]),x=kM.useMemo(()=>function(e,t){const o=[],n=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)n(t)};return n(e),o}(e,c),[e,c]);kM.useEffect(()=>{f||x.some(e=>e.id===d)||h(e.id)},[x,d,e.id,f]),kM.useEffect(()=>{const e=[];let t=v.get(p);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&u(t=>{if(e.every(e=>t.has(e)))return t;const o=new Set(t);for(const t of e)o.add(t);return o})},[p,v]),kM.useEffect(()=>{m.current?.contains(document.activeElement)&&g.current.get(p)?.focus()},[p]);const k=kM.useCallback((e,t,o)=>{NM.enabled&&NM.record("focus"===t?{type:"nav-node-focused",chartId:a,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:a,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[a]),w=kM.useCallback(e=>{e.id!==p&&(f||h(e.id),r?.(e),k(e,"focus"),e.datum&&b({type:"focus",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:a}))},[r,f,k,p,b,a]),S=kM.useCallback(e=>{if(e.datum){if("annotation"===e.role){const t=Si(e.datum);return l?.({annotation:e.datum,annotationId:t,chartId:a,inputType:"navigation-tree"}),void(t&&b({type:"annotation-activate",annotationId:t,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:a}))}b({type:"activate",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:a})}},[a,b,l]),A=e=>{u(t=>new Set(t).add(e.id)),k(e,"toggle",!0)},C=e=>{u(t=>{const o=new Set(t);return o.delete(e.id),o}),k(e,"toggle",!1)},M=(e,t,n)=>{const r=!!e.children&&e.children.length>0,i=c.has(e.id);return EM("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":n,"aria-expanded":r?i:void 0,"aria-selected":e.id===p,tabIndex:e.id===p?0:-1,ref:t=>{g.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),w(e),r?(i?C:A)(e):S(e)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===p?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[EM("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&r?i?"▾ ":"▸ ":"",e.label]}),r&&i&&DM("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>M(t,o+1,e.children.length))})]},e.id)};return DM("div",{ref:m,className:"semiotic-nav-tree"+(n?" "+n:""),style:o?void 0:BM,onKeyDown:e=>{const t=x.findIndex(e=>e.id===p);if(-1===t)return;const o=x[t],n=!!o.children&&o.children.length>0,r=c.has(o.id);let i=!0;switch(e.key){case"ArrowDown":w(x[Math.min(t+1,x.length-1)]);break;case"ArrowUp":w(x[Math.max(t-1,0)]);break;case"Home":w(x[0]);break;case"End":w(x[x.length-1]);break;case"ArrowRight":n&&!r?A(o):n&&r?w(o.children[0]):i=!1;break;case"ArrowLeft":if(n&&r)C(o);else{const e=v.get(o.id);e?w(e):i=!1}break;case"Enter":case" ":n?(r?C:A)(o):S(o);break;default:i=!1}i&&(e.preventDefault(),e.stopPropagation())},children:DM("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:M(e,1,1)})})}import*as HM from"react";import{jsx as zM,jsxs as OM}from"react/jsx-runtime";function WM(e,t,o=0){const n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=Math.max(n,Math.min(r,e[0])),a=Math.max(n,Math.min(r,e[1])),s=i>a?[a,i]:[i,a];if(s[1]-s[0]>=o)return s;const l=(s[0]+s[1])/2,c=o/2;return[Math.max(n,Math.min(r-o,l-c)),Math.min(r,Math.max(n+o,l+c))]}function jM(e,t,o,n=1,r=n){const i="in"===o?n:-n;return WM([e[0]+i,e[1]-i],t,r)}function YM(e){const{domain:t,initialValue:o=t,step:n=1,minSpan:r=n,label:i,formatValue:a,onChange:s}=e,[l,c]=HM.useState(()=>WM(o,t,r)),u=WM(l,t,r),d=HM.useCallback(e=>{const o=WM(e,t,r);c(o),s?.(o)},[t,r,s]),h=HM.useMemo(()=>({label:i,domain:t,value:u,step:n,formatValue:a,onChange:d,onClear:()=>d(t)}),[t,a,i,d,n,u]),f=HM.useMemo(()=>({onZoomIn:()=>d(jM(u,t,"in",n,r)),onZoomOut:()=>d(jM(u,t,"out",n,r)),onReset:()=>d(t)}),[t,r,d,n,u]);return{value:u,setValue:d,xExtent:u,brush:h,zoom:f}}var GM={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},VM={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function XM(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function qM(e){return"function"==typeof e}function UM({brush:e,targetSize:t}){const o=e?.value,n=e?.domain,r=!!o&&!!n,i=!0===e?.disabled,a=e?.formatValue??(e=>e),s=!!e?.onChange&&r&&!i,l=n?.[0]??0,c=n?.[1]??1,u=o?.[0]??l,d=o?.[1]??c,h=e?.step??((c-l)/100||1);return OM("section",{style:GM,"aria-label":"Brush controls",children:[zM("div",{style:VM,children:e?.label??"Filter range"}),r?OM("div",{style:{display:"grid",gap:8},children:[OM("label",{style:{display:"grid",gap:4,fontSize:12},children:[OM("span",{children:["Start: ",a(u)]}),zM("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!s,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),OM("label",{style:{display:"grid",gap:4,fontSize:12},children:[OM("span",{children:["End: ",a(d)]}),zM("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!s,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):zM("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),zM("button",{type:"button",disabled:i||!qM(e?.onClear),onClick:e?.onClear,style:XM(t),children:"Clear range"})]})}function KM({zoom:e,targetSize:t}){const o=!0===e?.disabled;return OM("section",{style:GM,"aria-label":"Zoom controls",children:[zM("div",{style:VM,children:e?.label??"Zoom"}),OM("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[zM("button",{type:"button","aria-label":"Zoom out",disabled:o||!qM(e?.onZoomOut),onClick:e?.onZoomOut,style:XM(t),children:"-"}),zM("button",{type:"button","aria-label":"Reset zoom",disabled:o||!qM(e?.onReset),onClick:e?.onReset,style:XM(t),children:"Reset"}),zM("button",{type:"button","aria-label":"Zoom in",disabled:o||!qM(e?.onZoomIn),onClick:e?.onZoomIn,style:XM(t),children:"+"})]})]})}function ZM({legend:e,targetSize:t}){const o=!0===e?.disabled,n=e?.items??[];return OM("section",{style:GM,"aria-label":"Legend controls",children:[zM("div",{style:VM,children:e?.label??"Series"}),n.length>0&&zM("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:n.map(n=>{const r=!1!==n.active;return OM("button",{type:"button",disabled:o||n.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(n.id,!r),style:XM(t,r),"aria-pressed":r,children:[n.color&&zM("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:n.color}}),n.label??n.id]},n.id)})}),OM("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[zM("button",{type:"button",disabled:o||!qM(e?.onShowAll),onClick:e?.onShowAll,style:XM(t),children:"Show all"}),zM("button",{type:"button",disabled:o||!qM(e?.onHideAll),onClick:e?.onHideAll,style:XM(t),children:"Hide all"})]})]})}function QM({controls:e,targetSize:t=44,compact:o=!1,className:n,style:r,ariaLabel:i="Mobile chart controls",brush:a,zoom:s,legend:l}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const o=[];return t.brush&&o.push("brush"),t.zoom&&o.push("zoom"),t.legend&&o.push("legend"),o}(e,{brush:a,zoom:s,legend:l});return 0===c.length?null:OM("div",{className:n,role:"group","aria-label":i,style:{display:"grid",gridTemplateColumns:o?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...r},children:[c.includes("brush")&&zM(UM,{brush:a,targetSize:t}),c.includes("zoom")&&zM(KM,{zoom:s,targetSize:t}),c.includes("legend")&&zM(ZM,{legend:l,targetSize:t})]})}var JM=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),e_=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),t_={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function o_(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function n_(e){return"string"==typeof e&&e.trim().length>0}function r_(e){const t=o_(e.capability)?e.capability:null,o=o_(e.recipe)?e.recipe:null,n=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of n)if(o_(e))return e;return null}function i_(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function a_(e){return i_(e.size)||i_(o_(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function s_(e,t){e.push({...t,status:"pass"})}function l_(e,t){e.push({...t,status:"warn"})}function c_(e,t){e.push({...t,status:"manual"})}function u_(e,t={},o={}){const n=o.viewportWidth??390,r=o.targetSize??44,i=a_(t),a=Qg(t,{width:n,height:i?.[1]}),s=[],l=a_(t=a.props),c=r_(t),u=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),d=function(e){const t=r_(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),h=!0===o.inChartContainer,f=n_(t.title)||n_(t.summary)||n_(t.description)||!0===c?.summary||n_(c?.summary);if(a.matches.length>0&&s_(s,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${a.matches.length} responsive rule(s) applied for the ${n}px mobile audit.`}),l){const[t,o]=l;t>n&&!d?l_(s,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${n}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):s_(s,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof c?.minViewportWidth&&c.minViewportWidth>n&&l_(s,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${c.minViewportWidth}px minimum, wider than the audited ${n}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const r=t/Math.max(1,o);430>=n&&r>2.4&&"BigNumber"!==e&&l_(s,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${r.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>o&&"BigNumber"!==e&&l_(s,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${o}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else c_(s,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const p=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,o_(e.frameProps)?e.frameProps.data:void 0];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o}(t);p>0&&(p>("number"==typeof c?.maxMarks?c.maxMarks:JM.has(e)?1.25*n:e_.has(e)?Math.max(8,Math.floor(n/34)):n)?l_(s,{id:"density.mark-budget",category:"density",impact:JM.has(e)?"medium":"high",message:`${p} data item(s) exceed the rough mobile density budget for ${e} at ${n}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):s_(s,{id:"density.mark-budget",category:"density",impact:"medium",message:p+" data item(s) are within the rough mobile density budget for this component."}));const m=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o>0?o:null}(t),g=!1!==t.showAxes&&!1!==t.axis;if(g&&null!=m){const e=Math.max(3,Math.floor(n/58));m>e&&l_(s,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${m} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${n}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else g&&(JM.has(e)||e_.has(e))&&c_(s,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=o_(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=r_(e),o=o_(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===o?.tapToSelect||!0===o?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||n_(t?.interaction?.hoverFallback)}(e)}(t)?s_(s,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):l_(s,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const o=t_[e];if(!o)return null;let n=o.includes("hoverRadius")?30:null;for(const e of o){const o=t[e];"number"==typeof o&&Number.isFinite(o)&&o>0&&(n=null==n?o:Math.max(n,o))}return null==n?null:2*n}(e,t),b=o_(t.mobileInteraction)?t.mobileInteraction:null,v=y??("number"==typeof b?.targetSize?b.targetSize:!0===t.mobileInteraction?44:"number"==typeof c?.minimumHitTarget?c.minimumHitTarget:"number"==typeof c?.interaction?.targetSize?c.interaction.targetSize:null);null!=v&&(24>v?l_(s,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${v}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):r>v?l_(s,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, above 24px but below the ${r}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):s_(s,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, meeting the configured ${r}px target.`}));const x=[];null==t.brush&&null==t.onBrush||x.push("brush"),!0===t.zoomable&&x.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||x.push("legend filtering"),x.length>0&&!function(e,t){const o=r_(e),n=o_(e.mobileInteraction)?e.mobileInteraction:null,r=n?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(o?.interaction?.alternatives)&&o.interaction.alternatives.length>0)||!0===r||"all"===r||t.every(e=>"brush"===e?Array.isArray(r)?r.includes("brush"):"brush"===r:"pan/zoom"===e?Array.isArray(r)?r.includes("zoom"):"zoom"===r:"legend filtering"===e&&(Array.isArray(r)?r.includes("legend"):"legend"===r))}(t,x)&&l_(s,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${x.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===c?.labels?.strategy||"inline"===c?.labels?.strategy||"external"===c?.labels?.strategy||n>430||l_(s,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>o_(e)):[];if(k.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=n&&l_(s,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!n_(e.mobileText)&&!n_(e.shortText)&&!n_(e.label));e.length>0&&c_(s,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}d||"BigNumber"===e||c_(s,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(c?(s_(s,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===c.custom?.dataBearingSceneNodes?l_(s,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==c.custom?.dataBearingSceneNodes&&c_(s,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):c_(s,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),f||h||l_(s,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const w=s.filter(e=>"warn"===e.status),S={highRisk:w.filter(e=>"high"===e.impact).length,warnings:w.length,manual:s.filter(e=>"manual"===e.status).length,passes:s.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:n,ok:0===S.highRisk,summary:S,findings:s,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}function d_(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function h_(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function f_(e){return Array.isArray(e)?e.length>0:!!e}import{Fragment as p_,jsx as m_,jsxs as g_}from"react/jsx-runtime";var y_={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function b_(){const e=function(){const e=as.useContext(ls);return e?e.toggle:null}();return e?m_("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:P_,children:g_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[m_("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),m_("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),m_("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var v_={info:"var(--semiotic-info, #2563eb)",success:"var(--semiotic-success, #16a34a)",warning:"var(--semiotic-warning, #d97706)",error:"var(--semiotic-error, var(--semiotic-danger, #dc2626))",neutral:"var(--semiotic-text-secondary, #6b7280)"},x_={error:4,warning:3,info:2,success:1,neutral:0};function k_({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return g_("svg",{...t,children:[m_("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),m_("path",{d:"M8 6.4v3.4"}),m_("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return g_("svg",{...t,children:[m_("circle",{cx:"8",cy:"8",r:"6.4"}),m_("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return g_("svg",{...t,children:[m_("circle",{cx:"8",cy:"8",r:"6.4"}),m_("path",{d:"M8 7.4V11"}),m_("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return g_("svg",{...t,children:[m_("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),m_("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function w_({notification:e,level:t,onDismiss:o}){const n=v_[t]??v_.info,r=!1!==e.dismissible;return g_("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+n,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[g_("div",{style:{flex:1,minWidth:0},children:[e.source&&m_("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&m_("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:n},children:e.title}),m_("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),r&&m_("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...P_,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function S_({visible:e,onDismiss:t}){const[o,n]=WC.useState(!1),r=WC.useRef(null),i=WC.useRef(null);if(WC.useEffect(()=>{0===e.length&&o&&n(!1)},[e.length,o]),WC.useEffect(()=>{if(!o)return;const e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},t=e=>{"Escape"===e.key&&(n(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),0===e.length)return null;const a=e.reduce((e,t)=>x_[t.level]>x_[e]?t.level:e,e[0].level),s=v_[a]??v_.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${a}`;return g_("div",{ref:r,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[m_("span",{style:y_,role:"status","aria-live":"polite",children:c}),g_("button",{ref:i,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${c}. ${o?"Hide":"Show"} notifications`,title:c,onClick:()=>n(e=>!e),style:{...P_,color:s,position:"relative"},children:[m_(k_,{level:a}),m_("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:s,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&m_("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>m_(w_,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var A_={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function C_({height:e}){return m_("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function M_({error:e}){return m_("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:m_("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var __=WC.forwardRef(function({title:e,subtitle:t,children:o,width:n="100%",height:r=400,actions:i,chartConfig:a,describe:s,navigable:l,controls:c,banner:u,notifications:d,onNotificationDismiss:h,loading:f=!1,error:p,errorBoundary:m=!1,status:g,detailsPanel:y,mobile:b,mobileAudit:v,className:x,style:k},w){const S=WC.useRef(null),A=WC.useRef(null),[C,M]=WC.useState(!1),[_,P]=WC.useState(()=>new Set);WC.useEffect(()=>{P(e=>{if(0===e.size)return e;const t=new Set((d??[]).map((e,t)=>e.id??t+""));let o=!1;const n=new Set;for(const r of e)t.has(r)?n.add(r):o=!0;return o?n:e})},[d]);const R=WC.useMemo(()=>d?d.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!_.has(e)):[],[d,_]),L=WC.useCallback(e=>{P(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),T=!1!==i?.export&&void 0!==i?.export,$=!1!==i?.fullscreen&&void 0!==i?.fullscreen,I=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&a,N=!0===i?.dataSummary,D=WC.useMemo(()=>{if(!s||!a?.component||!a?.props)return"";const e="object"==typeof s?s.levels:void 0;try{return gM(a.component,a.props,e?{levels:e}:{}).text}catch{return""}},[s,a]),E="object"==typeof s&&!0===s.visible,B=WC.useMemo(()=>{if(!l||!a?.component||!a?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return xM(a.component,a.props,e?{maxLeaves:e}:{})}catch{return null}},[l,a]),F="object"==typeof l&&!0===l.visible,H=WC.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),z="object"==typeof i?.copyConfig?i.copyConfig.format:"json",O=WC.useCallback(async e=>{A.current&&await eC(A.current,{...H,...e})},[H]),W=WC.useCallback(()=>{S.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):S.current.requestFullscreen().catch(()=>{}))},[]),j=WC.useCallback(async e=>{a&&await LC({...a,version:a.version??"1",createdAt:a.createdAt??(new Date).toISOString()},e||z||"json")},[a,z]);WC.useEffect(()=>{const e=()=>{M(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),WC.useImperativeHandle(w,()=>({export:O,toggleFullscreen:W,copyConfig:j,element:S.current}),[O,W,j]);const Y=!0===b?{}:b&&"object"==typeof b?b:null,G=!!b,V=Y?.breakpoint??480,X=void 0===Y?.chartMode?"mobile":Y.chartMode,q=Y?.semantics,U=Y?.mobileInteraction??(!!G||void 0),K=Y?.standardControls,Z=d_(K)?K:null,Q=Z?.controls??(d_(K)?void 0:K)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(U),J=WC.useMemo(()=>function(e,t){return f_(t)?e&&"object"==typeof e?{...e,standardControls:t}:!1===e||null==e?e:{standardControls:t}:e}(U,Q),[U,Q]),ee=G&&f_(Q)?m_(QM,{controls:Q,targetSize:Z?.targetSize??h_(U)??44,compact:Z?.compact??!0,className:Z?.className,style:Z?.style,ariaLabel:Z?.ariaLabel,brush:Z?.brush,zoom:Z?.zoom,legend:Z?.legend}):null,te=Y?.summary,oe=!0===Y?.allowHorizontalScroll,ne=!0===Y?.hideToolbar,re=WC.useMemo(()=>{if(!v||!a?.component||!a?.props)return null;const e="object"==typeof v?v:{},t=a.props;try{return u_(a.component,{...t,mobileSemantics:t.mobileSemantics??q,mobileInteraction:t.mobileInteraction??J},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[v,a,q,J]);WC.useEffect(()=>{if(!re||re.ok)return;const e=re.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${a?.component}: ${re.summary.highRisk} high-risk mobile finding(s), ${re.summary.warnings} warning(s).`,e)},[re,a?.component]);const ie=re&&!re.ok&&"object"==typeof v&&!0===v.visible?g_("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",re.summary.highRisk," high-risk finding",1===re.summary.highRisk?"":"s"," and"," ",re.summary.warnings," warning",1===re.summary.warnings?"":"s"," at"," ",("object"==typeof v?v.viewportWidth:void 0)??390,"px."]}):null,ae=R.length>0,se=e||t||c||T||$||I||N||g||ae,le=WC.useMemo(()=>{if(!G||!WC.isValidElement(o))return o;if(!function(e){const t=e.type;return"function"==typeof t||"object"==typeof t&&null!==t}(o))return o;const e=o.props,t={};return X&&null==e.mode&&(t.mode=X),q&&null==e.mobileSemantics&&(t.mobileSemantics=q),void 0!==J&&null==e.mobileInteraction&&(t.mobileInteraction=J),Object.keys(t).length>0?WC.cloneElement(o,t):o},[o,G,X,q,J]),ce=f?m_(C_,{height:r}):p?m_(M_,{error:p}):m?m_(Ip,{children:le}):le;return ue=g_(p_,{children:[m_("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${V}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),g_("div",{ref:S,className:"semiotic-chart-container"+(x?" "+x:""),"data-semiotic-mobile":G?"true":void 0,"data-semiotic-mobile-scroll":oe?"true":void 0,"data-semiotic-mobile-hide-toolbar":ne?"true":void 0,style:{width:n,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...C?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...k},children:[se&&g_("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[g_("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&m_("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&m_("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),g_("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,ae&&m_(S_,{visible:R,onDismiss:L}),T&&m_("button",{className:"semiotic-chart-action",onClick:()=>O(),title:"Export chart","aria-label":"Export chart",style:P_,children:g_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[m_("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),m_("path",{d:"M2 12h10"})]})}),N&&m_(b_,{}),$&&m_("button",{className:"semiotic-chart-action",onClick:W,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:P_,children:m_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:g_(p_,C?{children:[m_("path",{d:"M9 1v4h4"}),m_("path",{d:"M5 13V9H1"}),m_("path",{d:"M13 5H9V1"}),m_("path",{d:"M1 9h4v4"})]}:{children:[m_("path",{d:"M1 5V1h4"}),m_("path",{d:"M13 9v4H9"}),m_("path",{d:"M9 1h4v4"}),m_("path",{d:"M5 13H1V9"})]})})}),I&&m_("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Copy config","aria-label":"Copy chart configuration",style:P_,children:g_("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[m_("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),m_("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),g&&m_("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:A_[g].bg,color:A_[g].color,lineHeight:"18px"},children:g})]})]}),u&&m_("div",{className:"semiotic-chart-banner",children:u}),ie,te&&m_("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:te}),ee&&m_("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:ee}),D&&m_("div",{className:"semiotic-chart-description",role:"note",style:E?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:y_,children:D}),B&&m_("div",{className:"semiotic-chart-nav",style:F?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:m_(FM,{tree:B,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:F,chartId:"string"==typeof a?.props?.chartId?a.props.chartId:void 0})}),g_("div",{className:"semiotic-chart-body",ref:A,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...C?{flex:1}:{height:r}},children:[ce,y]})]})]}),N?m_(cs,{children:ue}):ue;var ue}),P_={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};import*as R_ from"react";import{jsx as L_,jsxs as T_}from"react/jsx-runtime";function $_({children:e,controls:t,mobile:o,breakpoint:n=480,chartMode:r="mobile",mobileInteraction:i=!0,mobileSemantics:a,mobileSummary:s,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:f="sheet",initialDetailOpen:p=!1,allowHorizontalScroll:m=!1,hideToolbar:g=!1,chartDefaults:y,...b}){const[v,x]=R_.useState(()=>c??l.find(e=>!e.disabled)?.id),[k,w]=R_.useState(p);R_.useEffect(()=>{void 0===c&&(l.length?l.some(e=>e.id===v&&!e.disabled)||x(l.find(e=>!e.disabled)?.id):x(void 0))},[c,l,v]);const S=c??v,A=R_.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?L_("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>T_("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===S,disabled:e.disabled,onClick:()=>A(e),title:"string"==typeof e.description?e.description:void 0,children:[L_("span",{children:e.label}),e.description&&L_("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=s||C?T_("div",{className:"semiotic-mobile-summary-card",children:[s&&L_("div",{className:"semiotic-mobile-summary-copy",children:s}),C]}):o?.summary,_={breakpoint:n,chartMode:r,mobileInteraction:i,semantics:a,allowHorizontalScroll:m,hideToolbar:g,...o,summary:M},P=R_.useMemo(()=>{if(!y||!R_.isValidElement(e))return e;const t=e.props,o={};for(const[e,n]of Object.entries(y))null==t[e]&&(o[e]=n);return Object.keys(o).length>0?R_.cloneElement(e,o):e},[e,y]),R=!!d&&"sheet"===f,L=!!d&&"inline"===f||R&&k,T=R?L_("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":k,onClick:()=>w(e=>!e),children:k?"Hide details":"Show details"}):null,$=t||T?T_("div",{className:"semiotic-mobile-control-stack",children:[t,T]}):void 0;return T_("div",{className:"semiotic-mobile-chart-shell",children:[L_("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-accent, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-accent, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${n}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),L_(__,{...b,controls:$,mobile:_,children:P}),L&&T_("section",{className:"semiotic-mobile-detail-panel","data-mode":f,"aria-label":"string"==typeof h?h:"Chart details",children:[T_("div",{className:"semiotic-mobile-detail-header",children:[L_("span",{children:h}),R&&L_("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>w(!1),children:"Close"})]}),L_("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}import*as I_ from"react";import{jsx as N_,jsxs as D_}from"react/jsx-runtime";function E_(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function B_(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function F_(e){return{strategy:"small-multiples",responsive:!0,supportsResponsiveLayout:!0,summary:`${e} vertically stacked small multiple panel${1===e?"":"s"} with shared scale guidance.`,interaction:{primary:"tap",alternatives:["panel summary","linked selection"],hoverFallback:"tap-to-lock",targetSize:44},labels:{strategy:"external",minFontSize:12}}}function H_(e,t){if(!I_.isValidElement(e))return e;const o=e.props,n={};for(const[e,r]of Object.entries(t))void 0!==r&&null==o[e]&&(n[e]=r);return Object.keys(n).length>0?I_.cloneElement(e,n):e}function z_({items:e,children:t,columns:o=3,tabletColumns:n=2,mobileColumns:r=1,mobileBreakpoint:i=480,tabletBreakpoint:a=860,gap:s=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:f=["yExtent","valueExtent"],linkedHover:p,selection:m,linkedBy:g,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:k,legendSelectionName:w,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:_,className:P,style:R}){const L=kg(),T=e||"function"==typeof t?[]:I_.Children.toArray(t),$=e??T.map((e,t)=>({id:"panel-"+(t+1)})),I=$.length,N=I_.useMemo(()=>function(e,t,o,n){if(t&&"object"==typeof t)return t;if(!1===t)return{};const r=[],i=[];for(const t of e)if(t.extent&&r.push(t.extent[0],t.extent[1]),n)for(const e of B_(t,o))i.push(E_(e,n));const a=function(e){let t=1/0,o=-1/0;for(const n of e){const e=Number(n);Number.isFinite(e)&&(t>e&&(t=e),e>o&&(o=e))}if(Number.isFinite(t)&&Number.isFinite(o))return t===o?[t-1,o+1]:[t,o]}(i.length?i:r);return a?{yExtent:a,valueExtent:a}:{}}($,u,h,d),[$,u,h,d]),D=I_.useMemo(()=>{if(!g)return{name:void 0,fields:void 0,linkedHover:p,selection:m};const e=Array.isArray(g)?"small-multiples":g.name||"small-multiples",t=Array.isArray(g)?g:g.fields||[];return{name:e,fields:t,linkedHover:p??{name:e,fields:t},selection:m??{name:e}}},[g,p,m]),E=I_.useMemo(()=>({linkedHover:D.linkedHover,selection:D.selection}),[D.linkedHover,D.selection]),B=I_.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??F_(I),...E,..._};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of f)t in N&&(e[t]=N[t]);return e},[l,c,A,C,I,E,_,M,f,N]),F=D_("section",{className:["semiotic-small-multiple-chart",P].filter(Boolean).join(" "),style:R,"data-semiotic-small-multiple":"true",children:[N_("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${s}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${a}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n }\n @media (max-width: ${i}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),$.map((e,o)=>{const n={...B},r="function"==typeof t?t(e,{item:e,index:o,count:I,chartProps:n,sharedExtent:N}):T[o];return D_("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&D_("header",{className:"semiotic-small-multiple-heading",children:[e.title&&N_("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&N_("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&N_("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),N_("div",{className:"semiotic-small-multiple-plot",children:H_(r,n)})]},e.id??o)})]});return!0===y||"auto"===y&&(g||p||m||b||!0===v)&&!L?N_(Lg,{selections:b,showLegend:v,legendPosition:x,legendInteraction:k,legendSelectionName:w??D.name??"small-multiples",legendField:S??D.fields?.[0]??"category",children:F}):F}import*as O_ from"react";import{Fragment as W_,jsx as j_,jsxs as Y_}from"react/jsx-runtime";function G_({children:e,columns:t="auto",minCellWidth:o=300,gap:n=16,tabletColumns:r,mobileColumns:i=1,mobileBreakpoint:a=480,tabletBreakpoint:s=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+O_.useId().replace(/[^a-zA-Z0-9_-]/g,""),h="number"==typeof t?t:void 0,f="auto"===t?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${t}, 1fr)`,p=["semiotic-chart-grid",d,c].filter(Boolean).join(" ");return Y_(W_,{children:[j_("style",{children:`\n ${r?`\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${r}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${a}px) {\n .${d} {\n grid-template-columns: repeat(${i}, minmax(0, 1fr)) !important;\n }\n .${d} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${i} !important;\n }\n }\n `}),j_("div",{className:p,style:{display:"grid",gridTemplateColumns:f,gap:n,width:"100%",...u},children:O_.Children.map(e,e=>{if(!O_.isValidElement(e))return e;const t=e.props,o={};if(l)for(const[e,n]of Object.entries(l))null==t[e]&&(o[e]=n);const n=Object.keys(o).length>0?O_.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?n:j_("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:n})})})]})}G_.displayName="ChartGrid";import*as V_ from"react";import{Fragment as X_,jsx as q_,jsxs as U_}from"react/jsx-runtime";function K_({children:e,context:t,position:o="right",contextSize:n=250,mobilePosition:r="bottom",mobileBreakpoint:i=480,gap:a=12,className:s,style:l}){const c="semiotic-context-layout-"+V_.useId().replace(/[^a-zA-Z0-9_-]/g,""),u="left"===o||"right"===o,d="left"===o||"top"===o,h={display:"flex",flexDirection:u?d?"row-reverse":"row":d?"column-reverse":"column",gap:a,width:"100%",...l},f=u?{flex:`0 0 ${n}px`,width:n,minHeight:0}:{flex:`0 0 ${n}px`,height:n,minWidth:0};return U_(X_,{children:[q_("style",{children:`\n @media (max-width: ${i}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),U_("div",{className:["semiotic-context-layout",c,s].filter(Boolean).join(" "),"data-mobile-position":r,style:h,children:[q_("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),q_("div",{className:"semiotic-context-panel",style:f,children:t})]})]})}K_.displayName="ContextLayout";import{useRef as Z_}from"react";var Q_=2*Math.PI;function J_(e,t,o){const n=o?.center?.x??0,r=o?.center?.y??0;return{x:n+Math.sin(e)*t,y:r-Math.cos(e)*t}}function eP(e,t,o,n,r){const i=r?.center,a=(e,t)=>{const{x:o,y:n}=J_(e,t,{center:i});return`${tP(o)},${tP(n)}`},s=Math.max(0,o),l=Math.max(s,n),c=Math.abs(t-e),u=e>t?0:1;if(c>=Q_-1e-6){const e=i?.x??0,t=i?.y??0,o=`${tP(e)},${tP(t-l)}`,n=`${tP(e)},${tP(t+l)}`;let r=`M${o} A${tP(l)},${tP(l)} 0 1 1 ${n} A${tP(l)},${tP(l)} 0 1 1 ${o} Z`;if(s>0){const o=`${tP(e)},${tP(t-s)}`,n=`${tP(e)},${tP(t+s)}`;r+=` M${o} A${tP(s)},${tP(s)} 0 1 0 ${n} A${tP(s)},${tP(s)} 0 1 0 ${o} Z`}return r}const d=c>Math.PI?1:0,h=a(e,l),f=a(t,l);if(0>=s){const e=i?.x??0,t=i?.y??0;return`M${tP(e)},${tP(t)} L${h} A${tP(l)},${tP(l)} 0 ${d} ${u} ${f} Z`}const p=a(t,s),m=a(e,s);return`M${h} A${tP(l)},${tP(l)} 0 ${d} ${u} ${f} L${p} A${tP(s)},${tP(s)} 0 ${d} ${1===u?0:1} ${m} Z`}function tP(e){return Math.round(1e3*e)/1e3}function oP(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}import{jsx as nP,jsxs as rP}from"react/jsx-runtime";function iP({value:e,onChange:t,period:o=365,radius:n=180,innerRadius:r=14,width:i,height:a,step:s=1,largeStep:l=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:h="var(--semiotic-bg, #ffffff)",className:f,style:p}){const m=i??2*n+40,g=a??2*n+40,y=m/2,b=g/2,v=function(e){const[t,o]=e,n=o-t||1,r=Q_;return e=>0+(e-t)/n*(r-0)}([0,o]),x=Z_(null),k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),r=t.viewBox?.baseVal;return Math.round((Math.atan2((r?.width||m)/(n.width||1)*(e.clientX-n.left)-y-0,-((r?.height||g)/(n.height||1)*(e.clientY-n.top)-b-0))+Q_)%Q_/Q_*o)%o},w=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:k(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},A=(e,n)=>{t("range"===e?e=>({start:oP(e.start+n,o),end:oP(e.end+n,o)}):t=>({...t,[e]:oP(t[e]+n,o)}))},C=e=>t=>{const o=t.shiftKey?l:s;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),A(e,o)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),A(e,-o))},M=e.start>e.end?[[e.start,o],[0,e.end]]:[[e.start,e.end]],_=e=>u?u(e):e+"";return nP("svg",{viewBox:`0 0 ${m} ${g}`,width:m,height:g,className:f,onPointerMove:e=>{const n=x.current;if(!n)return;const r=k(e);if("range"===n.mode){const e=function(e,t,o){if(0>=o)return t-e;let n=(t-e)%o;return n>o/2?n-=o:-o/2>n&&(n+=o),n}(n.lastValue,r,o);if(0===e)return;return n.lastValue=r,void t(t=>({start:oP(t.start+e,o),end:oP(t.end+e,o)}))}t(e=>({...e,[n.mode]:r}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...p},"aria-label":c+" brush",children:rP("g",{transform:`translate(${y},${b})`,children:[nP("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${_(e.start)} to ${_(e.end)}`,onPointerDown:e=>w(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>nP("path",{d:eP(v(e),v(t),r,n),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],a=(e=>J_(v(e),r))(i),s=(e=>J_(v(e),n+8))(i);return rP("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":_(i),onPointerDown:e=>w(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[nP("line",{x1:a.x,y1:a.y,x2:s.x,y2:s.y,stroke:"transparent",strokeWidth:20}),nP("line",{x1:a.x,y1:a.y,x2:s.x,y2:s.y,stroke:h,strokeWidth:1.5}),nP("circle",{cx:s.x,cy:s.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}import*as aP from"react";import{useRef as sP}from"react";import{jsx as lP,jsxs as cP}from"react/jsx-runtime";function uP(e,t,o,n){return Math.min(o,Math.max(t,Number((t+Math.round((Math.min(o,Math.max(t,e))-t)/n)*n).toFixed(12))))}function dP({value:e,onChange:t,pointerToValue:o,min:n,max:r,step:i=1,largeStep:a=5*i,x:s,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:f=12,fill:p="var(--semiotic-bg, #ffffff)",stroke:m="var(--semiotic-primary, #4e79a7)",strokeWidth:g=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:k,disabled:w=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:_}){const P=sP(null),R=sP(e);R.current=e;const L=aP.useMemo(()=>sC({controlType:c,controlId:u,chartId:M,chartType:_,onObservation:C}),[M,_,u,c,C]),T=e=>{if(w)return;const a=o(e);if(null==a||!Number.isFinite(a))return;const s=uP(a,n,r,i);R.current=s,t(s),L("control-change",s,"pointer")},$=e=>{e.stopPropagation(),P.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),P.current=null,A?.(R.current),L("control-end",R.current,"pointer"))},I=["semiotic-direct-manipulation-control",k].filter(Boolean).join(" ");return cP("g",{className:I,role:"slider",tabIndex:w?-1:0,"aria-disabled":w||void 0,"aria-label":d,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":e,"aria-valuetext":h??`${d}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":c,"data-viz-control-id":u,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{w||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),P.current=e.pointerId,S?.(R.current),L("control-start",R.current,"pointer"),T(e))},onPointerMove:e=>{e.stopPropagation(),P.current===e.pointerId&&T(e)},onPointerUp:$,onPointerCancel:$,onLostPointerCapture:$,onKeyDown:e=>{if(w)return;const o=e.shiftKey?a:i,s=R.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=s-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=s+o),"Home"===e.key&&(l=n),"End"===e.key&&(l=r),null===l)return;e.preventDefault();const c=uP(l,n,r,i);R.current=c,t(c),L("control-change",c,"keyboard")},style:{cursor:w?"default":"grab",touchAction:"none"},children:[lP("circle",{className:"semiotic-direct-manipulation-control__hit",cx:s,cy:l,r:f+10,fill:"transparent"}),lP("circle",{className:"semiotic-direct-manipulation-control__handle",cx:s,cy:l,r:f,fill:p,stroke:m,strokeWidth:g}),y?lP("text",{className:x,x:s+b,y:l+v,fill:m,children:y}):null]})}import{useState as hP,useEffect as fP,useRef as pP,useCallback as mP}from"react";import{jsx as gP,jsxs as yP}from"react/jsx-runtime";function bP({children:e,position:t="right",size:o=300,trigger:n="click",chartId:r,observation:i,dismissOnEmpty:a=!0,showClose:s=!0,onToggle:l,className:c,style:u}){const[d,h]=hP(null),[f,p]=hP(null),[m,g]=hP(!1),[y,b]=hP(!1),v=pP(null),x=pP(void 0),k="click"===n?["click","click-end"]:["hover","hover-end"],{latest:w}=gg({types:k,chartId:r,limit:1}),S=void 0!==i?i:w,A=mP(()=>{b(!0),g(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),p(null)},200)},[]);if(fP(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),p(e),g(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),200)),!0))}else!a||"click-end"!==S.type&&"hover-end"!==S.type||A()},[a,A,S]),fP(()=>{l?.(m)},[m,l]),fP(()=>()=>clearTimeout(x.current),[]),!d&&!y)return null;const C=d&&f?e(d,f):null;if(null===C&&!y)return null;const M=function(e,t,o,n){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return"right"===e?{...r,top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{...r,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{...r,top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"}}(t,o,m,y);return yP("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[s&&gP("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:vP,children:gP("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:gP("path",{d:"M2 2l8 8M10 2l-8 8"})})}),gP("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var vP={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};bP.displayName="DetailsPanel";import{useEffect as xP,useMemo as kP,useRef as wP,useState as SP}from"react";import{forceCenter as AP,forceCollide as CP,forceLink as MP,forceManyBody as _P,forceSimulation as PP,forceX as RP,forceY as LP}from"d3-force";function TP(e,t,o={}){const n=o.iterations??260,r=o.repulsion??5200,i=o.linkDistance??165,a=o.linkStrength??.045,s=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,u=o.nodePadding??3,d=o.inset??.06,h=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(o.seed??1),f=new Map;for(const t of e)f.set(t.id,0);for(const e of t)f.set(e.source,(f.get(e.source)??0)+1),f.set(e.target,(f.get(e.target)??0)+1);const p=500,m=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),g=new Set(e.map(e=>e.id)),y=t.filter(e=>g.has(e.source)&&g.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){const e=PP(m).randomSource(h).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",_P().strength(e=>{const t=f.get(e.id)??0;return 2.5*-Math.sqrt(r)*Math.sqrt(t+1)})).force("collide",CP(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",AP(p,p).strength(.8)).force("x",RP(p).strength(s)).force("y",LP(p).strength(s));y.length>0&&e.force("link",MP(y).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(f.get("string"==typeof e.source?e.source:e.source.id)??1,f.get(t)??1));return a/.045/o})),e.stop();for(let t=0;n>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,k=-1/0;for(const e of m){const t=e.x??p,o=e.y??p;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>k&&(k=o)}const w=x-b,S=k-v,A={};for(const e of m)A[e.id]={x:0===w?.5:d+((e.x??p)-b)/w*(1-2*d),y:0===S?.5:d+((e.y??p)-v)/S*(1-2*d)};return A}var $P=new WeakMap;function IP(e){const t=[];for(const o of Object.keys(e).sort()){const n=e[o];if(void 0!==n){if("function"==typeof n)return null;t.push(`${o}:${n+""}`)}}return t.join("|")}function NP(e,t,o){return null==o?null:$P.get(e)?.get(t)?.get(o)??null}function DP(e,t,o,n){if(null==o)return;let r=$P.get(e);r||(r=new WeakMap,$P.set(e,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(o)&&i.size>=16){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,n)}function EP(e,t,o={}){const n=Ka(),{seed:r,iterations:i,repulsion:a,linkDistance:s,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:p,workerThreshold:m}=o,g=kP(()=>({seed:r,iterations:i,repulsion:a,linkDistance:s,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:p,workerThreshold:m}),[r,i,a,s,l,c,u,d,h,f,p,m]),y=wP(n),[b,v]=SP(()=>{if("undefined"==typeof window||n){const o=TP(e,t,g);return DP(e,t,IP(g),o),{positions:o,status:"ready",error:null}}const o=NP(e,t,IP(g));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return xP(()=>{if(y.current)return void(y.current=!1);const o=IP(g),n=NP(e,t,o);if(n)return void v(e=>"ready"===e.status&&e.positions===n?e:{positions:n,status:"ready",error:null});const r=new AbortController;return v(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,o={}){const{execution:n="auto",signal:r,workerThreshold:i,nodeRadius:a,...s}=o,l=s.iterations??260;if(!jp()||!Wp(n,e.length,t.length,l,i))return TP(e,t,{...s,nodeRadius:a});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:s,nodeRadii:"function"==typeof a?Object.fromEntries(e.map(e=>[e.id,a(e)])):null==a?void 0:Object.fromEntries(e.map(e=>[e.id,a]))};try{return(await Xp(c,r)).positions}catch(o){if("AbortError"===o?.name)throw o;return TP(e,t,{...s,nodeRadius:a})}}(e,t,{...g,signal:r.signal}).then(n=>{DP(e,t,o,n),v({positions:n,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&v(t=>({positions:t.positions,status:"error",error:e}))}),()=>r.abort()},[e,t,g]),b}import*as BP from"react";function FP(e){const t=e.designContract?.chartFamily??e.title??"chart",o=e.audience?.primary?" for "+e.audience.primary:"",n=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${o}${n?". "+n:""}`}function HP(e,t){const o=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),n=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),r=("object"==typeof n?n.id??n.name:void 0)??o[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:r,secondary:o.filter(e=>e!==r)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}import{jsx as zP,jsxs as OP}from"react/jsx-runtime";function WP({manifest:e,label:t="Intent Mark",className:o,showSummary:n=!0}){const[r,i]=BP.useState(!1),a=BP.useMemo(()=>JSON.stringify(e,null,2),[e]),s=BP.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(a),i(!0),window.setTimeout(()=>i(!1),1200))},[a]);return OP("details",{className:o?"semiotic-intent-mark "+o:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[OP("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),OP("div",{style:{padding:"0 10px 10px"},children:[n&&zP("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:FP(e)}),zP("button",{type:"button",onClick:s,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:r?"Copied":"Copy manifest"}),zP("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-background, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:a})]})]})}import{useCallback as jP,useEffect as YP,useMemo as GP,useRef as VP,useState as XP}from"react";var qP=["hover","click","focus","activate"];function UP(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=UP(t);if(e)return e}return null}function KP(e,t){return e?t.map(t=>e[t]+"").join(""):""}function ZP(e,t){if(e.id===t)return e;for(const o of e.children??[]){const e=ZP(o,t);if(e)return e}return null}function QP(e){const{tree:t,chartId:o,observe:n=qP}=e,r=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=GP(()=>{if(e.matchFields)return e.matchFields;const o=UP(t);return o?Object.keys(o).filter(e=>{return!e.startsWith("_")&&(null==(t=o[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),a=GP(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=KP(t.datum,i);e.has(o)||e.set(o,t.id)}for(const e of t.children??[])o(e)};return o(t),e},[t,i]),{selectPoints:s,clear:l}=lg({name:r,fields:i}),c=GP(()=>[...n,"hover-end"],[n]),{latest:u}=gg({chartId:o,types:c,limit:1}),[d,h]=XP(t.id),f=VP(d);f.current=d;const p=VP(t);YP(()=>{const e=p.current;p.current=t;const o=ZP(e,f.current),n=ZP(t,f.current);"datum"===o?.role&&"datum"===n?.role&&o.datum&&n.datum&&i.length>0&&KP(o.datum,i)===KP(n.datum,i)||o&&n&&"datum"!==o.role&&"datum"!==n.role||(h(t.id),l())},[t,l,i]);const m=jP(e=>{if(h(e.id),"datum"===e.role&&e.datum&&i.length>0){const t={};for(const o of i)t[o]=[e.datum[o]];s(t)}else l()},[i,s,l]),g=e.annotations,y=GP(()=>{const e=new Set;if(0===i.length||!g)return e;for(const t of g){const o=a.get(KP(t,i));o&&e.add(o)}return e},[g,a,i]),b=jP(e=>{const t="number"==typeof e?g?.[e]:e;if(!t||0===i.length)return!1;const o=a.get(KP(t,i));if(!o)return!1;h(o);const n={};for(const e of i)n[e]=[t[e]];return s(n),!0},[g,a,i,s]),v=VP(null),x=jP(e=>{if(o&&e.chartId!==o)return;if("hover-end"===e.type){if(e===v.current)return;return void(v.current=e)}if(!function(e){return"hover"===e.type||"click"===e.type||"focus"===e.type||"activate"===e.type}(e))return;if(!n.includes(e.type))return;if(e===v.current)return;if(v.current=e,0===i.length)return;const t=function(e){const t=e,o=t.data;if(!o||"object"!=typeof o||Array.isArray(o))return e;const n=e=>e.every(e=>"number"==typeof t[e]),r=n(["x0","x1","y0","y1","width","height","value"]),i=n(["y0","y1","sankeyWidth","value"])&&"source"in t&&"target"in t;return r||i?o:e}(e.datum),r=a.get(KP(t,i));r&&h(e=>e===r?e:r)},[o,n,a,i]),k=VP(null);return YP(()=>{u&&u!==k.current&&(k.current=u,x(u))},[u,x]),{activeId:d,onActiveChange:m,selection:{name:r},onObservation:x,handleObservation:x,annotatedIds:y,focusAnnotation:b}}import{useEffect as JP,useMemo as eR,useRef as tR}from"react";function oR(e,t,o,n){const r=new Map;o.forEach((e,t)=>{r.set(n?n(e,t):t+"",e)});const i=[];t.forEach((e,t)=>{r.has(t)||i.push(t)}),i.length>0&&e.remove?.(i);const a=[];if(r.forEach((o,n)=>{const r=t.get(n);void 0===r?a.push(o):r!==o&&(e.update?e.update(n,()=>o):(e.remove?.(n),a.push(o)))}),a.length>0)if(e.pushMany)e.pushMany(a);else if(e.push)for(const t of a)e.push(t);return r}function nR(e,t,o={}){const{id:n,resetKey:r}=o,i=eR(()=>function(e){return null==e?null:"function"==typeof e?(t,o)=>{const n=e(t,o);return null==n?o+"":n+""}:(t,o)=>{const n=t[e];return null==n?o+"":n+""}}(n),[n]),a=tR({map:new Map,handle:null,resetKey:void 0});JP(()=>{const o=e.current;if(!o)return;const n=a.current;n.handle===o&&n.resetKey===r||(o.clear?.(),n.map=new Map,n.handle=o,n.resetKey=r),n.map=oR(o,n.map,t,i)},[e,t,i,r])}import{Fragment as rR,jsx as iR,jsxs as aR}from"react/jsx-runtime";function sR({items:e,title:t="Additional notes",empty:o=null,ordered:n=!0,renderItem:r,className:i,style:a}){if(!e.length)return o?iR(rR,{children:o}):null;const s=n?"ol":"ul";return aR("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:a,children:[iR("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&iR("h3",{children:t}),iR(s,{children:e.map((e,t)=>iR("li",{children:r?r(e,t):aR(rR,{children:[iR("span",{children:e.label}),(e.source||e.emphasis)&&iR("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}export{FM as AccessibleNavTree,Li as AnnotationLabel,Db as AreaChart,Hx as BarChart,Lk as BoxPlot,lv as BubbleChart,Fg as CARBON_ALERT,Bg as CARBON_CATEGORICAL_14,Y as COLOR_BLIND_SAFE_CATEGORICAL,px as CandlestickChart,Wm as CategoryColorProvider,__ as ChartContainer,Ip as ChartErrorBoundary,G_ as ChartGrid,Qw as ChordDiagram,BS as CirclePack,iP as CircularBrush,gb as ConnectedScatterplot,K_ as ContextLayout,V as DARK_THEME,bP as DetailsPanel,Gb as DifferenceChart,dP as DirectManipulationControl,pw as DonutChart,rw as DotPlot,Xw as ForceDirectedGraph,Jk as FunnelChart,Mw as GaugeChart,Tw as GroupedBarChart,X as HIGH_CONTRAST_THEME,ov as Heatmap,Bk as Histogram,Q as IncrementalExtent,WP as IntentMark,G as LIGHT_THEME,pk as LikertChart,_b as LineChart,Lg as LinkedCharts,Fv as MinimapChart,sR as MobileAnnotationCalloutList,$_ as MobileChartContainer,QM as MobileStandardControls,lx as MultiAxisLineChart,nl as MultiLineTooltip,Mx as NetworkCustomChart,OS as OrbitDiagram,Lx as OrdinalCustomChart,cw as PieChart,_S as ProcessSankey,Kv as QuadrantChart,qA as RealtimeHeatmap,PA as RealtimeHistogram,xA as RealtimeLineChart,EA as RealtimeSwarmChart,LA as RealtimeTemporalHistogram,WA as RealtimeWaterfallChart,Xk as RidgelinePlot,Z as RingBuffer,nS as SankeyDiagram,cb as Scatterplot,Mv as ScatterplotMatrix,z_ as SmallMultipleChart,Kb as StackedAreaChart,Yx as StackedBarChart,wm as StreamNetworkFrame,Yd as StreamOrdinalFrame,su as StreamXYFrame,wk as SwarmPlot,Ew as SwimlaneChart,Hg as THEME_PRESETS,RA as TemporalHistogram,qg as ThemeProvider,ol as Tooltip,LS as TreeDiagram,NS as Treemap,aC as VISUALIZATION_CONTROL_TYPES,Wk as ViolinPlot,wx as XYCustomChart,JA as adaptiveTimeTicks,Si as annotationStableId,cC as auditVisualizationControls,xM as buildNavigationTree,WM as clampMobileRange,qe as compileMotionEncoding,zy as composeStyleRules,TC as configToJSX,LC as copyConfig,sC as createControlObservationAdapter,Sn as createHatchPattern,e as darkenColor,Qe as deriveMotionVector,IC as deserializeSelections,Ri as estimateLabelWidth,eC as exportChart,_C as fromConfig,RC as fromURL,HC as fromVegaLite,Pn as hatchFillId,Ln as hatchPatternDef,HP as intentManifestFromRecipe,Mn as isHatchFill,r as lightenColor,Dy as makeNodeRuleContext,Iy as makeRuleValueResolver,Oy as makeStyleRuleStyleFn,Ny as makeXYRuleContext,By as matchesThreshold,il as normalizeTooltip,Ke as opacityFromAge,Xe as resolveMotionAccessor,Ue as resolveMotionAge,Ze as resolveMotionVector,Qg as resolveResponsiveRules,Hy as resolveStyleRules,Tn as resolveSvgFill,zg as resolveThemePreset,Zg as responsiveRuleMatches,Fy as ruleMatches,$C as serializeSelections,KA as smartTickFormat,Ks as smartTooltipEntries,Wy as styleRulesToNodeStyle,Yy as styleRulesToPieceStyle,jy as styleRulesToXYStyle,FP as summarizeIntentManifest,oR as syncPushBuffer,Dg as themeToCSS,Eg as themeToTokens,MC as toConfig,PC as toURL,hg as useBrushSelection,jm as useCategoryColors,gg as useChartObserver,Vo as useCustomLayoutSelection,pg as useFilteredData,EP as useForceLayout,kg as useLinkedChartsActive,ug as useLinkedHover,YM as useMobileRangeControls,QP as useNavigationSync,lg as useSelection,cg as useSelectionActions,nR as useSyncedPushData,Ug as useTheme,jM as zoomMobileRange};