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
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=require("d3-quadtree"),i=require("d3-shape"),r=require("d3-array"),s=require("d3-hierarchy"),a=require("regression"),l=require("d3-selection"),c=require("d3-brush");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const h=d(t),f=u(a),g=["name","label","title"],y=["type","kind","category","group","class","status","role","shape"],m=["value","amount","total","count","weight","score"],p=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 v(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}const b=Object.freeze([]);function x(e){if(!e)return b;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class w{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=x(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=x(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class k{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class j{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function A(e,t,n){return e+(t-e)*n}function S(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function O(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function M(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function C(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function _(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function P(e){const t=e.map(C),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return _(e,n,o)}if(e>=1){const[e,o,i]=t[n];return _(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return _(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const L=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],R=P(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),T=P(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),$=P(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),I=P(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),B=P(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),H=P(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),E={blues:R,reds:T,greens:$,viridis:P(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:I,purples:B,greys:H,plasma:P(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:P(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:P(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:P(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:P(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},D=P(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),F=P(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),N=P(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),W=P(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),z=P(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),G=P(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),q=P(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),V=Object.assign({category10:L,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},E),X=L,Y=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Q=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 Z(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Q.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):X[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%X.length]}function K(e,t,o="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(i).range(o).unknown("#999");const s=V[o]||V.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:X;return n.scaleOrdinal().domain(i).range(e).unknown("#999")}}function U(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function J(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}const ee={circle:i.symbolCircle,square:i.symbolSquare,triangle:i.symbolTriangle,diamond:i.symbolDiamond,star:i.symbolStar,cross:i.symbolCross,wye:i.symbolWye},te=["circle","triangle","diamond","star","square","chevron","cross","wye"];function ne(e,t,n){var o,r;if(n)return n;const s=null!=e?e:"circle";if("chevron"===s)return function(e){const t=1.5*oe(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t);const a=null!==(o=ee[s])&&void 0!==o?o:i.symbolCircle;return null!==(r=i.symbol(a,Math.max(1,t))())&&void 0!==r?r:""}function oe(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ie(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let i=0;return e=>{const r=t(e)+"",s=null==n?void 0:n[r];if(s)return s;let a=o.get(r);return a||(a=te[i%te.length],i++,o.set(r,a)),a}}function re(e,t,n,o,i,r,s){e.push(t?{type:"symbol",x:o,y:i,size:Math.PI*r*r,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:i,r:r,style:s,datum:n})}function se(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),f=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),g=d&&!f&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,f=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,y=r(t.pieceData[0],t.name),m=0===e,p=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:d,endAngle:f},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:y,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:g&&(v.roundedEnds={start:m,end:p}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function ae(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function le(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ce(e){var t,n,o;const i=e.length,s=e[0],a=e[i-1];return{n:i,min:s,q1:null!==(t=r.quantile(e,.25))&&void 0!==t?t:s,median:null!==(n=r.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(o=r.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}function ue(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}function de(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(de))}function he(e,t,n){e.has(t)||(e.add(t),console.warn(n))}const fe={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,f=[],g="vertical"===h,y="horizontal"===h,m=a.normalize,p=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(m)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of p){const s=t.get(r);if(!s)continue;let a=s.total;m&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(g){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);f.push(J(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(y){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);f.push(J(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of f){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of f){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return f},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),f=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(J(r,Math.min(a,d),o,Math.abs(a-d),f,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(J(Math.min(a,d),r,Math.abs(d-a),o,f,i,h[s]))}}}}const y=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);y>0&&(e.roundedTop=y),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,f="radial"===u,g=a.length>0,y=ie(e),m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=g&&a[i]||c,v=l(t,e.name),b=v.r||5;let x,w;if(f){const t=p+(e.pctStart+e.pct/2)*m,n=u(r);x=Math.cos(t)*n,w=Math.sin(t)*n}else h?(x=e.middle,w=u(r)):(x=u(r),w=e.middle);re(d,y,t,x,w,b,v)}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=ie(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),d=r(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;re(l,u,o,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:se,donut:se,boxplot:function(e,t){var n,o,i,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:f}=e,{r:g,projection:y}=c,m=[],p="vertical"===y,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],y=null!==(n=r.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=r.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(i=r.quantile(c,.75))&&void 0!==i?i:d,w=x-y,k=y-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,S=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,O=f(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(k>n||n>j){const o=p?t.middle:g(n),i=p?g(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(m.push({type:"boxplot",x:p?t.middle:0,y:p?0:t.middle,projection:p?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(y),medianPos:g(b),q3Pos:g(x),maxPos:g(S),stats:{n:c.length,min:A,q1:y,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)m.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return m},violin:function(e,t){var n,o,i;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,f=[],g="vertical"===h,y=l.bins||20,m=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/y||1,h=Array(y).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),y-1)]++;const p=le(h,1),v=e.width/2*.9;let b="";if(g){b=`M ${e.middle} ${d(s)}`;for(let t=0;y>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/p*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=y-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/p*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;y>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/p*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=y-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/p*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(m&&t.length>=4){const l=null!==(n=r.quantile(t,.25))&&void 0!==n?n:s,c=null!==(o=r.quantile(t,.5))&&void 0!==o?o:(s+a)/2,u=null!==(i=r.quantile(t,.75))&&void 0!==i?i:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};f.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:ce(t),style:x,datum:e.pieceData,category:e.name})}return f},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),f=h?+h[0]:void 0,g=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=ae(t),i=null!=f&&isFinite(f)?f:n,r=null!=g&&isFinite(g)?g:o,h=(r-i)/u||1,y=Array(u).fill(0);for(const e of t)i>e||e>r||y[Math.min(Math.floor((e-i)/h),u-1)]++;const m=t.length,p=le(y,1),v=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===y[t])continue;const n=(d?y[t]/m:y[t]/p)*e.width*.9,o=l(i+t*h),r=l(i+(t+1)*h);c.push(J(Math.min(o,r),e.x+e.width-n,Math.abs(r-o),n,v,{bin:t,count:y[t],range:[i+t*h,i+(t+1)*h],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,f=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const g=le(c,1),y=a(e.pieceData[0],e.name),m=e.width*f;let p="";if(h){const t=e.x+e.width;p=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)p+=` L ${l(o+(e+.5)*r)} ${t-c[e]/g*m}`;p+=` L ${l(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);p+=` L ${t+c[e]/g*m} ${n}`}p+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,stats:ce(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(J(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(J(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var o,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:f,resolvePieceStyle:g}=e,y=[],m=t.width/2,p=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return y;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=f?f(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let j=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=f?f(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>j&&(j=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>j&&(j=o)}if(0===j)return y;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,O=w?.95*m:.9*t.width,M=n.scaleLinear().domain([0,j]).range([0,O]),C=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let _=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,i=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=m,r=m;for(let s=0;b.length>s;s++){const l=b[s],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const w=g(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=k>0?c.total/k*100:0,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=m,S.__funnelStepLabelY=f,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=f,S.__funnelBarW=u),y.push(J(x,f,u,h,w,S,l)),v.set(l,{x:x,y:f,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=m-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=n.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:o.pieceData[0],d=c?l:o.name,x=g(u,d),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:i,category:c?l:o.name});p&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=m,k.__funnelStepLabelY=f,k.__funnelRowWidth=t,k.__funnelValueLabelX=m,k.__funnelValueLabelY=f,k.__funnelBarW=t),y.push(J(a,f,t,h,x,k,d)),v.set(l,{x:a,y:f,w:t,h:h})}if(t>0&&_.size>0){const t=w?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===i?o.name:i};y.push(a)}}_=v}return y},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const f=[],g=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";g.has(e)||(g.add(e),f.push(e))}const y=f.length>1&&"_default"!==f[0],m=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}m.push({col:e,groups:t,stepTotal:n})}const p=new Map;for(const e of f){const t=null===(n=m[0])||void 0===n?void 0:n.groups.get(e);p.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?f.length:1,x=y?.15:0;for(let e=0;m.length>e;e++){const t=m[e],n=t.col,o=0===e,s=e>0?m[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;f.length>e;e++){const h=f[e],g=t.groups.get(h);if(!g)continue;const m=g.total,b=null!==(i=p.get(h))&&void 0!==i?i:m,x=b>0?m/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:m,j=o?0:Math.max(0,k-m),A=n.x+e*a+l/2,S=v(m),O=v(0)-S,M=c(g.pieces[0],y?h:n.name),C=Object.assign(Object.assign({},g.pieces[0]),{__barFunnelValue:m,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(m+j)});if(d.push(J(A,S,u,O,M,C,y?h:n.name)),j>0){const e=v(m+j),t=S-e,o=Object.assign({},M),i=Object.assign(Object.assign({},g.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(J(A,e,u,t,o,i,y?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="horizontal"===c,h=e.config.gradientFill,f=d?"left":"bottom",g=e.config.trackFill;if(g){const e="string"==typeof g?g:g.color,t="string"==typeof g?1:null!==(n=g.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?J(s,n.x,a,n.width,o,null,"__track__"):J(n.x,s,n.width,a,o,null,"__track__");u.push(i)}}const y=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let g;if(d){const r=l(t),s=l(t+o);g=J(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);g=J(e.x,r,e.width,s-r,c,n,i)}h&&(g.fillGradient=h,g.roundedEdge=f),u.push(g),t+=o}if(y>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:y,tr:y,br:y,bl:y}:d?(t.cornerRadii={tl:y,bl:y},o.cornerRadii={tr:y,br:y}):(t.cornerRadii={bl:y,br:y},o.cornerRadii={tl:y,tr:y})}}return u}};class ge{constructor(e){this.rExtent=new j,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new k(e.windowSize),this.getO=M(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>O(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new j)):(this.getR=O(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=M(e.stackBy),this.getGroup=M(e.groupBy),this.getColor=M(e.colorAccessor),this.getSymbol=M(e.symbolAccessor),this.getConnector=M(e.connectorAccessor),this.getDataId=M(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new k(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.toArray(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=n.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=n.scaleLinear().domain(a).range([i,o])}else l?(d=n.scaleBand().domain(s).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(s).range([0,e.width]).padding(u),h=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(o,i);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,f=h>0?h*d:1;return c-=f,u+=f,c>0&&(c=0),l?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let f=i;this.rAccessors.length>1&&(f=i.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(f,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(f,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,f;u?(c=h,f=u.get(e)||n.bandwidth(),h+=f+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,f=n.bandwidth()),s[e]={name:e,x:c,y:0,width:f,middle:c+f/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o,i;if(!this.scales)return[];if(this.config.customLayout){const r=this.buildLayoutContext(e,t);let s;try{s=this.config.customLayout(r)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(n=s.overlays)&&void 0!==n?n:null;const a=null!==(o=s.nodes)&&void 0!==o?o:[];if(this._customRestyle=s.restyle,this.hasCustomRestyle=!!s.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of a)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(a,null!==(i=this.config.layoutSelection)&&void 0!==i?i:null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:i}=e;de(o)&&0===n.length&&he(i,"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.`),n.length>0&&n.every(e=>null==e.datum)&&he(i,"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.`)}({label:"ordinal customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const r=this.getSceneContext(),s=fe[this.config.chartType];let a=s?s(r,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(r,a);a=[...e,...a]}return a}buildLayoutContext(e,t){var n,o,i,r;const s=this.config,a=null!==(n=s.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},l=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=V[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(s.colorScheme,s.themeCategorical,Y),c=this.scales;return{data:e,scales:{o:c.o,r:c.r,projection:c.projection},dimensions:{width:t.width,height:t.height,margin:a,plot:"radial"===c.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(o=s.themeSemantic)&&void 0!==o?o:{},categorical:[...l]},resolveColor:ue(l),config:null!==(i=s.layoutConfig)&&void 0!==i?i:{},selection:null!==(r=s.layoutSelection)&&void 0!==r?r:null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Y,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,ge.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._pointQuadtree=o.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,f,g,y,m,p,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),k=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(f=t.opacity)&&void 0!==f?f:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(g=t.startAngle)&&void 0!==g?g:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(m=t.innerRadius)&&void 0!==m?m:0,outerRadius:null!==(p=t.outerRadius)&&void 0!==p?p:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=A(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=A(o.x,e._targetX,s),e.y=A(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=A(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=A(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=A(n.x,e._targetX,s),e.y=A(n.y,e._targetY,s),void 0!==n.w&&(e.w=A(n.w,e._targetW,s),e.h=A(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:A(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=A(n.startAngle,e._targetStartAngle,s),e.endAngle=A(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},s=i(r,t);r.style=s?Object.assign(Object.assign({},e),s):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!S(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!S(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!S(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(S(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=M(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!S(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>O(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new j)):(this.getR=O(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!S(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?M(this.config.stackBy):void 0),"groupBy"in e&&!S(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?M(this.config.groupBy):void 0),"colorAccessor"in e&&!S(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?M(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!S(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?M(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!S(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?M(this.config.connectorAccessor):void 0)}}function ye(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:h.createElement(h.Fragment,null,...t)}ge.QUADTREE_THRESHOLD=500;const me={isActive:!1,predicate:()=>!0},pe=h.createContext(null);function ve({value:t,children:n}){return e.jsx(pe.Provider,{value:t,children:n})}function be(t,n){return null!=t?e.jsx(ve,{value:n,children:t}):t}function xe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function we(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ke(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function je(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>xe(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Ae(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>xe(oe(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Se(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=we(Math.atan2(i,o)),a=we(e.startAngle),l=we(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))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 Oe(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Me(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Ce(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function _e(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const Pe={fresh:1,aging:.7,stale:.45,expired:.25},Le={alpha:1,band:"fresh",isStale:!1};function Re({isStale:t,position:n}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const Te={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function $e(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Te[n])(o(e,t),i),r}function Ie({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const He=(t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=t,y=[];let m=0;const p=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:w}=d;return g.forEach((t,u)=>{const d=$e(t,u,h,f,b),k=Be(t,i,r),j=r&&r.size>0&&r.has(t.label);y.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:p?l===s&&u===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&v?j||!1:void 0,"aria-current":p&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:p?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:p?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(Ie,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=w}),y};function Ee({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+h.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function De(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:f}=t,g=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=h.useState(0),[p,v]=h.useState(0),b=h.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:He(t,o,i,r,s,a,l,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:y,focusedItemIndex:p,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let g=0;const y=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const p=((t,n,o,i,r,s,a,l,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:y}=t,m=[],{swatchSize:p,labelGap:v,itemGap:b,rowHeight:x,align:w}=d,k=!(!n&&!o),j="isolate"===u||void 0===u&&null!=r,A=y.map(e=>p+v+7*e.label.length),S=[];let O=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+b+e;h&&h>0&&M>0&&n>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=n}),y.length>0&&S.push({start:O,end:y.length,width:M}),S.forEach((t,u)=>{let d="center"===w?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===w?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=y[h],w=$e(t,h,f,g,p),S=Be(t,i,r),O=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?l===s&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&j?O||!1:void 0,"aria-current":k&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+y.length)%y.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(l,h),o&&o(t);const n=e.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:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+v+2+7*t.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,O&&e.jsx(Ie,{swatchSize:p}),e.jsx("text",{y:p/2,x:p+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:m,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=p.offset+5,y.push(Object.assign(Object.assign({label:t.label},p),{offset:m,totalRows:p.totalRows,totalHeight:p.totalHeight})),g+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let p=g>m?0:"center"===h.align?Math.max(0,(m-g)/2):"end"===h.align?Math.max(0,m-g):0;const v=[];return y.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+i)),p+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:y,focusedItemIndex:p,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),w=!(!o&&!i);return e.jsxs("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}function Fe(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ne(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const y="top"===a||"bottom"===a,m=!!c,p=Math.max(1,y?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-p-10),b=s.top):"top"===a?(v=s.left,b=m?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(Ee,{config:o.gradient,orientation:y?"horizontal":"vertical",width:p}):Fe(o)?e.jsx(De,{legendGroups:o.legendGroups,title:"",width:p,orientation:y?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function We(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function ze(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ge(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const g=16,y=s?u?[s]:We(s,c):[],m=r?u?[r]:We(r,c):[],p="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?(b.push(e.jsx("foreignObject",{className:"annotation-note-html",x:"end"===f?p-c:"middle"===f?p-c/2:p,y:-16,width:c,height:Math.max(g,(y.length+m.length)*g+(s&&r?2:0))+g,style:{overflow:"visible"},children:e.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===f?"right":"middle"===f?"center":"left",whiteSpace:u?"nowrap":"normal",wordBreak:"break-word"},children:[s&&e.jsx("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:s}),r&&e.jsx("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")),v=y.length*g):(y.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e.jsx("tspan",{x:p,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=y.length*g),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:p,dy:0===n?0:g,children:t},n))},"annotation-note-label")));let w=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*g+(m.length>0?g:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*g;let j=0;return"topBottom"===d?j=0>o?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+g+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),w]})}function qe(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:ze((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function Ve(t,n,o,i,r,s){var a;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+s*h,u=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(a=null==o?void 0:o.curve)&&void 0!==a?a:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;l.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else l.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:l})}function Xe(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:a,nx:l,ny:c,note:u,connector:d,subject:h,type:f,color:g,className:y,disable:m,opacity:p,strokeDasharray:v,events:b={},"data-testid":x}=t,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,j=new Set(Array.isArray(m)?m:[]);let A=s||0,S=a||0;null!=l&&(A=l-w),null!=c&&(S=c-k);const O="string"==typeof f?f:"label";if("bracket"===O&&h&&0===A&&0===S)if(void 0!==h.width){A=h.width/2;const e=h.depth||30;S=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;A=e+(0>e?-5:5),S=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(y||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=p&&{opacity:p},v&&{strokeDasharray:v},b,{children:[!j.has("connector")&&Ve(A,S,d,g,O,h),!j.has("subject")&&qe(O,h,g,w,k),!j.has("note")&&Ge(u,A,S,g)]}))}function Ye(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Xe,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Qe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e){return null==e?null:e+""}function Ue(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Je(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Ue(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?Ue(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Ke(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Ke(e.pointId)===r);if(s)return Ue(t,n,{x:s.x,y:s.y});const a=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Ke(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!a)return null;const l=Qe(a,n),c=Ze(a,n);return null==l||null==c?null:Ue(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let s=null,a=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,a=t.y)}if(null!=s&&null!=a||(s=Qe(e,n),a=Ze(e,n)),null!=s&&null!=a)return Ue(t,n,{x:s,y:a});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function et(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const tt={secondary:0,primary:3};function nt(e){return!0===(null==e?void 0:e._annotationDeferred)}function ot(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function it(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function rt(e){return Math.max(.72,.95-.06*e)}const st={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};const at=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function lt(e){return!!e&&"object"==typeof e&&at.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function ct(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function ut(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function dt(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const ht=32,ft=6,gt=4,yt=8,mt=72;const pt={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function vt(e){return lt(e)}function bt(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function xt(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function wt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function kt(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 jt(e,t,n,o,i,r,s,a){const l=wt(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,a);for(const e of n)c+=12*kt(l,e);for(const e of o)c+=4*kt(l,e);return c}function At(e){var t;const{annotations:n,context:o,defaultOffset:i=ht,notePadding:r=ft,markPadding:s=gt,edgePadding:a=yt,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=mt,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:g,cohesion:y,audience:m}=e,p=o.width||0,v=o.height||0;if(0===n.length||0>=p||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,s);let w=!1;const k=n.map((e,t)=>{if(!vt(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,a=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&a){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=a([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Je(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...bt("string"==typeof e.title?e.title:void 0,t),...bt("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(l&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(wt(xt(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),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}]}(i)){const t=jt(xt(n.x,n.y,e.dx,e.dy,s),e,b,x,p,v,r,a);f>t&&(h=e,f=t)}if(!h)return e;const g=wt(xt(n.x,n.y,h.dx,h.dy,s),r);b.push(g);const y=Math.hypot(h.dx,h.dy),m=c&&y>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),j=w?k:n.slice();let A=j;if(f){let e=!1;const t=j.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});A=e?t:j}{let e=!1;const t=A.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=pt[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});A=e?t:A}const S=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:ut(p,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=ut(o,i,e),a=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,lt(n))};var n}),l=a.filter(e=>e.note);if(0===l.length||s>=l.length)return{visible:n.slice(),deferred:[],budget:s};const c=l.filter(e=>ct(e.annotation)),u=l.filter(e=>!ct(e.annotation)).sort((e,t)=>dt(t.annotation)-dt(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],g=[];for(const{annotation:e,index:t,note:n}of a)!n||h.has(t)?f.push(e):g.push(e);return{visible:f,deferred:g,budget:s}}(Object.assign({annotations:A,width:p,height:v},o));for(const e of i)S.add(e)}if(g&&("object"==typeof g&&"number"==typeof g.minWidth?g.minWidth:480)>=p)for(const e of A)vt(e)&&"secondary"===e.emphasis&&S.add(e);if(S.size>0)for(const e of A)!0===(null==e?void 0:e.defensive)&&S.delete(e);let O;return O=0===S.size?A:h?A.map(e=>S.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):A.filter(e=>!S.has(e)),y?function(e,t){let n=!1;const o=e.map(e=>vt(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(O,y):O}function St(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Ot(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h,axisExtent:f}=n,g="radial"===(null==l?void 0:l.projection),y="horizontal"===(null==l?void 0:l.projection),m=t.useMemo(()=>!l||g?[]:(h||St(l.r,5,f)).map(e=>({value:e,pixel:l.r(e),label:(d||Mt)(e)})),[l,d,g,h,f]),p=u&&l&&!g,v=c&&l&&!g;return p||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[p&&e.jsx("g",{className:"ordinal-grid",children:m.map((t,n)=>e.jsx("line",{x1:y?t.pixel:0,y1:y?0:t.pixel,x2:y?t.pixel:o,y2:y?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,y?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Mt(e){return Math.round(100*e)/100+""}function Ct(n){var o,r;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:g,showAxes:y,showCategoryTicks:m,oLabel:p,rLabel:v,oFormat:b,rFormat:x,showGrid:w,title:k,legend:j,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:M,legendPosition:C="right",legendLayout:_,foregroundGraphics:P,annotations:L,autoPlaceAnnotations:R,svgAnnotationRules:T,xAccessor:$,yAccessor:I,annotationData:B,underlayRendered:H,children:E}=n,D="radial"===(null==g?void 0:g.projection),F="horizontal"===(null==g?void 0:g.projection),N=!1!==m,W=t.useMemo(()=>{if(!y||!N||!g||D)return[];const e=g.o.bandwidth(),t=g.o.domain().map((t,n)=>{var o;return{value:t,pixel:(null!==(o=g.o(t))&&void 0!==o?o:0)+e/2,label:b?b(t,n):t}});if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e;let o,i=0,r=!1;for(const e of t)"string"==typeof e.label?i=Math.max(i,e.label.length):"number"==typeof e.label?i=Math.max(i,(e.label+"").length):r=!0;o=F?r?24:16:Math.max(6.5*i,r?60:0)+6;const s=Math.max(1,Math.ceil(o/n));return 1===s?t:t.filter((e,t)=>t%s===0)},[y,N,g,b,D,F]),z=n.rTickValues,G=n.tickLabelEdgeAlign,q=n.axisExtent,V=t.useMemo(()=>y&&g&&!D?(z||St(g.r,5,q)).map(e=>({value:e,pixel:g.r(e),label:(x||Mt)(e)})):[],[y,g,x,D,z,q]),X=t.useRef(new Map),Y=t.useRef(null!==(o=null==L?void 0:L.length)&&void 0!==o?o:0),Q=null!==(r=null==L?void 0:L.length)&&void 0!==r?r:0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const Z=t.useMemo(()=>{if(!L||0===L.length)return null;const t=function(t,n,o){var r,a,l,c,u,d,g,y,m,p,v,b,x,w,k,j,A,S,O,M,C,_,P,L,R,T,$,I,B,H,E,D,F,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const i=Je(t,n,o);if(!i)return null;const{x:s,y:c}=i;if(!et(s,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(r=t.radius)&&void 0!==r?r:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(Ye,{noteData:Object.assign(Object.assign({x:s,y:c,dx:null!==(a=t.dx)&&void 0!==a?a:30,dy:null!==(l=t.dy)&&void 0!==l?l:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=Qe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12;const l=i>.6*(o.width||0),c=l?i-4:i+4,u=l?"end":"start";return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:c,y:a,textAnchor:u,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=Ze(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=s.packEnclose(i),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),[l,c]=ae(s),[u,d]=ae(a),h=l-r,f=c+r,g=u-r;return e.jsxs("g",{children:[e.jsx("rect",{x:h,y:g,width:f-h,height:d+r-g,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(h+f)/2,y:g-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=Qe(n,o),a=Ze(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Qe(t,o),r=Ze(t,o);return e.jsx(Ye,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,h=a?r:null,v=a?s:null;let b;const x=[],w=new Map;if(a&&h&&v){for(const e of i){const t=e[h];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[h],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,j=null!==(y=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==y?y:null===(m=o.scales)||void 0===m?void 0:m.value;if(!k||!j)return null;const A=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,O=j;let M;if(a)if(l){const e=A(O);M=(t,n)=>[S(n),e(t)]}else{const e=A(S);M=(t,n)=>[e(t),O(n)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const y=u*f-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*g-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(p=t.bandwidth)&&void 0!==p?p:.3):("polynomial"===C?f.default.polynomial(b,{order:t.order||2}):f.default.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=t.color||"#6366f1",R=_[_.length-1],[T,$]=M(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:T+4,y:$-4,fill:L,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.value,r=null!==(w=null==i?void 0:i(t.y0))&&void 0!==w?w:0,s=null!==(k=null==i?void 0:i(t.y1))&&void 0!==k?k:o.height||0;return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.max(Math.min(r,s),0)+13,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",a=null!==(A=null===(j=o.scales)||void 0===j?void 0:j.x)&&void 0!==A?A:null===(S=o.scales)||void 0===S?void 0:S.time,l=null!==(M=null===(O=o.scales)||void 0===O?void 0:O.y)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const f=st[o.curve||"linear"]||i.curveLinear,g=i.area().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(f)(h);if(!g)return null;const y=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:y,fillOpacity:null!==(_=t.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:y,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(L=null===(P=o.scales)||void 0===P?void 0:P.x)&&void 0!==L?L:null===(R=o.scales)||void 0===R?void 0:R.time,a=null!==($=null===(T=o.scales)||void 0===T?void 0:T.y)&&void 0!==$?$:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(B=t.threshold)&&void 0!==B?B:2,f=c-h*d,g=!1!==t.showBand,y=t.fill||"#6366f1",m=null!==(H=t.fillOpacity)&&void 0!==H?H:.1,p=t.anomalyColor||"#ef4444",v=null!==(E=t.anomalyRadius)&&void 0!==E?E:6,b=a(c+h*d),x=a(f),w=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[g&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:m}),w.map((t,n)=>{const i=Qe(t,o),r=Ze(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(F=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==F?F:null===(N=o.scales)||void 0===N?void 0:N.time,l=null!==(z=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(G=o.scales)||void 0===G?void 0:G.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=f.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),p=null!==(q=t.confidence)&&void 0!==q?q:.95,v=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=null!==(V=t.steps)&&void 0!==V?V:5,x=c[d-1][0],w=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const j=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(m>0?Math.pow(e-y,2)/m:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(X=t.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(Q=t.strokeDasharray)&&void 0!==Q?Q:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Je(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!et(i,r,o))return null;const s=null!==(Z=t.dx)&&void 0!==Z?Z:0,a=null!==(K=t.dy)&&void 0!==K?K:0,l=null!==(U=t.width)&&void 0!==U?U:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Je(t,n,o);if(!i)return null;const{x:r,y:s}=i,a=r+(t.dx||0),l=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:a,y:l,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?h.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:a,y2:l,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),h.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=o.scales)||void 0===te?void 0:te.o,a=null===(ne=o.scales)||void 0===ne?void 0:ne.x,l=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),g&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),g&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,r={scales:g?{x:n?g.r:o||g.r,y:n&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:I,width:a,height:l,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:X.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:it(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>nt(e.annotation)),r=t.some(e=>null!=ot(e.annotation)),s=t.some(e=>"layer"===ot(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const a=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of n)e.emphasis&&(e.rank=tt[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=nt(n.annotation);let a=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:rt(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=ot(n.annotation);return l&&(a=e.jsx("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+o)),s&&(a=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return i&&l.unshift(e.jsx("style",{children:".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}}"},"annotation-disclosure-style")),s&&l.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}(r)}(R?At(Object.assign({annotations:L,context:r},"object"==typeof R?R:{})):L,t,T,r)},[L,R,T,a,l,g,$,I,B]);return y||k||j||P||Z&&Z.length>0||w||E?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[w&&g&&!D&&!H&&e.jsx("g",{className:"ordinal-grid",children:V.map((t,n)=>e.jsx("line",{x1:F?t.pixel:0,y1:F?0:t.pixel,x2:F?t.pixel:a,y2:F?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),y&&g&&!D&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,F?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!H&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!H&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&a-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),V.map((n,o)=>{const i=G?0===o?"start":o===V.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)}),v&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:v})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!H&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((n,o)=>e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)),v&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:v})]})]})})})(),Z,P,E]}),k&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof k?k:null}),Ne({legend:j,totalWidth:c,totalHeight:u,margin:d,legendPosition:C,title:k,legendLayout:_,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:M})]}):null}function _t(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function Pt({width:n,height:o,totalWidth:i,totalHeight:r,margin:s,scales:a,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),f=t.useRef(u);f.current=u;const g=t.useRef(a);g.current=a;const y=t.useRef(!1),m=t.useRef(null),p="horizontal"===(null==a?void 0:a.projection),v=t.useRef(p);return v.current=p,t.useEffect(()=>{if(!d.current)return;const e=l.select(d.current).select(".brush-g"),t=p?c.brushX():c.brushY();return t.extent([[0,0],[n,o]]),t.on("brush end",e=>{if(y.current)return;const t=g.current;if(!t)return;if(!e.selection)return m.current=null,void f.current(null);const[n,o]=e.selection;let i;i=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};m.current=r,f.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[n,o,p]),t.useEffect(()=>{if(!a||!h.current||!m.current)return;if(!d.current)return;const e=m.current,t=l.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);p?(y.current=!0,t.call(h.current.move,[n,o]),y.current=!1):(y.current=!0,t.call(h.current.move,[o,n]),y.current=!1)},[a,p]),e.jsx("svg",{ref:d,width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}function Lt(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Rt(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const Tt=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function $t(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Tt(i,r),t=Tt(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Tt(i,r),t=Tt(i,s),n=Tt(o,s),l=Tt(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return $t(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,f=!!e.roundStart&&h>c,g=!!e.roundEnd&&h>c;if(!f&&!g)return $t(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const y=r+(f?c:0),m=s-(g?c:0),p=r+(f?u:0),v=s-(g?u:0),b=Tt(i,y),x=Tt(i,m),w=(i-l)*Math.cos(c),k=Tt(w,r),j=Tt(w,s),A=a?null:Tt(o,v),S=a?null:Tt(o,p),O=a?0:(o+l)*Math.cos(u),M=a?null:Tt(O,r),C=a?null:Tt(O,s),_=m-y>Math.PI?1:0,P=a?0:v-p>Math.PI?1:0;let L="";if(f)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=Tt(i,r);L+=`M${e.x},${e.y}`}if(g)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Tt(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(g)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Tt(o,s);L+=` L${e.x},${e.y}`}if(f)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Tt(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function It(e){const t=$t({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:$t({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const Bt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Ht(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Et(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Dt="undefined"==typeof window||"undefined"==typeof document,Ft="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Nt=()=>()=>{},Wt=()=>!1,zt=()=>!0;function Gt(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function qt(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Vt(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Xt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Yt=new WeakMap;let Qt=0,Zt=!1,Kt=null,Ut=null,Jt=null;function en(e,t){var n,o;if(!t)return t;const i=Xt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Zt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Zt=!0;const e=()=>{Qt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Kt=new MutationObserver(e),Kt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ut=window.matchMedia("(prefers-color-scheme: dark)"),Jt=e,"function"==typeof Ut.addEventListener?Ut.addEventListener("change",Jt):"function"==typeof Ut.addListener&&Ut.addListener(Jt)}catch(e){}}();let s=Yt.get(r);s&&s.version===Qt||(s={version:Qt,map:new Map},Yt.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const tn=h.createContext(null),nn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function on(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const rn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function sn(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const an="semiotic-accessible-data-table",ln=an+" semiotic-accessible-data-table-hidden",cn=an+" semiotic-accessible-data-table-visible",un={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"},dn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},hn={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)"},fn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},gn={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))"},yn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},mn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},pn={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 vn({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=h.useState(!1),[l,c]=h.useState(5),u=h.useContext(tn),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,f=s||d,g=h.useRef(null),y=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;h.useEffect(()=>{f||c(5)},[f]);const m=h.useCallback(e=>{e.target===e.currentTarget&&(s||d||a(!0))},[s,d]),p=h.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:nn}):null;if(!f)return e.jsx("div",{id:o,className:ln,tabIndex:-1,onFocus:m,style:nn,role:"region","aria-label":y,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,f,g,y,m,p;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:sn(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:sn(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=sn(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:sn(x.datum)});break;case"arc":v.push({label:"Arc",values:sn(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:sn(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(y=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(g=x.datum)||void 0===g?void 0:g.name)&&void 0!==y?y:"",value:null!==(p=null===(m=x.datum)||void 0===m?void 0:m.value)&&void 0!==p?p:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${rn(e.min)} to ${rn(e.max)}, mean ${rn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(v.length,b),w=Math.min(l,v.length),k=v.slice(0,w),j=v.length-w,A=new Set;for(const e of k)for(const t of Object.keys(e.values))A.add(t);const S=Array.from(A);return e.jsxs("div",{ref:g,id:o,className:cn,tabIndex:-1,onBlur:p,style:un,role:"region","aria-label":y,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:hn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:dn,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:fn,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:mn,children:j>0?`First ${w} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:gn,children:"type"}),S.map(t=>e.jsx("th",{style:gn,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:yn,children:t.label}),S.map(n=>{return e.jsx("td",{style:yn,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":rn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),j>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:pn,children:["Show ",Math.min(25,j)," more"," ",1===j?"row":"rows"," (",j," remaining)"]})]})}function bn({summary:t}){return t?e.jsx("div",{role:"note",style:nn,children:t}):null}function xn({tableId:t}){return e.jsx("a",{href:"#"+t,style:nn,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,nn)},children:"Skip to data table"})}function wn({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:nn,children:n})}const kn="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:kn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:kn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:kn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function An(e){return Array.isArray(e)?e[0]:e}const Sn={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 On(e,t){return"function"==typeof t?t(e):e[t]}function Mn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Cn(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=On(t,o);a=Mn(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=On(t,o);l.push({label:n,value:Mn(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Mn(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Mn(t[e[0]],i))}}const c=Object.assign(Object.assign({},Sn),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function _n(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let i=An(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t);("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Sn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Cn(t):Cn())}}function Pn({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=h.useRef(null),[d,f]=h.useState(null);h.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,i]);let g;g=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const y=function(e){if(!h.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),m=y?null:Sn;return c?e.jsx("div",{ref:u,className:y?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function Ln(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=Rn(n);return[function({children:o,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>Rn(n,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:o})},(e,n)=>{var o;const s=i(),a=null!==(o=t.useContext(s))&&void 0!==o?o:r,l=t.useRef(e);l.current=e;const c=t.useRef({hasValue:!1,value:void 0}),u=t.useCallback(()=>{const e=l.current(a.getState()),t=c.current;return t.hasValue&&n&&n(t.value,e)?t.value:(c.current={hasValue:!0,value:e},e)},[a,n]),d=t.useCallback(()=>l.current(a.getState()),[a]);return t.useSyncExternalStore(a.subscribe,u,d)}]}function Rn(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function Tn(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function $n(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:In})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const In=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Bn={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}},Hn={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}},En={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:In,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 Dn(e,t){if("light"===t)return Bn;if("dark"===t)return Hn;if("high-contrast"===t)return En;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?Hn:Bn;return $n(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return $n(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[Fn,Nn]=Ln(e=>({theme:Bn,setTheme(t){e(e=>({theme:Dn(e.theme,t)}))}}));const Wn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function zn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Gn(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=zn(e.foregroundGraphics,r,s),u=zn(e.backgroundGraphics,r,s),d=Nn(e=>e.theme),{transition:f,introEnabled:g}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),y="semiotic-table-"+h.useId(),m=t.useRef(0),p=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>p.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),w=t.useRef(null),k=t.useRef(0),j=t.useCallback(()=>{k.current=0;const e=w.current;w.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{w.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(j))},[j]),S=t.useCallback(()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const O=e.themeDirtyRef;return Wn(()=>{O&&(Qt++,O.current=!0,v())},[d,v,O]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:f,introEnabled:g,tableId:y,rafRef:m,renderFnRef:p,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:S}}function qn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Vn(e,t,n=.3){qn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Xn(e,t,n=.6){var o,i,r,s,a;if(!qn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Yn(e,t,n,o=.35){qn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Qn(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Zn(e,t,n){return null==t?n:"string"!=typeof t?t:en(e,t)||n}function Kn(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,i,r,s),[h,f,g]=Qn(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function Un(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=Rt(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Jn(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const eo=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)to(e,t);else if(t.cornerRadii&&Lt(t.cornerRadii)){const n=Zn(e,t.style.fill,en(e,"var(--semiotic-primary, #007bff)")),o=Jn(t),i=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Un(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Zn(e,t.style.fill,en(e,"var(--semiotic-primary, #007bff)")),o=Jn(t),i=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Zn(e,t.style.fill,en(e,"var(--semiotic-primary, #007bff)")),o=Jn(t),i=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Vn(e,t),e.globalAlpha=1}};function to(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const no=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{const t=e.globalAlpha;for(const n of s){e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI);const o=null!==(r=null!==(i=n.style.opacity)&&void 0!==i?i:n.style.fillOpacity)&&void 0!==r?r:1;e.globalAlpha=t*o,e.fillStyle=Zn(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Zn(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Xn(e,n)}}finally{e.restore()}}},oo=new Map;function io(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=oo.get(n);return o||(o=new Path2D(ne(e.symbolType,e.size)),oo.size>256&&oo.clear(),oo.set(n,o)),o}catch(e){return null}}const ro=(e,t)=>{var n,o,i,r;const s=e.globalAlpha;for(const a of t){if("symbol"!==a.type)continue;const t=a;if(0>=t.size)continue;const l=io(t);if(!l)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const c=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*(null!==(o=t._decayOpacity)&&void 0!==o?o:1);t.style.fill&&(e.globalAlpha=s*c*(null!==(i=t.style.fillOpacity)&&void 0!==i?i:1),e.fillStyle=Zn(e,t.style.fill,"#4e79a7"),e.fill(l)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=s*c,e.strokeStyle=Zn(e,t.style.stroke,t.style.stroke),e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,e.stroke(l)),e.restore()}e.globalAlpha=s};function so(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=It({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=en(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=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ao(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 lo(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=i.arc().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}const co=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)so(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ao(e,t),Yn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?en(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=$t({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),lo(e,t)):(ao(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ao(e,t),Yn(e,t)),e.globalAlpha=1}}},uo=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=en(e,"var(--semiotic-primary, #007bff)"),a=en(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?en(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?en(e,u)||u:a,h=t.style.strokeWidth||1,f=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=f,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},ho=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?en(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},fo=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=en(e,n.style.stroke)||("string"==typeof n.style.fill?en(e,n.style.fill):n.style.fill)||en(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},go=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=en(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function yo(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 mo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let po=null;function vo(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(po||(po=document.createElement("canvas")),po.width=e,po.height=e,po)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const bo=new Map;function xo(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=bo.get(n);if(void 0!==o)return o;const i=vo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return bo.set(n,i),i}function wo(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function ko(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 jo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ao=e=>[fo,...e],So={bar:Ao([eo]),clusterbar:Ao([eo]),point:Ao([no,ro]),swarm:Ao([no,ro]),pie:[co],donut:[co],boxplot:Ao([uo,no]),violin:Ao([ho]),histogram:Ao([eo]),ridgeline:Ao([ho]),timeline:Ao([eo]),funnel:[eo,go,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?yo(i):null!=r?`${yo(i)} (${mo(r)})`:yo(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=yo(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[eo,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||en(e,"var(--semiotic-border, #999)"),o=xo(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=Qn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,en(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?jo(i):"",d=ko(o);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,g=Math.max(h,f)+12,y=r?32:17,m=n.__barFunnelLabelX,p=m-g/2,v=n.__barFunnelLabelY-y-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),wo(e,p,v,g,y,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),wo(e,p,v,g,y,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,m,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,m,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,m,v+3))}e.lineWidth=1}],swimlane:Ao([eo]),custom:Ao([eo,no,ro,co,uo,ho,go])},Oo={top:50,right:40,bottom:60,left:70},Mo={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Co(t){const n=function(e,t={}){var n;if(!e||"object"!=typeof e)return{entries:[]};const o=null!==(n=t.maxEntries)&&void 0!==n?n:6,i=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(i&&p.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let s=r.findIndex(e=>g.includes(e.lower));const a=s>=0;0>s&&(s=r.findIndex(e=>"id"===e.lower)),0>s&&(s=r.findIndex(e=>"string"==typeof e.value));const l=0>s?void 0:r[s];let c=r.filter((e,t)=>t!==s);a&&(c=c.filter(e=>"id"!==e.lower));const u=v(c,y),d=v(c,m),h=new Set(y),f=new Set(m),b=[];u&&b.push({key:u.key,value:u.value}),d&&b.push({key:d.key,value:d.value});for(const e of c){if(b.length>=o)break;e!==u&&e!==d&&(h.has(e.lower)||f.has(e.lower)||b.push({key:e.key,value:e.value}))}return{titleKey:null==l?void 0:l.key,title:null==l?void 0:l.value,entries:b}}(t,{skipPositional:!1});return null==n.title&&0===n.entries.length?null:e.jsxs("div",{className:"semiotic-tooltip",style:Mo,children:[null!=n.title&&e.jsx("div",{style:{fontWeight:"bold"},children:n.title+""}),n.entries.map(t=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t.key,":"]})," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]},t.key))]})}function _o({hover:t}){var n,o,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Mo,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Mo,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Mo,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,f=t.__chartType;if("swarm"===f||"point"===f)return Co(l);const g=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",y=null!==(a=null!==(s=null!==(r=null!==(i=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";return g||""!==y?e.jsxs("div",{className:"semiotic-tooltip",style:Mo,children:[g&&e.jsx("div",{style:{fontWeight:"bold"},children:g+""}),""!==y&&e.jsx("div",{children:"number"==typeof y?y.toLocaleString():y+""})]}):Co(l)}_o.ownsChrome=!0;const Po=t.forwardRef(function(n,o){var r,s,a,l,c,u,d,f,g,y,m,p;const{chartType:v,runtimeMode:b,data:k,oAccessor:j="category",rAccessor:A="value",colorAccessor:S,symbolAccessor:O,symbolMap:M,stackBy:C,groupBy:_,multiAxis:P,timeAccessor:L,valueAccessor:R,categoryAccessor:T,projection:$="vertical",size:I=[600,400],responsiveWidth:B,responsiveHeight:H,margin:E,barPadding:D,roundedTop:F,gradientFill:N,trackFill:W,baselinePadding:z,innerRadius:G,cornerRadius:q,normalize:V,startAngle:X,sweepAngle:Y,dynamicColumnWidth:Q,bins:Z,showOutliers:K,showIQR:U,amplitude:J,connectorOpacity:ee,showLabels:te,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:fe,colorScheme:me,barColors:pe,showAxes:ve=!0,showCategoryTicks:we,categoryLabel:Te,valueLabel:$e,categoryFormat:Ie,valueFormat:Be,oLabel:He,rLabel:Ee,oFormat:De,rFormat:Fe,rTickValues:Ne,tickLabelEdgeAlign:We,axisExtent:ze,enableHover:Ge=!0,hoverAnnotation:qe,tooltipContent:Ve,customHoverBehavior:Xe,annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,showGrid:Ke=!1,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,legendCategoryAccessor:rt,onCategoriesChange:st,backgroundGraphics:at,foregroundGraphics:lt,title:ct,className:ut,background:dt,centerContent:ht,decay:ft,pulse:gt,transition:yt,animate:mt,staleness:pt,brush:vt,onBrush:bt,accessibleTable:xt=!0,description:wt,summary:kt,customLayout:jt,layoutConfig:At,layoutSelection:St}=n,Mt=t.useRef(!0),Tt=Gn({sizeProp:I,responsiveWidth:B,responsiveHeight:H,userMargin:E,marginDefault:Oo,foregroundGraphics:lt,backgroundGraphics:at,animate:mt,transitionProp:yt,themeDirtyRef:Mt}),{reducedMotionRef:Xt,responsiveRef:Yt,size:Qt,margin:Zt,adjustedWidth:Kt,adjustedHeight:Ut,resolvedForeground:Jt,resolvedBackground:tn,currentTheme:nn,transition:rn,introEnabled:sn,tableId:an,rafRef:ln,renderFnRef:cn,scheduleRender:un}=Tt,dn=function(){const[e,n]=t.useState(!1);return Ft(()=>{n(!0)},[]),e}(),hn=function(){const e=t.useSyncExternalStore(Nt,Wt,zt);return t.useRef(e).current}(),fn=t.useMemo(()=>x(k),[k]),gn=null!=Te?Te:He,yn=null!=$e?$e:Ee,mn=null!=Ie?Ie:De,pn=null!=Be?Be:Fe,kn=t.useRef(null),Sn=t.useRef(null),On=t.useRef([]),Mn=t.useRef(rt),Cn=t.useRef(st);Mn.current=rt,Cn.current=st;const[_n,Ln]=t.useState(null),[Rn,$n]=t.useState(null),[In,Bn]=t.useState(0),Hn=t.useRef(0),[En,Dn]=t.useState(!1),Fn=t.useRef({w:-1,h:-1}),Nn=Ge||qe,Wn="streaming"===b,zn=t.useMemo(()=>{var e,t,n;return{chartType:v,runtimeMode:Wn?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:le,projection:$,oAccessor:Wn?void 0:j,rAccessor:Wn?void 0:A,colorAccessor:S,symbolAccessor:O,symbolMap:M,stackBy:C,groupBy:_,multiAxis:P,timeAccessor:Wn?L:void 0,valueAccessor:Wn?R||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:Wn?T||j:void 0,rExtent:se,oExtent:ae,axisExtent:ze,barPadding:D,roundedTop:F,gradientFill:N,trackFill:W,baselinePadding:z,innerRadius:G,cornerRadius:q,normalize:V,startAngle:X,sweepAngle:Y,dynamicColumnWidth:Q,bins:Z,showOutliers:K,showIQR:U,amplitude:J,connectorOpacity:ee,showLabels:te,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:fe,colorScheme:me,themeCategorical:null===(e=null==nn?void 0:nn.colors)||void 0===e?void 0:e.categorical,themeSemantic:Tn(nn),themeSequential:null===(t=null==nn?void 0:nn.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==nn?void 0:nn.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:ft,pulse:gt,transition:rn,introAnimation:sn,staleness:pt,customLayout:jt,layoutConfig:At,layoutMargin:Zt}},[v,de,ue,le,$,j,A,S,O,M,C,_,P,L,R,T,se,ae,ze,D,F,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,oe,ie,re,ce,he,fe,me,pe,ft,gt,null==rn?void 0:rn.duration,null==rn?void 0:rn.easing,sn,pt,Wn,nn,jt,At,Zt]),qn=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return qt(e,t);if(!Vt(e)||!Vt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!qt(n,i))return!1}else{if(!Vt(n)||!Vt(i))return!1;if(!Gt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(zn),Vn=t.useRef(null);Vn.current||(Vn.current=new ge(qn));const Xn=t.useCallback(()=>{var e,t;const n=Mn.current,o=Cn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Vn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,On.current)||(On.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Vn.current)||void 0===e||e.updateConfig(qn),Mt.current=!0,un()},[qn,un]);const Yn=t.useRef(null);t.useEffect(()=>{const e=Vn.current;if(!e)return;const t=null!=St?St:null;Yn.current!==t&&(Yn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):Mt.current=!0,un())},[St,un]);const Qn=t.useRef(null);Qn.current||(Qn.current=new w(e=>{const t=Vn.current;t&&t.ingest(e)&&(Mt.current=!0,un())}));const Zn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.push(e)},[]),Kn=t.useCallback(e=>{var t;null===(t=Qn.current)||void 0===t||t.pushMany(e)},[]),Un=t.useCallback(()=>{var e,t;null===(e=Qn.current)||void 0===e||e.clear(),null===(t=Vn.current)||void 0===t||t.clear(),Mt.current=!0,un()},[un]),Jn=t.useCallback(e=>{var t,n;null===(t=Qn.current)||void 0===t||t.clearLastData(),null===(n=Qn.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:Zn,pushMany:Kn,replace:Jn,remove:e=>{var t,n,o,i;null===(t=Qn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Vn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Sn.current)||void 0===i?void 0:i.data;!!Sn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Sn.current=null,Ln(null)),Mt.current=!0,un()}return r},update:(e,t)=>{var n,o,i;null===(n=Qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Vn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Mt.current=!0,un()),r},clear:Un,getData:()=>{var e,t,n;return null===(e=Qn.current)||void 0===e||e.flush(),null!==(n=null===(t=Vn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Vn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Zn,Kn,Jn,Un,un]),t.useEffect(()=>{var e;k&&(null===(e=Qn.current)||void 0===e||e.setBoundedData(fn))},[k,fn]);const{hoverHandlerRef:eo,hoverLeaveRef:to,onPointerMove:no,onPointerLeave:oo}=Tt;eo.current=e=>{if(!Nn)return;const t=kn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Zt.left,i=e.clientY-n.top-Zt.top;if(0>o||o>Kt||0>i||i>Ut)return void(Sn.current&&(Sn.current=null,Ln(null),Xe&&Xe(null),un()));const r=Vn.current;if(!r||0===r.scene.length)return;const s="radial"===$,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,i+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,g=1/0;return e.visit((e,i,l,y,m)=>{if(i>u||c>y||l>h||d>m)return!0;if(!e.length){let i=e;do{const e=i.data,l=r(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);xe(a(e),o)>=u&&g>u&&(f=e,g=u),i=i.next}while(i)}return!1}),f?{node:f,distance:g}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=ke(r,t,n);break;case"point":if(i)break;e=je(r,t,n,o);break;case"symbol":e=Ae(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=Se(r,t,n);break;case"boxplot":e=Oe(r,t,n);break;case"violin":e=Me(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Kt/2:o,s?i-Ut/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Sn.current&&(Sn.current=null,Ln(null),Xe&&Xe(null),un()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:v}),Object.assign({data:An(c),x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;Sn.current=l,Ln(l),Xe&&(Xe(l),Mt.current=!0),un()},to.current=()=>{Sn.current&&(Sn.current=null,Ln(null),Xe&&(Xe(null),Mt.current=!0),un())};const io=t.useRef(-1),ro=t.useRef(null),so=t.useRef(null),ao=t.useCallback(e=>{const t=Vn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(so.current&&so.current.version===n)o=so.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("symbol"===r.type){if(0>=r.size)continue;i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),so.current={version:n,graph:o}}const i=io.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),io.current=0;const t=o.flat[0];ro.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},_e(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:v});return Sn.current=n,Ln(n),Xe&&Xe(n),void un()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Ce(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Ce(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return io.current=-1,ro.current=null,Sn.current=null,Ln(null),Xe&&Xe(null),void un();io.current=s;const a=o.flat[s];ro.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},_e(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:v});Sn.current=l,Ln(l),Xe&&Xe(l),un()},[Xe,un]),lo=t.useCallback(e=>{io.current=-1,ro.current=null,no(e)},[no]);cn.current=()=>{var e,t;ln.current=0;const n=kn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Vn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Xt.current?r+1e6:r),a=!Xt.current&&s,l=Fn.current.w!==Kt||Fn.current.h!==Ut,c=Mt.current;let u=!1;!c&&!l||a&&!l||(i.computeScene({width:Kt,height:Ut}),Fn.current={w:Kt,h:Ut},u=!0,Xn()),Mt.current=c&&a&&!u,(u||a)&&n.setAttribute("aria-label",on(i.scene,v+" chart"));const d="undefined"!=typeof window&&window.devicePixelRatio||1,h=Qt[0]*d,f=Qt[1]*d;n.width===h&&n.height===f||(n.width=h,n.height=f,n.style.width=Qt[0]+"px",n.style.height=Qt[1]+"px"),o.setTransform(d,0,0,d,0,0),o.clearRect(0,0,Qt[0],Qt[1]);const g=null!==(e=null==pt?void 0:pt.threshold)&&void 0!==e?e:5e3,y=pt&&i.lastIngestTime>0&&r-i.lastIngestTime>g;if(y&&(o.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==dt&&!at){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=dt||(e&&"transparent"!==e?e:null),i=t?en(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Qt[0],Qt[1]))}const m="radial"===$;o.save(),o.beginPath(),o.rect(Zt.left,Zt.top,Kt,Ut),o.clip(),m?(o.save(),o.translate(Zt.left+Kt/2,Zt.top+Ut/2)):o.translate(Zt.left,Zt.top);const p=jt?So.custom:So[v]||[],b={width:Kt,height:Ut};for(const e of p)e(o,i.scene,i.scales,b);m&&o.restore(),o.restore(),y&&(o.globalAlpha=1),u&&i.scales?($n(i.scales),Bn(e=>e+1),Hn.current=r):a&&i.scales&&r-Hn.current>=33&&(Bn(e=>e+1),Hn.current=r),(null==pt?void 0:pt.showBadge)&&Dn(!!y),(a||null!=i.activeTransition||i.hasActivePulses)&&(ln.current=requestAnimationFrame(()=>cn.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Ft(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}({hydrated:dn,wasHydratingFromSSR:hn,storeRef:Vn,dirtyRef:Mt,renderFnRef:cn,cleanup:()=>{var e;return null===(e=Qn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Mt.current=!0,un()},[v,Kt,Ut,ve,dt,un]),function(e,n,o,i,r,s){const a=t.useRef("fresh");t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{const t=n.current;if(!t||0===t.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){var n,o;if(!e||0>=t)return Le;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){var o,i,r;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const s=null!==(o=n.fresh)&&void 0!==o?o:1,a=null!==(i=n.aging)&&void 0!==i?i:1.5,l=null!==(r=n.stale)&&void 0!==r?r:3;return t*s>e?"fresh":t*a>e?"aging":t*l>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},Pe),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:Le}(e,l-t.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&s(c.isStale),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(pt,Vn,Mt,un,En,Dn);const co=Nn&&_n?Ve?Ve(_n):e.jsx(_o,{hover:_n}):null,uo="radial"===$,ho=co?e.jsx(Pn,{x:_n?uo?_n.x+Kt/2:_n.x:0,y:_n?uo?_n.y+Ut/2:_n.y:0,containerWidth:Kt,containerHeight:Ut,margin:Zt,className:"stream-ordinal-tooltip",children:co}):null,fo=_t(j,0,"__semiotic_resolvedO"),go=_t(A,0,"__semiotic_resolvedR"),yo=fo.key,mo=go.key,po=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(fo,go,Ye&&Ye.length>0||!1);if(Dt||!dn&&hn){const t=Vn.current;t&&k&&(t.ingest({inserts:fn,bounded:!0}),t.computeScene({width:Kt,height:Ut}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,l="radial"===$,c=l?Zt.left+Kt/2:Zt.left,u=l?Zt.top+Ut/2:Zt.top;return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(ut?" "+ut:""),role:"img","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),style:{position:"relative",width:B?"100%":Qt[0],height:H?"100%":Qt[1]},children:[e.jsx(bn,{summary:kt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Qt[0],height:Qt[1],style:{position:"absolute",left:0,top:0},children:[tn&&e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:tn}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[dt&&e.jsx("rect",{x:0,y:0,width:Kt,height:Ut,fill:dt}),n.map((t,n)=>function(t,n,o){var r,s,a,l,c,u,d,f,g;const y=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",m=e=>`ord-${t.type}-${y}-${n}-${e}`,p=`ord-${t.type}-${y}-${n}`;switch(t.type){case"rect":{const n=t,o=Et(p)+"-grad",i=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Ht(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(n,o),r=i?`url(#${o})`:Ht(n.style.fill);if(n.cornerRadii&&Lt(n.cornerRadii)){const t=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=Rt(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(n);return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},p)}if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:s,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+t},${s} A${t},${t} 0 0 0 ${o},${s+t} L${o},${s+l-t} A${t},${t} 0 0 0 ${o+t},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o+t},${s+l} A${t},${t} 0 0 1 ${o},${s+l-t} Z`;break;default:c=`M${o},${s+l} L${o},${s+t} A${t},${t} 0 0 1 ${o+t},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},p)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},p)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:Ht(n.style.fill),opacity:null!==(r=n.style.opacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},p)}case"symbol":return function(t,n,o){const i=ne(t.symbolType,t.size,t.path);return e.jsx("path",{d:i,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?Ht(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${null!=o?o:""}symbol-${n}`)}(t,n,o);case"wedge":{const r=t;if(r._gradientBand&&r._gradientBand.colors.length>0){const t=Et(`${o?o+"-":""}gauge-grad-${r.category||p}-${n}`),{clipPath:i,slices:u}=It({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:null===(a=null===(s=r.roundedEnds)||void 0===s?void 0:s.start)||void 0===a||a,roundEnd:null===(c=null===(l=r.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:r._gradientBand.colors});return e.jsxs("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:i})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,n)=>e.jsx("path",{d:t.d,fill:Ht(t.color)},n))}),r.style.stroke&&"none"!==r.style.stroke&&e.jsx("path",{d:i,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},p)}let u;if(r.roundedEnds)u=$t({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=i.arc().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),u=e(Bt)||""}return e.jsx("path",{d:u,transform:`translate(${r.cx},${r.cy})`,fill:Ht(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},p)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Ht(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Ht(n.style.fill),fillOpacity:null!==(d=n.style.fillOpacity)&&void 0!==d?d:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},p)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Ht(n.style.fill),fillOpacity:null!==(f=n.style.fillOpacity)&&void 0!==f?f:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},m("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},m("iqr")),e.jsx("circle",{cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},m("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2},m("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},m("med")))}return e.jsx("g",{children:o},p)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},p);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:Ht(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},p)}default:return null}}(t,n,an)).filter(Boolean)]})]}),e.jsx(Ct,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:o,showAxes:ve,showCategoryTicks:we,oLabel:gn,rLabel:yn,oFormat:mn,rFormat:pn,rTickValues:Ne,tickLabelEdgeAlign:We,axisExtent:ze,showGrid:Ke,title:ct,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,foregroundGraphics:ye(Jt,be(null===(a=Vn.current)||void 0===a?void 0:a.customLayoutOverlays,null!=St?St:null)),annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,annotationFrame:0,xAccessor:yo,yAccessor:mo,annotationData:po(null==t?void 0:t.getData())}),ht&&"radial"===$&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ht})]})}return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(ut?" "+ut:""),role:"group","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":Qt[0],height:H?"100%":Qt[1],overflow:"visible"},onKeyDown:ao,children:[xt&&e.jsx(xn,{tableId:an}),xt&&e.jsx(vn,{scene:null!==(c=null===(l=Vn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:v+" chart",tableId:an,chartTitle:"string"==typeof ct?ct:void 0}),e.jsx(bn,{summary:kt}),e.jsx(wn,{hoverPoint:_n}),e.jsxs("div",{role:"img","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Nn?lo:void 0,onMouseLeave:Nn?oo:void 0,children:[tn&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:tn})}),e.jsx(Ot,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:Rn,showAxes:ve,showGrid:Ke,rFormat:pn,rTickValues:Ne,axisExtent:ze}),e.jsx("canvas",{ref:kn,"aria-label":on(null!==(d=null===(u=Vn.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],v+" chart"),style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1]}}),e.jsx(Ct,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:Rn,showAxes:ve,showCategoryTicks:we,oLabel:gn,rLabel:yn,oFormat:mn,rFormat:pn,rTickValues:Ne,axisExtent:ze,showGrid:Ke,title:ct,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,foregroundGraphics:ye(Jt,be(null===(f=Vn.current)||void 0===f?void 0:f.customLayoutOverlays,null!=St?St:null)),annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,annotationFrame:In,xAccessor:yo,yAccessor:mo,annotationData:po(null===(g=Vn.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(vt||bt)&&"radial"!==$&&e.jsx(Pt,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:Rn,onBrush:bt||(()=>{})}),ht&&"radial"===$&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ht}),(null==pt?void 0:pt.showBadge)&&e.jsx(Re,{isStale:En,position:pt.badgePosition}),e.jsx(jn,{active:io.current>=0,hoverPoint:_n,margin:Zt,size:Qt,shape:null===(y=ro.current)||void 0===y?void 0:y.shape,width:null===(m=ro.current)||void 0===m?void 0:m.w,height:null===(p=ro.current)||void 0===p?void 0:p.h}),ho]})]})});function Lo(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Ro(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function To(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:_n(t)||n}}Po.displayName="StreamOrdinalFrame";const $o=t.createContext(null);function Io(){return t.useContext($o)}function Bo(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Ho(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Eo(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 n of e.values)if(!t.values.has(n))return!1;return!0}return!1}const[Do,Fo]=Ln(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Eo(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),s=Ho(r,t),a=new Map(s.clauses);return a.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},s),{clauses:a})),{selections:r}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),r=Ho(i,t);return i.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[No,Wo]=Ln(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let zo={positions:new Map};const Go=new Set;function qo(){for(const e of Go)e()}function Vo(e,t){const n=zo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(zo.positions);o.delete(e),zo={positions:o},qo()}function Xo(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Fo(e=>e.selections.get(i)),s=Fo(e=>e.setClause),a=Fo(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Bo(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"point",values:new Set(i)},n=!0;n&&s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"interval",range:i},n=!0;n&&s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function Yo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Qo(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}const Zo=t.createContext(!1),Ko=t.createContext(null),Uo="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Jo(e){const n=t.useContext(Ko),o=t.useId(),i=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;Uo(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Uo(()=>{n&&n.registerCategories(o,s)},[n,o,s])}function ei({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):Y[r%Y.length];return{label:i+"",color:a}}),label:""}]}}function ti(){return Nn(e=>e.theme)}function ni(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function oi(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function ii(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function ri(){var e;const t=ti(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function si(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return t.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,n,o])}h.createContext(void 0);const ai={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function li(e,t,n){var o,i,r,s,a,l,c;const u=ai[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:ci(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ci(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function ui(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function di(e,t){if(!t)return ui(e);try{const n=t(e);return null==n?ui(e):n}catch(t){return ui(e)}}function hi(e,t){return"function"==typeof t?t(e):e[t]}function fi({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=hi(c,t),d=hi(c,n),h=o?hi(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Sn,children:[e.jsx("div",{style:{fontWeight:"bold"},children:ui(u)}),e.jsx("div",{style:{marginTop:4},children:di(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(f=o,"string"==typeof f?f:"value"),": ",ui(h)]})]});var f}}function gi({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class yi extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(gi,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var mi;const pi="undefined"!=typeof process&&"production"!==(null===(mi=process.env)||void 0===mi?void 0:mi.NODE_ENV);function vi({componentName:t,width:n,height:o,children:i}){return e.jsx(yi,{fallback:i=>e.jsx(gi,{componentName:t,message:i.message,width:n,height:o}),children:i})}const bi={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"},xi={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function wi(e,t,n,o){if(!pi)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function ki(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function ji(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=ki(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Ai({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"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(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=ji(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Si(n){const{data:o,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:f,chartType:g,chartId:y,showLegend:m,userMargin:p,marginDefaults:v,onClick:b,hoverHighlight:w,loading:k,loadingContent:j,emptyContent:A,width:S,height:O}=n,M=void 0===i,C=t.useMemo(()=>x(o),[o]),[_,P]=t.useState([]),L=t.useCallback(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:$,customHoverBehavior:I,customClickBehavior:B,crosshairSourceId:H}=function({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(n,o),f="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],g=Xo({name:(null==e?void 0:e.name)||"__unused__"}),y=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=Xo({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Qo(t)&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:f}),m=Wo(e=>e.pushObservation),p=e?{isActive:g.isActive,predicate:g.predicate}:null,[v,b]=t.useState(null),x=u||o[0],w=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=ni(e,t,h.xField);null!=n&&function(e,t,n){const o=zo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(zo={positions:new Map(zo.positions).set(e,{xValue:t,sourceId:n})},qo())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&y.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Vo(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&y.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=oi(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,y,h,d,r,s,a,m,c,x]),j=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=ni(e,t,h.xField);null!=n&&function(e,t,n){const o=zo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(zo.positions);return t.delete(e),zo={positions:t},qo(),!1}zo={positions:new Map(zo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},qo()}(h.name||"hover",n,d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const n=oi(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[l,r,m,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=zo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(zo.positions);o.delete(e),zo={positions:o},qo()}(e,d),Vo(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:p,hoverSelectionHook:w,customHoverBehavior:k,customClickBehavior:j,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:f,chartType:g,chartId:y,onClick:b,hoverHighlight:w,colorByField:R}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(u,H),D=function(e,n,o){const i=Io(),r=ri();return t.useMemo(()=>{var t;if(!n)return;const s=null!=i?i:void 0,a=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(s&&ii(s)){const e=K(t.map(e=>({_cat:e})),"_cat",a);return t=>s[t]||e(t)}return K(t.map(e=>({_cat:e})),"_cat",a)}if(s&&ii(s)){const t=K(e,n,a);return e=>s[e]||t(e)}return K(e,n,a)}if(s&&ii(s)){const e=K([{_:"a"}],"_",a);return t=>s[t]||e(t)}},[e,n,o,i,r])}(C,r,s),F=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of C){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[C,r]),N=t.useMemo(()=>M&&_.length>0?_:F,[M,_,F]),W=function(e,n,o){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useMemo(()=>new Set,[]),c=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),u=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),d=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:l,onLegendHover:c,onLegendClick:u,legendSelectionHook:d}}(a,r,N),z=t.useMemo(()=>$||(W.legendSelectionHook?W.legendSelectionHook:T),[$,W.legendSelectionHook,T]),G=function(e){const n=Nn(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),q=ri(),V=Io(),X=t.useMemo(()=>{if(D)return D;if(!r||0===N.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:q&&q.length>0?q:Y,t="__streamCat",n=K(N.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[D,r,N,s,q,V]),{legend:Q,margin:U,legendPosition:J}=function({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Zo),u=null!==t.useContext(Ko),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[l,n,e,h]);Jo(u&&n?f:[]);const g=t.useMemo(()=>{if(!d||!n)return;const t=ei({data:e,colorBy:n,colorScale:o,getColor:Z,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),y=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return g&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,g,r]);return{legend:g,margin:y,legendPosition:r}}({data:C,colorBy:r,colorScale:X,showLegend:m,legendPosition:l,userMargin:p,defaults:v,categories:N}),ee=t.useMemo(()=>{const e={};return Q&&(e.legend=Q,e.legendPosition=J),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[Q,J,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),te=Array.isArray(i)?x(i):i,ne=function(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},xi),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(k,S,O,j),oe=ne?null:function(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},bi),{width:n,height:o}),children:i||"No data available"}):null}(te,S,O,A);return{data:C,colorScale:D,allCategories:N,legendState:W,effectiveSelectionHook:z,activeSelectionHook:T,customHoverBehavior:I,customClickBehavior:B,legend:Q,margin:U,legendPosition:J,earlyReturn:ne||oe||null,legendBehaviorProps:ee,crosshairProps:E,resolvedSelection:G}}function Oi({ref:e,frameRef:n,setup:o}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[n]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function Mi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Ci(e){const{colorBy:n,colorScale:o,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f,cycleByCategory:g=!1,baseStyleExtras:y,linkStrokeToFill:m=!1}=e,p=t.useMemo(()=>(e,t)=>{const l="function"==typeof y?y(e,t):y,c=l?Object.assign({},l):{};if(void 0===c.fill)if(n){if(!o)return c;c.fill=Z(e,n,o)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=V[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(i,r,s,g?t:void 0,a);return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[n,o,i,r,s,a,g,y,m]),v=t.useMemo(()=>Mi(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},p(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},p(e,t)),l):p,{stroke:c,strokeWidth:u,opacity:d}),[p,l,c,u,d]);return t.useMemo(()=>{return e=v,n=f,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,f])}function _i(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const Pi=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,sort:y=!1,barPadding:m=40,roundedTop:p,gradientFill:v=!1,baselinePadding:b=!1,tooltip:w,annotations:k,regression:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>x(s),[s]),ne=Si({data:te,rawData:s,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:B,selection:O,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:G,height:q}),{effectiveLegendProps:oe,effectiveMargin:ie}=Oi({ref:o,frameRef:r,setup:ne});wi("BarChart",te,"categoryAccessor",c),wi("BarChart",te,"valueAccessor",u);const re=si(te,y,u),se=ri(),ae=t.useMemo(()=>new Map,[te]),le=Ci({colorBy:f,colorScale:ne.colorScale,color:H,themeCategorical:se,colorScheme:g,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=t.useMemo(()=>fi({categoryAccessor:c,valueAccessor:u,groupAccessor:f&&f!==c?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:h}),[c,u,f,h]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Ai({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(gi,{componentName:"BarChart",message:ue,width:G,height:q});const de=_i(j),he=de?[de,...k||[]]:k,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:m}),null!=p&&{roundedTop:p}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),z&&{dataIdAccessor:z}),{baselinePadding:b,enableHover:V,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:N,oSort:y}),oe),Lo({title:Q,description:Z,summary:K,accessibleTable:U,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:w,defaultTooltipContent:ce})),Ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"BarChart",width:G,height:q,children:e.jsx(Po,Object.assign({ref:r},fe))})});Pi.displayName="BarChart";const Li=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:g,colorScheme:y,normalize:m=!1,sort:p=!1,barPadding:v=40,roundedTop:b,baselinePadding:w=!1,tooltip:k,annotations:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>x(s),[s]),ee=g||u,te=Si({data:J,rawData:s,colorBy:ee,colorScheme:y,legendInteraction:I,legendPosition:B,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:W,height:z}),ne=ri(),oe=t.useMemo(()=>new Map,[J]),ie=Ci({colorBy:ee,colorScale:te.colorScale,color:H,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>fi({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),se=Ai({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Oi({ref:o,frameRef:r,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:m,oSort:p,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:w,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q}),ae),Lo({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:k,defaultTooltipContent:re})),Ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(gi,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(vi,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(Po,Object.assign({ref:r},ce))})});Li.displayName="StackedBarChart";const Ri=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:g,colorScheme:y,sort:m=!1,barPadding:p=60,roundedTop:v,baselinePadding:b=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,categoryFormat:F}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U=t.useMemo(()=>x(s),[s]),J=g||u,ee=Si({data:U,rawData:s,colorBy:J,colorScheme:y,legendInteraction:$,legendPosition:I,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W}),te=ri(),ne=t.useMemo(()=>new Map,[U]),oe=Ci({colorBy:J,colorScale:ee.colorScale,color:B,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:A.pieceStyle,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>fi({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),re=Ai({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=Oi({ref:o,frameRef:r,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:p}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G}),se),Lo({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:w,defaultTooltipContent:ie})),Ro({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(gi,{componentName:"GroupedBarChart",message:re,width:N,height:W}):e.jsx(vi,{componentName:"GroupedBarChart",width:N,height:W,children:e.jsx(Po,Object.assign({ref:r},le))})});function Ti({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const r=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=Xo({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Yo(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===c&&Yo(e)&&i&&(t[i]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Qo(t)&&a(t)},[c,o,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(r){l.current.end(e?e.r:null)}null==n||n(e)},[n,r]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Ri.displayName="GroupedBarChart";const $i=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:f,colorBy:g,colorScheme:y,barPadding:m,tooltip:p,annotations:v,brush:b,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:$,color:I,stroke:B,strokeWidth:H,opacity:E,categoryFormat:D,rTickValues:F,tickLabelEdgeAlign:N,showCategoryTicks:W,gradientFill:z,trackFill:G,roundedTop:q,valueExtent:V}=n,{width:X,height:Y,enableHover:Q,showGrid:Z,showLegend:K,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>x(s),[s]),re=g||u,se=t.useMemo(()=>{if(null!=m)return m;if("sparkline"!==n.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?Y:X)-2*t)/(t-1))):1},[m,n.mode,ie,c,h,X,Y]),ae=Si({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:T,legendPosition:$,selection:A,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:X,height:Y}),le=Ti({brushProp:b,onBrushProp:w,linkedBrush:k,valueAccessor:d}),ce=ri(),ue=t.useMemo(()=>new Map,[ie]),de=Ci({colorBy:re,colorScale:ae.colorScale,color:I,themeCategorical:ce,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:B,strokeWidth:H,opacity:E,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>fi({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),fe=Ai({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:ye}=Oi({ref:o,frameRef:r,setup:ae});if(ae.earlyReturn)return ae.earlyReturn;const me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ye,barPadding:se,enableHover:Q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:f}),F&&{rTickValues:F}),null!=N&&{tickLabelEdgeAlign:N}),D&&{oFormat:D}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Z}),ge),Lo({title:U,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:p,defaultTooltipContent:he})),Ro({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),v&&v.length>0&&{annotations:v}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=G&&{trackFill:G}),null!=q&&{roundedTop:q}),V&&{rExtent:V}),le.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return fe?e.jsx(gi,{componentName:"SwimlaneChart",message:fe,width:X,height:Y}):e.jsx(vi,{componentName:"SwimlaneChart",width:X,height:Y,children:e.jsx(Po,Object.assign({ref:r},me))})});function Ii(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}$i.displayName="SwimlaneChart";const Bi=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,sizeBy:y,sizeRange:m=[3,8],symbolBy:p,symbolMap:v,pointRadius:b=4,pointOpacity:w=.7,categoryPadding:k=20,tooltip:j,annotations:A,valueExtent:S,brush:O,onBrush:M,linkedBrush:C,frameProps:_={},selection:P,linkedHover:L,onObservation:R,onClick:T,hoverHighlight:$,chartId:I,loading:B,loadingContent:H,emptyContent:E,legendInteraction:D,legendPosition:F,color:N,stroke:W,strokeWidth:z,opacity:G,showCategoryTicks:q,categoryFormat:V}=n,{width:X,height:Y,enableHover:Q,showGrid:Z,showLegend:K,title:J,description:ee,summary:te,accessibleTable:ne,categoryLabel:oe,valueLabel:ie}=i,re=t.useMemo(()=>x(s),[s]),se=Si({data:re,rawData:s,colorBy:f,colorScheme:g,legendInteraction:D,legendPosition:F,selection:P,linkedHover:L,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:R,onClick:T,hoverHighlight:$,chartType:"SwarmPlot",chartId:I,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:B,loadingContent:H,emptyContent:E,width:X,height:Y}),le=Ti({brushProp:O,onBrushProp:M,linkedBrush:C,valueAccessor:u}),ce=t.useMemo(()=>{if(y)return ae(re.map(e=>"function"==typeof y?y(e):e[y]))},[re,y]),ue=ri(),de=t.useMemo(()=>new Map,[re]),he=Ci({colorBy:f,colorScale:se.colorScale,color:N,themeCategorical:ue,colorScheme:g,categoryIndexMap:de,userPieceStyle:null==_?void 0:_.pieceStyle,stroke:W,strokeWidth:z,opacity:G,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,baseStyleExtras:e=>({fillOpacity:w,r:y?U(e,y,m,ce):b})}),fe=t.useMemo(()=>fi({categoryAccessor:c,valueAccessor:u,groupAccessor:f||void 0,valueFormat:h}),[c,u,f,h]);if(se.earlyReturn)return se.earlyReturn;const ge=Ai({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ge)return e.jsx(gi,{componentName:"SwarmPlot",message:ge,width:X,height:Y});const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u}),p&&{symbolAccessor:p}),v&&{symbolMap:v}),{projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:he,size:[X,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se.margin,barPadding:k,enableHover:Q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:oe,rLabel:ie,rFormat:h}),V&&{oFormat:V}),{showGrid:Z,showCategoryTicks:q}),se.legendBehaviorProps),Lo({title:J,description:ee,summary:te,accessibleTable:ne,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:j,defaultTooltipContent:fe})),Ro({linkedHover:L,onObservation:R,onClick:T,hoverHighlight:$,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),le.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"SwarmPlot",width:X,height:Y,children:e.jsx(Po,Object.assign({ref:r},ye))})});function Hi(t){return n=>{var o;const i=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",r=n.stats||(n.data||n).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Sn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,r=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:Sn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:Sn,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}Bi.displayName="SwarmPlot";const Ei=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,showOutliers:y=!0,categoryPadding:m=20,tooltip:p,annotations:v,valueExtent:b,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:R,color:T,stroke:$,strokeWidth:I,opacity:B,showCategoryTicks:H,categoryFormat:E}=n,{width:D,height:F,enableHover:N,showGrid:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,Z=t.useMemo(()=>x(s),[s]),K=Si({data:Z,rawData:s,colorBy:f,colorScheme:g,legendInteraction:L,legendPosition:R,selection:k,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:D,height:F}),U=ri(),J=t.useMemo(()=>new Map,[Z]),ee=Ci({colorBy:f,colorScale:K.colorScale,color:T,themeCategorical:U,colorScheme:g,categoryIndexMap:J,userPieceStyle:void 0,stroke:$,strokeWidth:I,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>Hi(),[]);if(K.earlyReturn)return K.earlyReturn;const ne=Ai({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(gi,{componentName:"BoxPlot",message:ne,width:D,height:F});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[D,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:m,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:h}),E&&{oFormat:E}),{showGrid:W,showCategoryTicks:H}),K.legendBehaviorProps),Lo({title:G,description:q,summary:V,accessibleTable:X,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:p,defaultTooltipContent:te})),Ro({linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),v&&v.length>0&&{annotations:v}),b&&{rExtent:b}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"BoxPlot",width:D,height:F,children:e.jsx(Po,Object.assign({ref:r},oe))})});Ei.displayName="BoxPlot";const Di=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Fi=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=Di,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:f,colorBy:g,colorScheme:y,categoryPadding:m=20,tooltip:p,annotations:v,valueExtent:b,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,showCategoryTicks:F,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>x(s),[s]),ee=Si({data:J,rawData:s,colorBy:g,colorScheme:y,legendInteraction:$,legendPosition:I,selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:W,height:z}),te=Ti({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u}),ne=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of J){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[J,u]),oe=ri(),ie=t.useMemo(()=>new Map,[J]),re=Ci({colorBy:g,colorScale:ee.colorScale,color:B,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Sn,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Ai({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(gi,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),b?{rExtent:b}:ne&&{rExtent:ne}),{size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:F}),ee.legendBehaviorProps),Lo({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:p,defaultTooltipContent:se})),Ro({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),v&&v.length>0&&{annotations:v}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"Histogram",width:W,height:z,children:e.jsx(Po,Object.assign({ref:r},le))})});Fi.displayName="Histogram";const Ni=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:f=!0,valueFormat:g,colorBy:y,colorScheme:m,categoryPadding:p=20,tooltip:v,annotations:b,valueExtent:w,brush:k,onBrush:j,linkedBrush:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,showCategoryTicks:N,categoryFormat:W}=n,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>x(s),[s]),te=Si({data:ee,rawData:s,colorBy:y,colorScheme:m,legendInteraction:I,legendPosition:B,selection:O,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:z,height:G}),ne=Ti({brushProp:k,onBrushProp:j,linkedBrush:A,valueAccessor:u}),oe=ri(),ie=t.useMemo(()=>new Map,[ee]),re=Ci({colorBy:y,colorScale:te.colorScale,color:H,themeCategorical:oe,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>Hi({valueAccessor:u}),[u]);if(te.earlyReturn)return te.earlyReturn;const ae=Ai({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(gi,{componentName:"ViolinPlot",message:ae,width:z,height:G});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:f,size:[z,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:p,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:g}),W&&{oFormat:W}),{showGrid:V,showCategoryTicks:N}),te.legendBehaviorProps),Lo({title:Y,description:Q,summary:Z,accessibleTable:K,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:v,defaultTooltipContent:se})),Ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),b&&b.length>0&&{annotations:b}),w&&{rExtent:w}),ne.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"ViolinPlot",width:z,height:G,children:e.jsx(Po,Object.assign({ref:r},le))})});Ni.displayName="ViolinPlot";const Wi=t.forwardRef(function(n,o){var i;const r=li(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);Ii(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:f,colorBy:g,colorScheme:y,sort:m="auto",dotRadius:p=5,categoryPadding:v=10,tooltip:b,annotations:w,regression:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,categoryFormat:F}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=r,U=t.useMemo(()=>x(a),[a]),J=Si({data:U,rawData:a,colorBy:g,colorScheme:y,legendInteraction:$,legendPosition:I,selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:q,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W}),ee=si(U,m,d),te=ri(),ne=t.useMemo(()=>new Map,[U]),oe=Ci({colorBy:g,colorScale:J.colorScale,color:B,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:p,fillOpacity:.8}}),ie=t.useMemo(()=>fi({categoryAccessor:u,valueAccessor:d,valueFormat:f}),[u,d,f]);if(J.earlyReturn)return J.earlyReturn;const re=Ai({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(gi,{componentName:"DotPlot",message:re,width:N,height:W});const se=_i(k),ae=se?[se,...w||[]]:w,le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Z,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,oSort:m}),J.legendBehaviorProps),Lo({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:b,defaultTooltipContent:ie})),Ro({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"DotPlot",width:N,height:W,children:e.jsx(Po,Object.assign({ref:s},le))})});Wi.displayName="DotPlot";const zi=t.forwardRef(function(n,o){var i,r;const s=li(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:f,colorScheme:g,startAngle:y=0,cornerRadius:m,tooltip:p,annotations:v,frameProps:b={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I}=n,{width:B,height:H,enableHover:E,showLegend:D,title:F,description:N,summary:W,accessibleTable:z}=s,G=t.useMemo(()=>x(l),[l]),q=f||d,V=Si({data:G,rawData:l,colorBy:q,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:D,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:H}),X=ri(),Y=t.useMemo(()=>new Map,[G]),Q=Ci({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:X,colorScheme:g,categoryIndexMap:Y,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),Z=t.useMemo(()=>fi({categoryAccessor:d,valueAccessor:h,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,h,f]),K=Ai({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:U,effectiveMargin:J}=Oi({ref:o,frameRef:a,setup:V});if(V.earlyReturn)return V.earlyReturn;const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=l&&{data:G}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Q,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),U),Lo({title:F,description:N,summary:W,accessibleTable:z,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:p,defaultTooltipContent:Z})),Ro({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(gi,{componentName:"PieChart",message:K,width:B,height:H}):e.jsx(vi,{componentName:"PieChart",width:B,height:H,children:e.jsx(Po,Object.assign({ref:a},ee))})});zi.displayName="PieChart";const Gi=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:f,colorScheme:g,startAngle:y=0,cornerRadius:m,tooltip:p,annotations:v,frameProps:b={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I}=n,{width:B,height:H,enableHover:E,showLegend:D,title:F,description:N,summary:W,accessibleTable:z}=i,G=t.useMemo(()=>x(s),[s]),q=f||c,V=Si({data:G,rawData:s,colorBy:q,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:D,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:H}),X=null!=d?d:Math.max(2,.15*Math.min(B,H)),Y=ri(),Q=t.useMemo(()=>new Map,[G]),Z=Ci({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:Y,colorScheme:g,categoryIndexMap:Q,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>fi({categoryAccessor:c,valueAccessor:u,groupAccessor:f&&f!==c?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[c,u,f]),U=Ai({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=Oi({ref:o,frameRef:r,setup:V});if(V.earlyReturn)return V.earlyReturn;const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:G}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Z,innerRadius:X,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:h,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),J),Lo({title:F,description:N,summary:W,accessibleTable:z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:p,defaultTooltipContent:K})),Ro({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return U?e.jsx(gi,{componentName:"DonutChart",message:U,width:B,height:H}):e.jsx(vi,{componentName:"DonutChart",width:B,height:H,children:e.jsx(Po,Object.assign({ref:r},te))})});function qi(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function Vi(e){return Math.max(0,Math.min(1,e))}function Xi(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function Yi(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Qi(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Vi(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=Vi(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=Xi(t.color),l=Xi(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,f,g]=l;return Yi(c+(h-c)*s,u+(f-u)*s,d+(g-d)*s)}return n[n.length-1].color}function Zi(e,t,n){return`${e}-${t}`}Gi.displayName="DonutChart";const Ki=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),r=t.useRef(null),s="context"===n.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:f,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,cornerRadius:m,showNeedle:p=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!a,sweep:k=240,fillZones:j=!0,tooltip:A,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:R,title:T,description:$,summary:I,accessibleTable:B}=i,H=h&&"object"==typeof h?h:void 0,E=Math.max(c,Math.min(u,l)),D=u-c||1,F=(E-c)/D,{gaugeData:N,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];f=f.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const g=!!c&&c.colorStops.length>=2,y=[],m=new Map,p=[];if(g){const e=a?h:1,t=Zi("bg",0);if(y.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),m.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Qi(c.colorStops,e*(t+.5)/n));const i=Zi("fill",0);y.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),m.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=Zi("fill",n);y.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),m.set(e,{fill:o.color})}if(u>0){const e=Zi("bg",n);y.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),m.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:y,pieceStyle:(e,t)=>m.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:c,max:u,value:l,thresholds:d,fillColor:f,backgroundColor:g,fillZones:j,showScaleLabels:w,gradientFill:H}),[l,c,u,d,f,g,w,j,H]),G=t.useMemo(()=>Mi(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:q,startAngleDeg:V}=qi(k),X=function(e=240){const{sweepRad:t,offsetRad:n}=qi(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),[s,a]=ae(i),[l,c]=ae(r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),Y=Math.min(10,Math.max(1,Math.min(L,R)/12)),Q=X.cx,Z=X.cy,K=Math.max(4,Math.min((L-2*Y)/X.width,(R-2*Y)/X.height)-2),U=Math.max(0,Math.min(K-1.5,K*(1-y))),J=L/2-Q*K,ee=R/2-Z*K,te=2*(K+4),ne=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(E,c,u):b;const t=x?x(E):Math.round(E)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),w&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,E,c,u,x,w,K,a]),oe=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(E):Math.round(E)+""}:null,[s,b,E,x]),ie=t.useMemo(()=>{if(!p)return null;const e=-Math.PI/2+V*Math.PI/180+F*q,t=U>20?U-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[p,F,V,q,U,v]),re=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const i=(o.width||L)/2,r=(o.height||R)/2,s=Math.max(1,K-U),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const i=-Math.PI/2+V*Math.PI/180+(t.value-c)/D*q,r=(o.width||L)/2,s=(o.height||R)/2,a=U-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,f=Math.sin(i)*l,g=K+10,y=Math.cos(i)*g,m=Math.sin(i)*g,p=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return p>=11||1>p?(v="middle",b="auto"):p>=1&&5>p?(v="start",b="middle"):p>=5&&7>p?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:y,y:m,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*U,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[L,R,c,D,V,q,U,K]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),le=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,i=null==o?void 0:o._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===N.length)return e.jsx(gi,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:U,startAngle:V,sweepAngle:k},null!=m&&{cornerRadius:m}),{centerContent:ne,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:R-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:_n(A)||le,svgAnnotationRules:re}),se.length>0&&{annotations:se}),T&&{title:T}),$&&{description:$}),I&&{summary:I}),void 0!==B&&{accessibleTable:B}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),O);return e.jsx(vi,{componentName:"GaugeChart",width:L,height:R,children:e.jsx(Po,Object.assign({ref:r},ce))})});Ki.displayName="GaugeChart";const Ui=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:f=1.5,valueFormat:g,colorBy:y,colorScheme:m,categoryPadding:p=5,tooltip:v,annotations:b,valueExtent:w,frameProps:k={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,color:$,stroke:I,strokeWidth:B,opacity:H,showCategoryTicks:E,categoryFormat:D}=n,{width:F,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=i,K=t.useMemo(()=>x(s),[s]),U=Si({data:K,rawData:s,colorBy:y,colorScheme:m,legendInteraction:R,legendPosition:T,selection:j,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:F,height:N}),J=ri(),ee=t.useMemo(()=>new Map,[K]),te=Ci({colorBy:y,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=t.useMemo(()=>Hi(),[]);if(U.earlyReturn)return U.earlyReturn;const oe=Ai({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(gi,{componentName:"RidgelinePlot",message:oe,width:F,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[F,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,barPadding:p,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:E,oSort:!1,amplitude:f}),U.legendBehaviorProps),Lo({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),To({tooltip:v,defaultTooltipContent:ne})),Ro({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&b.length>0&&{annotations:b}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"RidgelinePlot",width:F,height:N,children:e.jsx(Po,Object.assign({ref:r},ie))})});Ui.displayName="RidgelinePlot";const Ji=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),r=t.useRef(null);Ii(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:f,orientation:g="horizontal",connectorOpacity:y=.3,showLabels:m=!0,tooltip:p,annotations:v,frameProps:b={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I,categoryFormat:B}=n,H="vertical"===g,{width:E,height:D,enableHover:F,showLegend:N,title:W,description:z,summary:G,accessibleTable:q}=i,V=H?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>x(s),[s]),Y=h||d,Q=!Y,Z=Si({data:X,rawData:s,colorBy:Y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:N,userMargin:a,marginDefaults:V,loading:M,loadingContent:C,emptyContent:_,width:E,height:D});wi("FunnelChart",X,"stepAccessor",c),wi("FunnelChart",X,"valueAccessor",u);const K=ri(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return R||((null==K?void 0:K[0])?K[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Q,R,K,f]),ee=Ci({colorBy:J?void 0:Y,colorScale:Z.colorScale,color:null!=J?J:R,themeCategorical:K,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),te=t.useMemo(()=>t=>{var n,o,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,f=null==l?void 0:l.__barFunnelIsDropoff,g=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,y=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Sn,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),g&&g!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:g+""}),f&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",y]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ne=Ai({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(gi,{componentName:"FunnelChart",message:ne,width:E,height:D});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:H?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ee,size:[E,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),B&&{oFormat:B}),{showGrid:H}),!H&&{connectorOpacity:y}),{showLabels:m}),Z.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===p?()=>null:!0===p||null==p?te:_n(p)||te}),(k||j||A||S)&&{customHoverBehavior:Z.customHoverBehavior}),(j||A||k)&&{customClickBehavior:Z.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(vi,{componentName:"FunnelChart",width:E,height:D,children:e.jsx(Po,Object.assign({ref:r},oe))})});Ji.displayName="FunnelChart";const er={RdBu:D,PiYG:F,PRGn:N,BrBG:W,RdYlBu:z,RdYlGn:G,Spectral:q},tr="__likert_neutral_neg",nr="__likert_neutral_pos";function or(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ir(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function rr(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:tr,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:nr,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function sr(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===tr?r=n:n.__likertLevel===nr?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const ar=["Very Low","Low","Neutral","High","Very High"],lr=new Map,cr=t.forwardRef(function(n,o){const i=li(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:f="count",levels:g=ar,orientation:y="horizontal",colorScheme:m,barPadding:p=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,categoryFormat:$,stroke:I,strokeWidth:B,opacity:H}=n,{width:E,height:D,enableHover:F,showGrid:N,showLegend:W,title:z,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Q}=i,U="horizontal"===y,J=void 0===s,ee=!d,te=function(){var e;const t=ti();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ne=t.useMemo(()=>m&&Array.isArray(m)&&m.length>=g.length?m:function(e,t){if(0>=e)return[];if(t){const n=er[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(g.length,te),[m,g.length,te]),oe=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],ne[t]||"#888");return e},[g,ne]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>or(o,"question"),[o]),d=t.useMemo(()=>c?or(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:or(r,"level"),[c,r]),f=t.useMemo(()=>c?null:or(s,"count"),[c,s]),g=e||[],y=t.useRef([]),m=t.useMemo(()=>{if(0===g.length)return[];let e=ir(g,n,u,d,h,f);return a&&(e=rr(e,n),e=sr(e,n)),e},[g,n,u,d,h,f,a]),p=t.useCallback(e=>{var t;let o=ir(e,n,u,d,h,f);a&&(o=rr(o,n),o=sr(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,f,a,l]);return{processedData:m,reAggregate:p,accumulatorRef:y}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:f,isDiverging:U,frameRef:r}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Io(),d=ri(),h=t.useCallback(e=>{const t=e[n];return null!=t?t+"":null},[n]),f=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,h]),g=t.useCallback(t=>{if(!e||!n)return;const o=Array.from(new Set(t.map(String))),i=a.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),a.current=o,c(e=>e+1))},[e,n]),y=t.useCallback(e=>t=>{f([t]),e(t)},[f]),m=t.useCallback(e=>t=>{f(t),e(t)},[f]),p=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Jo(e&&n?a.current:[]);const v=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:d&&d.length>0?d:Y,s=n,l=t.map(e=>({[s]:e})),c=K(l,s,r);return ei({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:Z})},[e,n,i,o,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:y,wrapPushMany:m,resetCategories:p,categories:a.current,categoryDomainProps:e&&n?{legendCategoryAccessor:n,onCategoriesChange:g}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:J,colorBy:ae,colorScheme:ne,showLegend:W,legendPosition:T}),ce=t.useCallback(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),ue=t.useCallback(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);t.useImperativeHandle(o,()=>({push:ce,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],le.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ce,ue,le.resetCategories,se]);const de=Si({data:ie,rawData:s,colorBy:ae,colorScheme:ne,legendInteraction:R,legendPosition:T,selection:k,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:E,height:D}),he=t.useMemo(()=>{const e=g.length;return e%2!=0&&oe.get(g[Math.floor(e/2)])||"#888"},[g,oe]),fe=Ci({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:lr,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===tr||i===nr)return{fill:he};const r=o||i;return r&&oe.has(r)?{fill:oe.get(r)}:{fill:"#888"}}}),ge=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),ye=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===tr||n===nr?ge:n,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=n===tr||n===nr?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:Sn},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[ge]),me=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return ee?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),f&&(e.countAccessor=f)),Ai({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,f,g,ee]),pe=t.useMemo(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,oe]),ve=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:pe},legendPosition:T||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,T,W,pe]),be=t.useMemo(()=>{const e=Object.assign({},de.margin);if(J&&!1!==W){const t=T||"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(le.streamingMarginAdjust)for(const[t,n]of Object.entries(le.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[de.margin,le.streamingMarginAdjust,U,J,W,T]),xe=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]);if(de.earlyReturn)return de.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:ie}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:fe,size:[E,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:be,barPadding:p,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Q||(U?void 0:"Percentage"),rFormat:xe}),$&&{oFormat:$}),{showGrid:N}),ve),z&&{title:z}),G&&{description:G}),q&&{summary:q}),void 0!==V&&{accessibleTable:V}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:!1===v?()=>null:!0===v?ye:_n(v)||ye}),(j||A||S||O)&&{customHoverBehavior:de.customHoverBehavior}),(A||S||j)&&{customClickBehavior:de.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return me?e.jsx(gi,{componentName:"LikertChart",message:me,width:E,height:D}):e.jsx(vi,{componentName:"LikertChart",width:E,height:D,children:e.jsx(Po,Object.assign({ref:r},we))})});cr.displayName="LikertChart";const ur=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:u,projection:d="vertical",margin:h,className:f,colorScheme:g,showAxes:y=!1,annotations:m,onObservation:p,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,loadingContent:j,emptyContent:A,frameProps:S={}}=n,{frameRef:O,resolved:M,safeData:C,setup:_,earlyReturn:P}=function(e){var n;const o=function(e){const n=t.useRef(null);return Ii(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:li(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>function(e){if(null==e)return;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}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=Si({data:null!==(n=e.data)&&void 0!==n?n:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:i.showLegend,userMargin:r,marginDefaults:i.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:g,selection:b,linkedHover:x,onObservation:p,onClick:v,chartId:w,loading:k,loadingContent:j,emptyContent:A,margin:h,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,mode:n.mode}),L=_.effectiveSelectionHook,R=t.useMemo(()=>(null==L?void 0:L.isActive)?{isActive:!0,predicate:L.predicate}:null,[null==L?void 0:L.isActive,null==L?void 0:L.predicate]);if(P)return P;const{width:T,height:$,enableHover:I,showGrid:B,title:H,description:E,summary:D,accessibleTable:F}=M,N=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:C}),{customLayout:r,layoutConfig:s}),R&&{layoutSelection:R}),{oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:g,size:[T,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:_.margin,enableHover:I,showAxes:y,showGrid:B,annotations:m}),Lo({title:H,description:E,summary:D,accessibleTable:F,className:f,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ro({linkedHover:x,onObservation:p,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),S);return e.jsx(vi,{componentName:"OrdinalCustomChart",width:T,height:$,children:e.jsx(Po,Object.assign({ref:O},N))})});ur.displayName="OrdinalCustomChart",exports.BarChart=Pi,exports.BoxPlot=Ei,exports.DonutChart=Gi,exports.DotPlot=Wi,exports.FunnelChart=Ji,exports.GaugeChart=Ki,exports.GroupedBarChart=Ri,exports.Histogram=Fi,exports.LikertChart=cr,exports.OrdinalCustomChart=ur,exports.PieChart=zi,exports.RidgelinePlot=Ui,exports.StackedBarChart=Li,exports.StreamOrdinalFrame=Po,exports.SwarmPlot=Bi,exports.SwimlaneChart=$i,exports.ViolinPlot=Ni,exports.createHatchPattern=vo,exports.useCustomLayoutSelection=function(){var e;return null!==(e=h.useContext(pe))&&void 0!==e?e:me};
2
+ "use strict";var e,t=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of r(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=o(t,l))||a.enumerable});return e},l=(e,o,r)=>(r=null!=e?t(i(e)):{},a(!o&&e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})})(c,{AnnotationLabel:()=>kn,BarChart:()=>La,BoxPlot:()=>Za,DEFAULT_HIT_RADIUS:()=>Kl,DonutChart:()=>ml,DotPlot:()=>ll,FunnelChart:()=>Rl,GaugeChart:()=>Sl,GroupedBarChart:()=>Oa,Histogram:()=>nl,LikertChart:()=>ql,OrdinalCustomChart:()=>Yl,PieChart:()=>dl,RidgelinePlot:()=>Cl,StackedBarChart:()=>$a,StreamOrdinalFrame:()=>ns,SwarmPlot:()=>Xa,SwimlaneChart:()=>Na,ViolinPlot:()=>il,composeStyleRules:()=>Ca,createHatchPattern:()=>An,estimateLabelWidth:()=>wn,glyphExtent:()=>it,glyphPlacement:()=>rt,hatchFillId:()=>_n,hatchPatternDef:()=>Pn,hitTargetPoint:()=>Zl,hitTargetRect:()=>Jl,isHatchFill:()=>Cn,makeNodeRuleContext:()=>wa,makeRuleValueResolver:()=>va,makeStyleRuleStyleFn:()=>ja,makeXYRuleContext:()=>xa,matchesThreshold:()=>Sa,resolveResponsiveRules:()=>Bs,resolveStyleRules:()=>Ma,resolveSvgFill:()=>Ln,responsiveRuleMatches:()=>$s,ruleMatches:()=>Aa,useCustomLayoutSelection:()=>Qe}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=Object.freeze([]);function h(e){if(!e)return d;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var f=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=h(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=h(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},m=require("d3-scale"),g=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},y=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 n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function p(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function b(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,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 v(e,t,n){return e+(t-e)*n}function x(e,t){return e===t}function w(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function k(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function S(e){return new Set(Array.isArray(e)?e:[e])}var A=require("d3-scale");function M(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function C(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function j(e){const t=e.map(M),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return C(e,n,o)}if(e>=1){const[e,o,r]=t[n];return C(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return C(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var _=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],R=j(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),P=j(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),L=j(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),I=j(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),T=j(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),$=j(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),B={blues:R,reds:P,greens:L,viridis:j(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:I,purples:T,greys:$,plasma:j(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:j(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:j(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:j(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:j(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},H=j(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),O=j(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),F=j(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),E=j(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),D=j(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),W=j(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),N=j(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),z={category10:_,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...B},q=_,G=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],V=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 X(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||V.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):q[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%q.length]}function Y(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function U(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Y(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,A.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=z[n]||z.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:q;return(0,A.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function K(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}var Q=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,n){if(t&&"function"==typeof e.pieceStyle){const o=e.pieceStyle(t,n);return o&&!o.fill&&n?{...o,fill:this.getColorFromScheme(e,n)}:o}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&n?{fill:e.barColors[n]||"#007bff"}:{fill:n?this.getColorFromScheme(e,n):"#007bff"}}resolveSummaryStyle(e,t,n){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,n):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const n=this.colorSchemeMap.get(t);if(n)return n;const o=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||G,r=o[this.colorSchemeIndex%o.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function Z(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}var J=require("d3-shape"),ee={circle:J.symbolCircle,square:J.symbolSquare,triangle:J.symbolTriangle,diamond:J.symbolDiamond,star:J.symbolStar,cross:J.symbolCross,wye:J.symbolWye},te=["circle","triangle","diamond","star","square","chevron","cross","wye"];function ne(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*oe(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,J.symbol)(ee[o]??J.symbolCircle,Math.max(1,t))()??""}function oe(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function re(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let r=0;return e=>{const i=t(e)+"",s=n?.[i];if(s)return s;let a=o.get(i);return a||(a=te[r%te.length],r++,o.set(i,a)),a}}function ie(e,t,n,o,r,i,s){e.push(t?{type:"symbol",x:o,y:r,size:Math.PI*i*i,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:r,r:i,style:s,datum:n})}function se(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI,u=null!=o.sweepAngle&&360>o.sweepAngle,d=Object.values(n),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&&(o.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],n=t.pieceData[0],u="number"==typeof n?._pctStart?n._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof n?._pct?n._pct:t.pct))*c,g=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:m,...o.cornerRadius&&{cornerRadius:o.cornerRadius},style:g,datum:n?._nonInteractive?null:t.pieceData,category:t.name};n?._roundedEnds?b.roundedEnds=n._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),n?._gradientBand&&(b._gradientBand=n._gradientBand),i.push(b)}return i}var ae=require("d3-array");function le(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function ce(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ue(e){const t=e.length,n=e[0],o=e[t-1];return{n:t,min:n,q1:(0,ae.quantile)(e,.25)??n,median:(0,ae.quantile)(e,.5)??(n+o)/2,q3:(0,ae.quantile)(e,.75)??o,max:o,mean:e.reduce((e,t)=>e+t,0)/t}}var de=require("d3-scale"),he={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&n>0&&(m/=n);const g=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:o+m),n=0>m?l(r+m)-l(r):l(o)-l(o+m);u.push(Z(e.x,t,e.width,Math.abs(n),g,y,i)),0>m?r+=m:o+=m}else if(h){const t=l(0>m?r+m:o),n=0>m?l(r)-l(r+m):l(o+m)-l(o);u.push(Z(t,e.x,Math.abs(n),e.width,g,y,i)),0>m?r+=m:o+=m}}}const g="vertical"===c,y=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=g?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const n=t.datum?.category||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),n=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),n.length>0&&(n.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Z(i,Math.min(a,d),o,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Z(Math.min(a,d),i,Math.abs(d-a),o,f,r,h[s]))}}}}const g=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);g>0&&(e.roundedTop=g),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:n,columns:o,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=re(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(o))for(const t of e.pieceData){const n=t.__rIndex??0,o=t.__rValue??r(t),l=h&&i[n]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,n=l(o);b=Math.cos(t)*n,v=Math.sin(t)*n}else u?(b=e.middle,v=l(o)):(b=l(o),v=e.middle);ie(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=re(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),d=i(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;ie(l,u,o,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:se,donut:se,boxplot:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(o)){const n=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===n.length)continue;const o=n[0],r=n[n.length-1],l=(0,ae.quantile)(n,.25)??o,h=(0,ae.quantile)(n,.5)??(o+r)/2,f=(0,ae.quantile)(n,.75)??r,m=f-l,g=l-1.5*m,y=f+1.5*m,p=n.find(e=>e>=g)??o,b=[...n].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const n=i(e);if(g>n||n>y){const o=u?t.middle:a(n),r=u?a(n):t.middle;x.push({px:o,py:r,value:n,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:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:n.length,min:p,q1:l,median:h,q3:f,max:b,mean:n.reduce((e,t)=>e+t,0)/n.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,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-n)/r),d-1)]++;const f=ce(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${a(n)}`;for(let t=0;d>t;t++){const o=a(n+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${o}`}g+=` L ${e.middle} ${a(o)}`;for(let t=d-1;t>=0;t--){const o=a(n+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${a(n)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${a(n+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${a(o)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${a(n+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ae.quantile)(t,.25)??n,i=(0,ae.quantile)(t,.5)??(n+o)/2,s=(0,ae.quantile)(t,.75)??o;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))}:{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ue(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=le(t),r=null!=h&&isFinite(h)?h:n,d=null!=f&&isFinite(f)?f:o,m=(d-r)/c||1,g=Array(c).fill(0);for(const e of t)r>e||e>d||g[Math.min(Math.floor((e-r)/m),c-1)]++;const y=t.length,p=ce(g,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const n=(u?g[t]/y:g[t]/p)*e.width*.9,o=a(r+t*m),i=a(r+(t+1)*m);l.push(Z(Math.min(o,i),e.x+e.width-n,Math.abs(i-o),n,b,{bin:t,count:g[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/u||1,l=Array(u).fill(0);for(const e of t)n>e||e>o||l[Math.min(Math.floor((e-n)/r),u-1)]++;const f=ce(l,1),m=s(e.pieceData[0],e.name),g=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(n)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(n+(e+.5)*r)} ${t-l[e]/f*g}`;y+=` L ${a(o)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(n)}`;for(let e=0;u>e;e++){const o=a(n+(e+.5)*r);y+=` L ${t+l[e]/f*g} ${o}`}y+=` L ${t} ${a(o)} Z`}const p=d?{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width}:{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ue(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(Z(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(Z(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>n[e]).filter(Boolean);if(0===c.length)return s;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 m=0;for(const e of c){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}f.push({col:e,groups:t,stepTotal:n}),h||n>m&&(m=n)}if(h)for(const e of f){let t=0,n=0;for(let o=0;u.length>o;o++){const r=e.groups.get(u[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>m&&(m=o)}if(0===m)return s;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,de.scaleLinear)().domain([0,m]).range([0,p]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const n=f[t],o=n.col,r=0===t,c=o.width,d=.55*c,m=o.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const o=n.groups.get(t);o&&(e+=b(o.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=n.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=g.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),s.push(Z(w,m,v,d,k,A,f)),p.set(f,{x:w,y:m,w:v,h:d})}}else{const e=n.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,g=n.groups.get(h)?.pieces[0]??o.pieceData[0],v=f?h:o.name,x=i(g,v),w=y>0?e/y*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:r,category:f?h:o.name};l&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=m,k.__funnelBarW=t),s.push(Z(c,m,t,d,x,k,v)),p.set(h,{x:c,y:m,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),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=n.groups.get(r);return i(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:n.groups.get(r)?.pieces[0]??o.pieceData[0],category:"_default"===r?o.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>n[e]).filter(Boolean);if(0===l.length)return a;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 n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}h.push({col:e,groups:t,stepTotal:n})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=s.r,g=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],n=t.col,o=0===e,r=e>0?h[e-1]:null,s=n.width/g,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const y=g.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=o?0:Math.max(0,(v?.total??y)-y),w=n.x+e*s+l/2,k=m(y),S=m(0)-k,A=i(g.pieces[0],d?h:n.name),M={...g.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(y+x)};if(a.push(Z(w,k,u,S,A,M,d?h:n.name)),x>0){const e=m(y+x),t=k-e,o={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name};a.push(Z(w,e,u,t,o,r,d?h:n.name))}}}return a},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,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,[n,r]=a.range(),i=Math.min(n,r),s=Math.abs(r-n);for(const n of Object.values(o)){const o={fill:e,opacity:t},r=u?Z(i,n.x,s,n.width,o,null,"__track__"):Z(n.x,i,n.width,s,o,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(o)){let t=0;const n=c.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,f=s(n,l);let m;if(u){const r=a(t),i=a(t+o);m=Z(r,e.x,i-r,e.width,f,n,l)}else{const r=a(t+o),i=a(t);m=Z(e.x,r,e.width,i-r,f,n,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=o}if(m>0&&c.length>n){const e=c.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return c}};function fe(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Y(n,e)||"#4e79a7":t=>{if(n){const e=Y(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function me(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(me))}function ge(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function ye(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var pe=new WeakMap;var be={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 ve(e,t){const n={...e};for(const e of t)n[be[e]]++;return n}function xe(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:ve(n,o)}}var we=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=xe({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 n=xe(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},ke=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Se=["scene-style","data-paint","accessibility","evidence"],Ae=(e,t)=>({retainedData:e,invalidations:t}),Me=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ce=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],je=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_e=["scene-geometry","data-paint","accessibility","evidence"],Re=["scene-style","data-paint","accessibility","evidence"],Pe=[],Le={chartType:Ae("rebuild",Me),runtimeMode:Ae("rebuild",Me),categoryAccessor:Ae("rebuild",Me),valueAccessor:Ae("rebuild",Me),oAccessor:Ae("rebuild",Me),rAccessor:Ae("rebuild",Me),stackBy:Ae("rebuild",Me),groupBy:Ae("rebuild",Me),timeAccessor:Ae("rebuild",Me),accessorRevision:Ae("rebuild",Me),colorAccessor:Ae("rebuild",Re),symbolAccessor:Ae("rebuild",_e),connectorAccessor:Ae("rebuild",_e),dataIdAccessor:Ae("rebuild",_e),projection:Ae("preserve",Ce),extentPadding:Ae("preserve",Ce),axisExtent:Ae("preserve",Ce),rExtent:Ae("preserve",Ce),oExtent:Ae("preserve",Ce),multiAxis:Ae("preserve",Ce),normalize:Ae("preserve",Ce),bins:Ae("preserve",Ce),oSort:Ae("preserve",je),barPadding:Ae("preserve",je),roundedTop:Ae("preserve",je),baselinePadding:Ae("preserve",je),innerRadius:Ae("preserve",je),cornerRadius:Ae("preserve",je),startAngle:Ae("preserve",je),sweepAngle:Ae("preserve",je),trackFill:Ae("preserve",je),showOutliers:Ae("preserve",je),showIQR:Ae("preserve",je),amplitude:Ae("preserve",je),connectorOpacity:Ae("preserve",je),showLabels:Ae("preserve",je),dynamicColumnWidth:Ae("rebuild",je),customLayout:Ae("preserve",je),layoutConfig:Ae("preserve",je),layoutMargin:Ae("preserve",je),symbolMap:Ae("preserve",_e),pieceStyle:Ae("preserve",Re),summaryStyle:Ae("preserve",Re),connectorStyle:Ae("preserve",Re),gradientFill:Ae("preserve",Re),colorScheme:Ae("preserve",Re),themeCategorical:Ae("preserve",Re),themeSemantic:Ae("preserve",Re),themeSequential:Ae("preserve",Re),themeDiverging:Ae("preserve",Re),barColors:Ae("preserve",Re),decay:Ae("preserve",Re),pulse:Ae("preserve",Re),staleness:Ae("preserve",Re),layoutSelection:Ae("preserve",Re),windowSize:Ae("preserve",Pe),windowMode:Ae("preserve",Pe),clock:Ae("preserve",Pe),transition:Ae("preserve",Pe),introAnimation:Ae("preserve",Pe),onLayoutError:Ae("preserve",Pe)},Ie=Ae("preserve",je),Te=class{constructor(){this.tracker=new we}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}},ke)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Se):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Le[o]??Ie;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};var $e=require("d3-quadtree"),Be=class{constructor(e){this.rExtent=new y,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Te,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new Q,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 g(e.windowSize),this.getO=k(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new y)):(this.getR=w(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=k(e.stackBy),this.getGroup=k(e.groupBy),this.getColor=k(e.colorAccessor),this.getSymbol=k(e.symbolAccessor),this.getConnector=k(e.connectorAccessor),this.getDataId=k(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new g(e.windowSize))}syncPulseTimestampBuffer(){var e,t,n,o;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,n=this.timestampBuffer,o=this.currentTime(),e?null!=n&&n.capacity===t.capacity&&n.size===t.size?n:function(e,t){const n=new g(e.capacity);return e.forEach(()=>n.push(t)),n}(t,o):null)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}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(),r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)ye(this.buffer,n,this.timestampBuffer,t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=ye(this.buffer,n,this.timestampBuffer,t);this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}var n,o,r;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 n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.multiScales,i=this.columns;if(0===n.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(n,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,g;if(d){f=(0,m.scaleBand)().domain(l).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;g=(0,m.scaleLinear)().domain(c).range([o,n])}else u?(f=(0,m.scaleBand)().domain(l).range([0,e.height]).padding(h),g=(0,m.scaleLinear)().domain(c).range([0,e.width])):(f=(0,m.scaleBand)().domain(l).range([0,e.width]).padding(h),g=(0,m.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:g,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,m.scaleLinear)().domain([s,a]).range([0,e.width]):(0,m.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let y=s;this.rAccessors.length>1&&(y=s.flatMap(e=>this.rAccessors.map((t,n)=>({...e,__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(y,l,f,a,e),this._customLayoutFailedThisBuild=!1;const p=this.buildSceneNodes(y,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=p,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let r=null;if(n){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(n&&void 0===o){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===o)return i;if("function"==typeof o)return i.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:n,projection:o,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===o&&("pie"===n||"donut"===n))return[0,1];let m=0,g=0;if("bar"===n&&d&&r)m=0,g=1;else if("bar"===n&&d){const e=new Map,n=new Map;for(const o of t){const t=c(o),r=u(o);0>r?n.set(t,(n.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t);for(const e of n.values())m>e&&(m=e)}else if("bar"===n){const e=new Map;for(const n of t){const t=c(n),o=u(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===n){const e=new Map;for(const n of t){const t=c(n),o=Math.abs(u(n));e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===n||"bar-funnel"===n)for(const e of t){const t=u(e);t>g&&(g=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(g=i[1]));const y="bar"===n||"clusterbar"===n||"bar-funnel"===n||"swimlane"===n;if(y&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==n&&"exact"!==l){const e=g-m,t=e>0?e*f:1,o=y&&!a&&0===m,r=y&&!a&&0===g||"swimlane"===n;null!=i?.[0]||o||(m-=t),null!=i?.[1]||r||(g+=t)}return[m,g]}({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,n,o,r){return function(e){const{data:t,oExtent:n,oScale:o,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(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(s&&"radial"!==r){h=new Map;let e=0;for(const t of n){const n=u.get(t)||[];let o;o="string"==typeof s?n.reduce((e,t)=>e+(Number(t[s])||0),0):s(n),h.set(t,o),e+=o}const t=("horizontal"===r?i.height:i.width)-o.padding()*o.step()*n.length;if(e>0)for(const[n,o]of h)h.set(n,o/e*t)}let f=0,m=0;for(const e of n){const t=u.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?n/d:0;let i,s;h?(i=m,s=h.get(e)||o.bandwidth(),m+=s+o.padding()*o.step()):(i=o(e)??0,s=o.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:o.padding()*o.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:n,projection:o,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 n=this.buildLayoutContext(e,t);let o;try{o=this.config.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,n=function(e,t,n,o){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:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.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=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const r=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.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 function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;me(o)&&0===n.length&&ge(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.`),n.length>0&&n.every(e=>null==e.datum)&&ge(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.`)}({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 n=this.getSceneContext(),o=he[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,n]of l)if(n.length>=2){n.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let o=0;n.length-1>o;o++){const r=n[o],i=n[o+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(n,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const n=this.config,o=n.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n){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=z[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(n.colorScheme,n.themeCategorical,G),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:o,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:n.themeSemantic??{},categorical:[...r]},resolveColor:fe(r,n.colorScheme),config:n.layoutConfig??{},selection:n.layoutSelection??null}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){if(1>=n)return 1;const o=n-1;return function(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 n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}(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 n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o],l=r.get(a);l?l.push(i):r.set(a,[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,n=0;for(const o of e)"point"===o.type&&(t++,o.r>n&&(n=o.r));if(500>=t)return{quadtree:null,maxRadius:n};const o=Array(t);let r=0;for(const t of e)"point"===t.type&&(o[r++]=t);return{maxRadius:n,quadtree:(0,$e.quadtree)().x(e=>e.x).y(e=>e.y).addAll(o)}}(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 n=t.length;if(1>=n)return;const o=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=o.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,n);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,n=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=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 o=0;for(const s of r(t)??[]){const t=n.get(s);null!=t&&(o=Math.max(o,p(e,t,i)))}l=b(c,o,s)||l;continue}if(null==c.datum)continue;const t=o.get(c.datum);if(null==t)continue;const u=n.get(t);l=b(c,null==u?0:p(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),n)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(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,n="horizontal"!==this.scales?.projection;let o;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,n?{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(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===o&&(o=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:o,endAngle:o,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${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 n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(o,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:n.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 n=new Set,o=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,o);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.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)s?(n.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.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(s)n.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.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,o]of this.prevPositionMap)if(!n.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:o.x,y:o.y,r:o.r??3,style:{opacity:o.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:o.x,y:o.y,w:o.w??0,h:o.h??0,style:{opacity:o.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((o.startAngle??0)+(o.endAngle??0))/2,n={type:"wedge",cx:o.x,cy:o.y,innerRadius:o.innerRadius??0,outerRadius:o.outerRadius??100,startAngle:o.startAngle??0,endAngle:o.endAngle??0,style:{opacity:o.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}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=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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 o=this.prevPositionMap.get(t);e.style.opacity=v(o?o.opacity??1:0,e._targetOpacity,n)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=v(o.x,e._targetX,n),e.y=v(o.y,e._targetY,n)),void 0!==e._targetR&&void 0!==o?.r&&(e.r=v(o.r,e._targetR,n))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=v(o?o.opacity??1:0,e._targetOpacity,n)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=v(o.x,e._targetX,n),e.y=v(o.y,e._targetY,n),void 0!==o.w&&(e.w=v(o.w,e._targetW,n),e.h=v(o.h,e._targetH,n))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style={...e.style,opacity:v(o?o.opacity??1:0,e._targetOpacity,n)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=v(o.startAngle,e._targetStartAngle,n),e.endAngle=v(o.endAngle,e._targetEndAngle,n))}}}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=S(e),n=this.getDataId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);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 n=S(e),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(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 n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.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},n=Object.keys(e).filter(n=>e[n]!==t[n]);"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&&!x(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!x(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!x(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let o=!1;("categoryAccessor"in e||"oAccessor"in e)&&(x(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=k(this.config.categoryAccessor||this.config.oAccessor,"category"),o=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,n=t.valueAccessor||t.rAccessor,o=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];if(r=o.length!==i.length||o.some((e,t)=>!x(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new y)):(this.getR=w(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!x(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?k(this.config.stackBy):void 0),"groupBy"in e&&!x(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?k(this.config.groupBy):void 0),"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?k(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!x(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?k(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!x(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?k(this.config.connectorAccessor):void 0),(o||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Object.assign(Be.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){pe.set(this,!0)},consumeStylePaintPending:function(){const e=!0===pe.get(this);return pe.delete(this),e}});var He=require("react"),Oe={sceneGeometry:0,layout:0,domain:0};function Fe(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Ee(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 De="production"!==process.env.NODE_ENV,We={revisions:Oe,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Ne=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Oe,this.lastObserved=Oe,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){De&&(this.lastObserved=Ee(this.lastObserved,Fe(e)))}beforeCompute(e,t){if(!De)return We;const n=Ee(Fe(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(De){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&&!n&&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="")}}},ze=(0,He.memo)(function({store:e,diagnostics:t}){return(0,He.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),qe=l(require("react"));function Ge(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:qe.createElement(qe.Fragment,null,...t)}var Ve=l(require("react")),Xe=require("react/jsx-runtime"),Ye={isActive:!1,predicate:()=>!0},Ue=Ve.createContext(null);function Ke({value:e,children:t}){return(0,Xe.jsx)(Ue.Provider,{value:e,children:t})}function Qe(){return Ve.useContext(Ue)??Ye}function Ze(e,t){return null!=e?(0,Xe.jsx)(Ke,{value:t,children:e}):e}var Je=require("react");function et(e,t=30){return Math.max((e??4)+5,12,t)}function tt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var nt=[40,40],ot=[.5,.5];function rt(e,t){const[n,o]=e.viewBox??nt,[r,i]=e.anchor??ot,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function it(e,t){const n=rt(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function st(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var at=null;function lt(e){if("undefined"==typeof Path2D)return null;at||(at=new Map);const t=at.get(e);if(t)return t;const n=new Path2D(e);return at.size>1024&&at.clear(),at.set(e,n),n}function ct(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??nt,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function ut(e,t){const n=rt(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function dt(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=lt(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:st(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:st(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function ht(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,m=1/0;return e.visit((e,r,l,g,y)=>{if(r>u||c>g||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);et(a(e),o)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,n,o,i);e&&(s={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=ft(i,t,n);break;case"point":if(r)break;e=mt(i,t,n,o);break;case"symbol":e=gt(i,t,n,o);break;case"glyph":e=yt(i,t,n,o);break;case"wedge":if(null===i.datum)break;e=pt(i,t,n);break;case"boxplot":e=bt(i,t,n);break;case"violin":e=vt(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ft(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function mt(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>et(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function gt(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>et(oe(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function yt(e,t,n,o=30){if(null==e.datum)return null;const r=ut(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>et(r.radius,o)?null:{datum:e.datum,x:i,y:s,distance:c}}function pt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=tt(Math.atan2(r,o)),a=tt(e.startAngle),l=tt(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))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 bt(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function vt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}var xt=require("react"),wt={fresh:1,aging:.7,stale:.45,expired:.25},kt={alpha:1,band:"fresh",isStale:!1};var St=require("react/jsx-runtime");function At({isStale:e,position:t}){return(0,St.jsx)("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"})}var Mt=require("react"),Ct=l(require("react")),jt=require("react/jsx-runtime"),_t={fill:(e,t)=>(0,jt.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,jt.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Rt(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,_t[n])(o(e,t),r),i}function Pt({swatchSize:e}){return(0,jt.jsx)("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 Lt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var It=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const y=!(!t&&!n),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Rt(e,c,d,h,b),w=Lt(e,o,r),k=r&&r.size>0&&r.has(e.label);m.push((0,jt.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,jt.jsx)("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,k&&(0,jt.jsx)(Pt,{swatchSize:b}),(0,jt.jsx)("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)),g+=x}),m};function Tt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ct.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,jt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,jt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,jt.jsx)("defs",{children:(0,jt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,jt.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,jt.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,jt.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,jt.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,jt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,jt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,jt.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,jt.jsx)("defs",{children:(0,jt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,jt.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,jt.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,jt.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function $t(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=Ct.useState(0),[g,y]=Ct.useState(0),p=Ct.useCallback((e,t)=>{m(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,jt.jsx)("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((0,jt.jsx)("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((0,jt.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:It(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),m.length>0&&A.push({start:M,end:m.length,width:C}),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=m[d],x=Rt(e,d,h,f,y),A=Lt(e,o,r),M=r&&r.size>0&&r.has(e.label);g.push((0,jt.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+m.length)%m.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,jt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,jt.jsx)(Pt,{swatchSize:y}),(0,jt.jsx)("text",{y:y/2,x:y+p,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 j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:g,offset:j,totalRows:_,totalHeight:_*v}})(e,o,r,i,s,a,l,t,c,u,d,d.maxWidth??n);m+=g.offset+5,f.push({label:e.label,...g,offset:m,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=m+12});const m=d.maxWidth??n;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push((0,jt.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),g+=16),y.push((0,jt.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:n.items},"legend-group-"+o)),g+=n.offset+5,e[o+1]&&y.push((0,jt.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),g+=12}),(0,jt.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!n&&!o);return(0,jt.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,jt.jsx)("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:a}),b]})}function Bt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Ht=require("react/jsx-runtime");function Ot(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!a,g=Math.max(0,n-r.left-r.right),y=Math.max(1,f?s?.maxWidth??g:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=m?32:8):"bottom"===i?(p=r.left,b=o-r.bottom+38):(p=n-r.right+10,b=r.top),(0,Ht.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Ht.jsx)(Tt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Bt(t)?(0,Ht.jsx)($t,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Ft=l(require("react")),Et=require("react/jsx-runtime");function Dt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Wt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Nt(e,t,n,o){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Dt(i,l):[],g=r?c?[r]:Dt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("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&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Et.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=m.length*f),g.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:g.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function zt(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,Et.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"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=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,Et.jsx)("path",{d:Wt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function qt(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,m=o+d*f,g=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function Gt(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:y={},"data-testid":p}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...y,children:[!x.has("connector")&&qt(w,k,l,d,S,c),!x.has("subject")&&zt(S,c,d,b,v),!x.has("note")&&Nt(a,w,k,d)]})}function Vt(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,Et.jsx)(Gt,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)(Gt,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var Xt=require("d3-hierarchy"),Yt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Kt(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function Qt(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Zt(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Jt(e){return null==e?null:e+""}function en(e,t,n){return t.stickyPositionCache?.set(e,n),n}function tn(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return en(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?en(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Jt(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Jt(e.pointId)===o);if(r)return en(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Jt(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=Qt(i,n),a=Zt(i,n);return null==s||null==a?null:en(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Qt(e,n),i=Zt(e,n)),null!=r&&null!=i)return en(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function nn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var on=require("react/jsx-runtime"),rn={secondary:0,primary:3};function sn(e){return!0===e?._annotationDeferred}function an(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function ln(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function cn(e){return Math.max(.72,.95-.06*e)}var un=l(require("react")),dn=require("react"),hn=require("react/jsx-runtime");function fn(e){let t=null;const n=()=>(t||(t=(0,dn.createContext)(null)),t),o=mn(e);return[function({children:t,initialState:o}){const r=(0,dn.useRef)(o),i=(0,dn.useMemo)(()=>mn(e,r.current),[]),s=n();return(0,hn.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,dn.useContext)(r)??o,s=(0,dn.useRef)(e);s.current=e;const a=(0,dn.useRef)({hasValue:!1,value:void 0}),l=(0,dn.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,dn.useCallback)(()=>s.current(i.getState()),[i]);return(0,dn.useSyncExternalStore)(i.subscribe,l,c)}]}function mn(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}var[gn,yn]=fn(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function pn(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var bn=require("react/jsx-runtime"),vn="var(--semiotic-bg, #ffffff)",xn=.85;function wn(e,t){return(e+"").length*t*.6}function kn(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,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=>(0,bn.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??vn,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},g="number"==typeof m?m:m.x,y="number"==typeof m?m:m.y,p=wn(o,i),b=i+2*y;let v,x;return v="middle"===l?t-p/2-g:"end"===l?t-p-g:t-g,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,bn.jsxs)("g",{className:d,children:[(0,bn.jsx)("rect",{x:v,y:x,width:p+2*g,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??vn,fillOpacity:h.opacity??xn,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var Sn=null;function An(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Sn||(Sn=document.createElement("canvas")),Sn.width=e,Sn.height=e,Sn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;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")}var Mn=require("react/jsx-runtime");function Cn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function jn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function _n(e,t){let n=2166136261;const o=jn(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Rn=new Map;function Pn(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,Mn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,Mn.jsx)("rect",{width:l,height:l,fill:n}),(0,Mn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,Mn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function Ln(e,t,n="#4e79a7"){if(Cn(e)){const n=_n(t,e);return{fill:`url(#${n})`,def:Pn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var In=require("react/jsx-runtime"),Tn={linear:Yt.curveLinear,monotoneX:Yt.curveMonotoneX,monotoneY:Yt.curveMonotoneY,step:Yt.curveStep,stepAfter:Yt.curveStepAfter,stepBefore:Yt.curveStepBefore,basis:Yt.curveBasis,cardinal:Yt.curveCardinal,catmullRom:Yt.curveCatmullRom};var $n=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Bn(e){return!!e&&"object"==typeof e&&$n.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Hn(e){return"primary"===e?.emphasis||!0===e?.defensive}function On(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Fn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),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 En=32,Dn=6,Wn=4,Nn=8,zn=72;var qn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Gn(e){if(!Vn(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 Vn(e){return Bn(e)}function Xn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Yn(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function Un(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Kn(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 Qn(e,t,n,o,r,i,s,a){const l=Un(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*Kn(l,e);for(const e of o)c+=4*Kn(l,e);return c}function Zn(e){const{annotations:t,context:n,defaultOffset:o=En,notePadding:r=Dn,markPadding:i=Wn,edgePadding:s=Nn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=zn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:y}=e,p=n.width||0,b=n.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=p,k=w&&!1!==v.preferShortText?t.map(Gn):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!g?v.cohesion:g;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=k.map((e,t)=>{if(!Vn(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.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 n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?tn(e,t,n):{x:e.x,y:e.y}}(e,t,n);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,n=[...Xn("string"==typeof e.title?e.title:void 0,t),...Xn("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("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 j.push(Un(Yn(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}]}(o)){const t=Qn(Yn(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const m=Un(Yn(i.x,i.y,h.dx,h.dy,u),r);j.push(m);const g=Math.hypot(h.dx,h.dy),y=l&&g>=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,...y?{connector:y}:{}}}),L=R?P:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?qn[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=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 n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??On(p,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=On(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Bn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Hn(e.annotation)),c=a.filter(e=>!Hn(e.annotation)).sort((e,t)=>Fn(t.annotation)-Fn(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:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)Vn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>Vn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}($,C):$}function Jn(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var eo=require("react/jsx-runtime");function to(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,m=(0,Mt.useMemo)(()=>!s||h?[]:(u||Jn(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||no)(e)})),[s,c,h,u,d]),g=l&&s&&!h,y=a&&s&&!h;return g||y?(0,eo.jsx)("svg",{width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,eo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,eo.jsx)("g",{className:"ordinal-grid",children:m.map((e,o)=>(0,eo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&(0,eo.jsx)(eo.Fragment,{children:(0,eo.jsxs)(eo.Fragment,f?{children:[(0,eo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,eo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,eo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,eo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function no(e){return Math.round(100*e)/100+""}function oo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j,autoPlaceAnnotations:_,svgAnnotationRules:R,xAccessor:P,yAccessor:L,annotationData:I,underlayRendered:T,canvasObscuresUnderlay:$=!0,children:B}=e,H=function(e){const t=yn(e=>e.pushObservation),n=un.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return un.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j}),O="radial"===s?.projection,F="horizontal"===s?.projection,E=!1!==l,D=!T||$,W=(0,Mt.useMemo)(()=>{if(!a||!E||!s||O)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,n)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,n):t}));if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e,o=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(o.every((e,t)=>0===t||n>=(o[t-1]+e)/2+r))return t;const i=Math.max(...o)+r,l=Math.max(1,Math.ceil(i/n));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,E,s,d,O,F]),N=e.rTickValues,z=e.tickLabelEdgeAlign,q=e.axisExtent,G=(0,Mt.useMemo)(()=>a&&s&&!O?(N||Jn(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||no)(e)})):[],[a,s,h,O,N,q]),V=(0,Mt.useRef)(new Map),X=(0,Mt.useRef)(S?.length??0),Y=S?.length??0;X.current!==Y&&(X.current=Y,V.current=new Map);const U=(0,Mt.useMemo)(()=>{if(!S||0===S.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=tn(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!nn(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,In.jsx)(Vt,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Qt(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,In.jsxs)("g",{opacity:e.opacity,children:[(0,In.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,In.jsx)(kn,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Zt(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,In.jsxs)("g",{opacity:e.opacity,children:[(0,In.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,In.jsx)(kn,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Qt({...e,type:"point"},o),y:Zt({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Xt.packEnclose)(t),i=e.padding||10;return(0,In.jsxs)("g",{children:[(0,In.jsx)("circle",{cx:r.x,cy:r.y,r:r.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&&(0,In.jsx)(kn,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Qt({...e,type:"point"},o),y:Zt({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=le(i),[c,u]=le(s),d=a-r,h=l+r,f=c-r;return(0,In.jsxs)("g",{children:[(0,In.jsx)("rect",{x:d,y:f,width:h-d,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,In.jsx)(kn,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="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(0,In.jsx)("g",{children:r.map((t,n)=>{const r=Qt(t,o),s=Zt(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,In.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Qt(e,o),r=Zt(e,o);return(0,In.jsx)(Vt,{noteData:{x:t??0,y:r??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-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=h.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(d.length-1,n+1),r=t-n,i=e(d[n]);return i+(e(d[o])-i)*r},y=f,p=m;let b;if(s)if(a){const e=g(p);b=(t,n)=>[y(n),e(t)]}else{const e=g(y);b=(t,n)=>[e(t),p(n)]}else b=(e,t)=>[y(e),p(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*m-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Kt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:Ut((n*t[3]-t[0]*t[1])/o),i=Ut(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(r*e+i)]),equation:[r,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return(0,In.jsxs)("g",{children:[(0,In.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,In.jsx)("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(o.height||0),l=Ln(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,In.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,In.jsx)("defs",{children:l.def}),(0,In.jsx)("rect",{x:0,y:Math.min(s,a),width:o.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,In.jsx)(kn,{x:(o.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=Ln(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,In.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,In.jsx)("defs",{children:s.def}),(0,In.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,In.jsx)(kn,{x:Math.min(r,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-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=Tn[o.curve||"linear"]||Yt.curveLinear,h=(0,Yt.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,In.jsxs)("g",{children:[(0,In.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,In.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,In.jsxs)("g",{children:[f&&(0,In.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:m,fillOpacity:g}),x.map((e,t)=>{const n=Qt(e,o),r=Zt(e,o);return null==n||null==r?null:(0,In.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,In.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],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=Kt(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*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)),m=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-m)**2,0),y=e.confidence??.95,p=.99>y?.95>y?.9>y?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),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?(e-m)**2/g:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,In.jsxs)("g",{children:[(0,In.jsx)("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,In.jsx)("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,In.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=tn(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!nn(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,In.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,In.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,In.jsx)("div",{...pn(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=tn(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,In.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Ft.cloneElement(c,{key:"ann-text-"+n}):(0,In.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,In.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Ft.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a: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(0,In.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,In.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,In.jsx)(kn,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,In.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,In.jsx)(kn,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,H),o="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:o?s.r:r||s.r,y:o&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:t,height:n,data:I,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:V.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:ln(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>sn(e.annotation)),r=e.some(e=>null!=an(e.annotation)),i=e.some(e=>"layer"===an(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=rn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=sn(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,on.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:cn(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=an(t.annotation);return a&&(s=(0,on.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,on.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,on.jsx)("style",{children:".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}}"},"annotation-disclosure-style")),i&&a.unshift((0,on.jsx)("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")),a}(r)}(_?Zn({annotations:S,context:i,..."object"==typeof _?_:{}}):S,e,R,i)},[S,_,R,t,n,s,P,L,I,H]);return a||m||g||k||U&&U.length>0||f||B?(0,eo.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,eo.jsx)("title",{children:"string"==typeof m?m:"Ordinal Chart"}),(0,eo.jsx)("desc",{children:"string"==typeof m?m+" — ordinal data visualization":"Ordinal data visualization"}),(0,eo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!O&&D&&(0,eo.jsx)("g",{className:"ordinal-grid",children:G.map((e,o)=>(0,eo.jsx)("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),a&&s&&!O&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,eo.jsx)("g",{className:"ordinal-axes",children:(0,eo.jsxs)(eo.Fragment,F?{children:[(0,eo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[D&&(0,eo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((t,n)=>(0,eo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,eo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,eo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,eo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,eo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,eo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,eo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[D&&(0,eo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,eo.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((t,o)=>{const r=z?0===o?"start":o===G.length-1?"end":"middle":"middle";return(0,eo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,eo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,eo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)}),u&&(0,eo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]}:{children:[(0,eo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[D&&(()=>{const e=s?.r?s.r(0):n,o=0>e||e>n?n:e;return(0,eo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((t,o)=>(0,eo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,eo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,eo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,eo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,eo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,eo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,eo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[D&&(0,eo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((t,n)=>(0,eo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,eo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,eo.jsx)("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-"+n)),u&&(0,eo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]})})})(),U,k,B]}),m&&"string"==typeof m?(0,eo.jsx)("text",{x:o/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:m}):m?(0,eo.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Ot({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function ro(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var io=require("react"),so=require("d3-selection"),ao=require("d3-brush"),lo=l(require("react")),co=require("react/jsx-runtime");function uo({width:e,height:t,totalWidth:n,totalHeight:o,margin:r,scales:i,onBrush:s}){const a=(0,io.useRef)(null),l=(0,io.useRef)(null),c=(0,io.useRef)(s);c.current=s;const u=(0,io.useRef)(i);u.current=i;const d=(0,io.useRef)(!1),h=(0,io.useRef)(null),f="horizontal"===i?.projection,m=(0,io.useRef)(f);m.current=f;const g=function({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:n}={}){const o=lo.useId().replace(/:/g,""),r=lo.useRef(n);return r.current=n,{description:t,descriptionId:"semiotic-brush-description-"+o,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+o,onKeyDown:lo.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))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=u.current,n=l.current;if(!t||!n||!a.current)return;const o=(0,so.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,o.call(n.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!m.current)return;const r=t.r.domain(),[i,s]=[Math.min(...r),Math.max(...r)],f=(s-i)/20,g=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],y="left"===e.direction||"down"===e.direction?-1:1;let[p,b]=g;if(e.resize)0>y?p=Math.max(i,p-f):b=Math.min(s,b+f);else{const e=b-p;p=Math.max(i,Math.min(s-e,p+y*f)),b=p+e}const v={r:[p,b]};d.current=!0,o.call(n.move,m.current?[t.r(p),t.r(b)]:[t.r(b),t.r(p)]),d.current=!1,h.current=v,c.current(v)}});return(0,io.useEffect)(()=>{if(!a.current)return;const n=(0,so.select)(a.current).select(".brush-g"),o=f?(0,ao.brushX)():(0,ao.brushY)();return o.extent([[0,0],[e,t]]),o.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[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};h.current=i,c.current(i)}),n.call(o),l.current=o,n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),l.current=null}},[e,t,f]),(0,io.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,so.select)(a.current).select(".brush-g"),n=i.r(e.r[0]),o=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1):(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1)},[i,f]),(0,co.jsxs)("svg",{ref:a,width:n,height:o,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,co.jsx)("title",{children:g.svgProps["aria-label"]}),(0,co.jsx)("desc",{id:g.descriptionId,children:g.description}),(0,co.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}var ho=l(require("react")),fo=require("d3-shape");function mo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function go(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}var yo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function po(e){const{innerRadius:t,outerRadius:n,startAngle:o,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=yo(n,o),t=yo(n,r);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${r-o>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=yo(n,o),s=yo(n,r),a=yo(t,r),l=yo(t,o),c=r-o>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===s)return po({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-o,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return po({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=o+(d?a:0),m=r-(h?a:0),g=o+(d?l:0),y=r-(h?l:0),p=yo(n,f),b=yo(n,m),v=(n-s)*Math.cos(a),x=yo(v,o),w=yo(v,r),k=i?null:yo(t,y),S=i?null:yo(t,g),A=i?0:(t+s)*Math.cos(l),M=i?null:yo(A,o),C=i?null:yo(A,r),j=m-f>Math.PI?1:0,_=i?0:y-g>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=yo(n,o);R+=`M${e.x},${e.y}`}if(h)R+=` A${n},${n} 0 ${j} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=yo(n,r);R+=` A${n},${n} 0 ${j} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${C.x},${C.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=yo(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=yo(t,o);R+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return R+=" Z",R}function bo(e){const t=po({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let r=0;o.length>r;r++)n.push({d:po({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:o[r]})}return{clipPath:t,slices:n}}var vo=require("react/jsx-runtime"),xo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function wo(e,t="#4e79a7"){return Cn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function ko(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var So="undefined"==typeof window||"undefined"==typeof document,Ao=require("react"),Mo="undefined"!=typeof window?Ao.useLayoutEffect:Ao.useEffect,Co=()=>()=>{},jo=()=>!1,_o=()=>!0,Ro=require("react");function Po(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Lo(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Io(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}var To=l(require("react")),$o=l(require("react")),Bo=(require("react/jsx-runtime"),$o.createContext(null)),Ho=require("react/jsx-runtime"),Oo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Fo({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Ho.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Oo,children:t})}function Eo(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function Do(e){return e&&"object"==typeof e?e:{}}function Wo(e){return Do(e.accessibility).tableFields??e.accessibleDatum??e.datum}var No=require("react/jsx-runtime");function zo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],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"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var qo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Go="semiotic-accessible-data-table",Vo=Go+" semiotic-accessible-data-table-hidden",Xo=Go+" semiotic-accessible-data-table-visible",Yo={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"},Uo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ko={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)"},Qo={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Zo={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))"},Jo={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},er={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},tr={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 nr({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=To.useState(!1),[s,a]=To.useState(5),l=$o.useContext(Bo),c=l?.visible??!1,u=r||c,d=To.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;To.useEffect(()=>{u||a(5)},[u]);const f=To.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=To.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,No.jsx)("span",{id:n,tabIndex:-1,style:Oo}):null;if(!u)return(0,No.jsx)("div",{id:n,className:Vo,tabIndex:-1,onFocus:f,style:Oo,role:"region","aria-label":h,children:(0,No.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:Eo(Wo(o))});break;case"line":case"area":{const e=Wo(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Eo(e)});break}case"rect":{const e=Wo(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Eo(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Eo(Wo(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Wo(o),n=Eo(e);if(null==n.category){const t=Do(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Eo(Wo(o))});break;case"arc":t.push({label:"Arc",values:Eo(Wo(o))});break;case"candlestick":t.push({label:"Candlestick",values:Eo(Wo(o))});break;case"geoarea":{const e=Do(Wo(o)),n=Eo(e);if(null==n.name){const t=Do(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(g),p=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${qo(e.min)} to ${qo(e.max)}, mean ${qo(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(g.length,y),b=Math.min(s,g.length),v=g.slice(0,b),x=g.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,No.jsxs)("div",{ref:d,id:n,className:Xo,tabIndex:-1,onBlur:m,style:Yo,role:"region","aria-label":h,children:[(0,No.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Ko,children:"×"}),(0,No.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Uo,children:p}),(0,No.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Qo,children:[(0,No.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:er,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,No.jsx)("thead",{children:(0,No.jsxs)("tr",{children:[(0,No.jsx)("th",{style:Zo,children:"type"}),k.map(e=>(0,No.jsx)("th",{style:Zo,children:e},e))]})}),(0,No.jsx)("tbody",{children:v.map((e,t)=>(0,No.jsxs)("tr",{children:[(0,No.jsx)("td",{style:Jo,children:e.label}),k.map(t=>{return(0,No.jsx)("td",{style:Jo,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":qo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,No.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:tr,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function or({summary:e}){return e?(0,No.jsx)("div",{role:"note",style:Oo,children:e}):null}function rr({tableId:e}){return(0,No.jsx)("a",{href:"#"+e,style:Oo,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Oo)},children:"Skip to data table"})}var ir=require("react/jsx-runtime"),sr="var(--semiotic-focus, #005fcc)";function ar({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,ir.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:sr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,ir.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:sr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:sr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,ir.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,ir.jsx)("path",{d:a,fill:"none",stroke:sr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,ir.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var lr=l(require("react"));function cr(e){return Array.isArray(e)?e[0]:e}function ur(e,t,n,o){return{data:cr(e),x:t,y:n,__semioticHoverData:!0,...o}}var dr=["name","label","title"],hr=["type","kind","category","group","class","status","role","shape"],fr=["value","amount","total","count","weight","score"],mr=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 gr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var yr=require("react/jsx-runtime"),pr={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 br(e,t){return"function"==typeof t?t(e):e[t]}function vr(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 xr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=br(e,n);s=vr(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=br(e,r);a.push({label:n,value:vr(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=vr(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=vr(e[t[0]],o))}}const l={...pr,...r};return(0,yr.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,yr.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,yr.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,yr.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function wr(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=cr(!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(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,yr.jsx)("div",{className:"semiotic-tooltip",style:pr,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?xr(e):xr())}}var kr=require("react/jsx-runtime");function Sr({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=lr.useRef(null),[u,d]=lr.useState(null);lr.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 n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!lr.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),m=f?null:pr;return l?(0,kr.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Ar=l(require("react")),Mr=require("react");function Cr(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 jr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:_r}}),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 _r=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Rr={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}},Pr={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}},Lr={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:_r,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 Ir(e,t){if("light"===t)return Rr;if("dark"===t)return Pr;if("high-contrast"===t)return Lr;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?Pr:Rr;return jr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return jr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Tr,$r]=fn(e=>({theme:Rr,setTheme(t){e(e=>({theme:Ir(e.theme,t)}))}})),Br=require("react");var Hr=require("react"),Or=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Fr=new WeakMap,Er=0,Dr=!1,Wr=null,Nr=null;function zr(e,t){if(!t)return t;const n=Or.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(Dr)return;if("undefined"==typeof window||"undefined"==typeof document)return;Dr=!0;const e=()=>{Er++};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{Wr=window.matchMedia("(prefers-color-scheme: dark)"),Nr=e,"function"==typeof Wr.addEventListener?Wr.addEventListener("change",Nr):"function"==typeof Wr.addListener&&Wr.addListener(Nr)}catch{}}();let r=Fr.get(o);r&&r.version===Er||(r={version:Er,map:new Map},Fr.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var qr=()=>"undefined"!=typeof performance?performance.now():Date.now();function Gr(e,t){const n=e();return Number.isFinite(n)?n:t}var Vr=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??qr,this.lastWallTime=Gr(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=Gr(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??qr;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Gr(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(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}}(n)))}},Xr="undefined"==typeof window?Mr.useEffect:Mr.useLayoutEffect,Yr={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ur(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Kr(e){const t=function(){const[e,t]=(0,Br.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Br.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Mr.useRef)(t);n.current=t;const[o,r]=function(e,t,n){const o=(0,Hr.useRef)(null),[r,i]=(0,Hr.useState)(null);return(0,Hr.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Mr.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=Ur(e.foregroundGraphics,r,a),d=Ur(e.backgroundGraphics,r,a),h=$r(e=>e.theme),{transition:f,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="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:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+Ar.useId(),y=(0,Mr.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new Vr({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const p=y.current;p.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Mr.useRef)(null),v=(0,Mr.useRef)(e.frameScheduler??Yr);v.current=e.frameScheduler??Yr;const x=(0,Mr.useRef)(null),w=(0,Mr.useRef)(!1),k=(0,Mr.useRef)(()=>{}),S=(0,Mr.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=o,x.current=e)},[]),A=(0,Mr.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);Xr(()=>{p.setPaused(!0===e.paused)},[p,e.paused]),(0,Mr.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void p.setVisible(!0);const t=()=>p.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[p,e.suspendWhenHidden]),(0,Mr.useEffect)(()=>()=>{A()},[A]);const M=(0,Mr.useRef)(()=>{}),C=(0,Mr.useRef)(()=>{}),j=(0,Mr.useRef)(null),_=(0,Mr.useRef)(null),R=(0,Mr.useRef)(null),P=(0,Mr.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Mr.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,Mr.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Mr.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return Xr(()=>{T&&(Er++,T.current=!0,S())},[h,S,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:g,frameRuntime:p,rafRef:b,renderFnRef:k,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var Qr=require("react"),Zr=require("react/jsx-runtime");function Jr({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,Zr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,Zr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var ei=require("react");function ti(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function ni(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function oi(e,t,n=.3){ni(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ri(e,t,n=.6){if(!ni(t))return;const o=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,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function ii(e,t,n,o=.35){ni(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function si(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)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]}function ai(e,t,n){if(null==t)return n;if(Cn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${jn(e)}@${n}`,r=Rn.get(o);if(void 0!==r)return r;const i=An({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Rn.set(o,i),i}(t,e);return o||t.background&&zr(e,t.background)||n}return"string"!=typeof t?t:zr(e,t)||n}function li(e,t){if(null==t)return;const n=ai(e,t,"");return""===n?void 0:n}function ci(e,t,n,o,r,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,r,i,s),[h,f,m]=si(e,n);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function ui(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=go(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function di(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}}}function hi(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;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+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}require("d3-shape");var fi=new Map;function mi(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=fi.get(t);return n||(n=new Path2D(ne(e.symbolType,e.size)),fi.size>256&&fi.clear(),fi.set(t,n)),n}catch{return null}}function gi(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=rt(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=ai(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=ct(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&dt(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),dt(e,i,c,t.accent,void 0,l),e.restore()}var yi=require("d3-shape");function pi(e,t){const n=t._gradientBand.colors;if(0===n.length)return;const{clipPath:o,slices:r}=bo({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:n}),i=new Path2D(o);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=zr(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=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function bi(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 vi(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=(0,yi.arc)().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var xi=(e,t,n,o)=>{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)pi(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(bi(e,t),ii(e,t)),e.globalAlpha=1;else{if(e.fillStyle=ai(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=po({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),vi(e,t)):(bi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(bi(e,t),ii(e,t)),e.globalAlpha=1}},wi=(e,t,n,o)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=zr(e,"var(--semiotic-primary, #007bff)"),i=zr(e,"var(--semiotic-text, #333)"),s=ai(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?zr(e,a)||a: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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=u,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},ki=(e,t,n,o)=>{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 n=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=ai(e,t.style.fill,"#007bff"),e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Si=(e,t,n,o)=>{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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=n.fillOpacity??n.opacity??.3,e.fillStyle=li(e,n.fill)??"#999",e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=zr(e,n.style.stroke)||ai(e,n.style.fill,"")||zr(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=n.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ai=(e,t,n,o)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const n=t.points;if(n.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=li(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Mi(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 Ci(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var ji=new Map;function _i(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=ji.get(n);if(void 0!==o)return o;const r=An({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return ji.set(n,r),r}function Ri(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Pi(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 Li(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function Ii(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Ti(e){return(t,n,o,r)=>{e(t,n.filter(Ii),{x:o.r,y:o.r},r)}}var $i=Ti((e,t,n,o)=>{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)hi(e,t);else if(t.cornerRadii&&mo(t.cornerRadii)){const n=ai(e,t.style.fill,zr(e,"var(--semiotic-primary, #007bff)")),o=di(t),r=t.fillGradient&&"string"==typeof n?ci(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,ui(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=ai(e,t.style.fill,zr(e,"var(--semiotic-primary, #007bff)")),o=di(t),r=t.fillGradient&&"string"==typeof n?ci(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=ai(e,t.style.fill,zr(e,"var(--semiotic-primary, #007bff)")),o=di(t),r=t.fillGradient&&"string"==typeof n?ci(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}oi(e,t),e.globalAlpha=1}}),Bi=Ti((e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=ai(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=ai(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ri(e,n)}finally{e.restore()}}}),Hi=Ti((e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=mi(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=n*i*(t.style.fillOpacity??1),e.fillStyle=ai(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=ai(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n}),Oi=Ti((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&gi(e,o,o.x,o.y,n);e.globalAlpha=n}),Fi=e=>[Si,...e],Ei={bar:Fi([$i]),clusterbar:Fi([$i]),point:Fi([Bi,Hi]),swarm:Fi([Bi,Hi]),pie:[xi],donut:[xi],boxplot:Fi([wi,Bi]),violin:Fi([ki]),histogram:Fi([$i]),ridgeline:Fi([ki]),timeline:Fi([$i]),funnel:[$i,Ai,(e,t,n,o)=>{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 n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(n.__funnelRowWidth??n.__funnelBarW??0))continue;const r=n.__funnelStepLabelX,i=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,r,i),e.fillStyle="#fff",e.fillText(o,r,i)}e.font="bold 13px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=n.__funnelBarW??0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,s=!0===n.__funnelIsFirstStep;let a;if(a=s?Mi(r):null!=i?`${Mi(r)} (${Ci(i)})`:Mi(r),e.measureText(a).width+16>o){if(s||null==i)continue;if(a=Mi(r),e.measureText(a).width+16>o)continue}const l=n.__funnelValueLabelX,c=(n.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[$i,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const n=("string"==typeof t.style.fill?t.style.fill:null)||zr(e,"var(--semiotic-border, #999)"),o=_i(n,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{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[n,o,r]=si(e,t);return(.2126*n+.7152*o+.0722*r)/255>.6}(e,zr(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,u=i?Li(r):"",d=Pi(o);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,m=Math.max(h,f)+12,g=i?32:17,y=n.__barFunnelLabelX,p=y-m/2,b=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Ri(e,p,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Ri(e,p,b,m,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:Fi([$i]),custom:Fi([$i,Bi,Hi,Oi,xi,wi,ki,Ai])},Di=new Set;function Wi(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function Ni(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Di.has(n)||(Di.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var zi=require("react/jsx-runtime");function qi(e){const t=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&mr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>dr.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=gr(l,hr),u=gr(l,fr),d=new Set(hr),h=new Set(fr),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>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,zi.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[null!=t.title&&(0,zi.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,zi.jsxs)("div",{children:[(0,zi.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Gi({hover:e}){const t=e.data||{},n=e.stats,o=e.category;if(Array.isArray(t)){const e=o||t[0]?.category||"";if(n)return(0,zi.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[e&&(0,zi.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,zi.jsxs)("div",{children:["n = ",n.n]}),(0,zi.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),(0,zi.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,zi.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),(0,zi.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),(0,zi.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),(0,zi.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,zi.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[e&&(0,zi.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,zi.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,zi.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[t.category&&(0,zi.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,zi.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,zi.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return qi(t);const a=(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 a||""!==l?(0,zi.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[a&&(0,zi.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,zi.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):qi(t)}function Vi(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function Xi(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}Gi.ownsChrome=!0;var Yi=require("react"),Ui=require("react");function Ki(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Qi(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=ut(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function Zi(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var Ji=require("react/jsx-runtime"),es={top:50,right:40,bottom:60,left:70},ts=(0,u.memo)((0,u.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:m,multiAxis:g,timeAccessor:y,valueAccessor:p,categoryAccessor:b,accessorRevision:v,projection:x="vertical",size:w=[600,400],responsiveWidth:k,responsiveHeight:S,margin:A,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:F,amplitude:E,connectorOpacity:D,showLabels:W,connectorAccessor:N,connectorStyle:z,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,renderMode:J,colorScheme:ee,barColors:te,showAxes:oe=!0,showCategoryTicks:re,categoryLabel:ie,valueLabel:se,categoryFormat:ae,valueFormat:le,oLabel:ce,rLabel:ue,oFormat:de,rFormat:he,rTickValues:fe,tickLabelEdgeAlign:me,axisExtent:ge,enableHover:ye=!0,hoverAnnotation:pe,tooltipContent:be,customHoverBehavior:ve,customClickBehavior:xe,onObservation:we,annotationObservationCallback:ke,chartId:Se,annotations:Ae,onAnnotationActivate:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:je,showGrid:_e=!1,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Oe,legendCategoryAccessor:Fe,onCategoriesChange:Ee,backgroundGraphics:De,foregroundGraphics:We,title:qe,className:Ve,background:Xe,centerContent:Ye,decay:Ue,pulse:Ke,transition:Qe,animate:et,staleness:tt,frameScheduler:nt,clock:ot,random:it,seed:at,paused:lt=!1,suspendWhenHidden:ut=!0,brush:dt,onBrush:ft,accessibleTable:mt=!0,description:gt,summary:yt,customLayout:pt,onLayoutError:bt,layoutConfig:vt,layoutSelection:St}=e,{customHoverBehavior:Mt,customClickBehavior:Ct,hasClickBehavior:jt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,Yi.useCallback)((t,i)=>{e?.(t,i),Vi({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,Yi.useCallback)((e,i)=>{t?.(e,i),Xi({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:ve,customClickBehavior:xe,onObservation:we,chartId:Se,chartType:"StreamOrdinalFrame"}),_t=b??i,Rt=p??s,Pt=(0,u.useRef)(!0),Lt=Kr({sizeProp:w,responsiveWidth:k,responsiveHeight:S,userMargin:A,marginDefault:es,title:qe,legend:Re,legendPosition:$e,animate:et,transitionProp:Qe,frameScheduler:nt,clock:ot,random:it,seed:at,paused:lt,suspendWhenHidden:ut,themeDirtyRef:Pt}),{reducedMotionRef:It,responsiveRef:Tt,size:$t,margin:Bt,adjustedWidth:Ht,adjustedHeight:Ot,currentTheme:Ft,transition:Et,introEnabled:Dt,tableId:Wt,rafRef:Nt,renderFnRef:zt,scheduleRender:qt,frameRuntime:Gt}=Lt,Vt=function(){const[e,t]=(0,Ao.useState)(!1);return Mo(()=>{t(!0)},[]),e}(),Xt=function(){const e=(0,Ao.useSyncExternalStore)(Co,jo,_o);return(0,Ao.useRef)(e).current}(),Yt=(0,u.useMemo)(()=>h(r),[r]),Ut=ie??ce,Kt=se??ue,Qt=ae??de,Zt=le??he,Jt=(0,u.useRef)(null),[en,tn]=(0,u.useState)(null),[nn,on]=(0,u.useState)(null),rn=ti(We,$t,Bt,nn),sn=ti(De,$t,Bt,nn),an=De||"transparent"===Xe?null:(0,Ji.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-Bt.left,y:-Bt.top,width:$t[0],height:$t[1],fill:Xe||"var(--semiotic-bg, transparent)"}),[ln,cn]=(0,u.useState)(0),un=(0,u.useRef)(0),[dn,hn]=(0,u.useState)(!1),fn=(0,u.useRef)({w:-1,h:-1}),mn=(0,u.useRef)(!1),gn=(0,He.useRef)(new Ne("StreamOrdinalFrame")),yn=ye||pe,pn="streaming"===o,bn=function(e){const t=(0,Ro.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Lo(e,t);if(!Io(e)||!Io(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!Lo(n,r))return!1}else{if(!Io(n)||!Io(r))return!1;if(!Po(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({chartType:n,runtimeMode:pn?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:X,projection:x,oAccessor:pn?void 0:_t,rAccessor:pn?void 0:Rt,accessorRevision:v,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:m,multiAxis:g,timeAccessor:pn?y:void 0,valueAccessor:pn?p||("string"==typeof Rt||"function"==typeof Rt?Rt:void 0):void 0,categoryAccessor:pn?_t:void 0,rExtent:G,oExtent:V,axisExtent:ge,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:F,amplitude:E,connectorOpacity:D,showLabels:W,connectorAccessor:N,connectorStyle:z,dataIdAccessor:q,oSort:Y,pieceStyle:Q,summaryStyle:Z,colorScheme:ee,themeCategorical:Ft?.colors?.categorical,themeSemantic:Cr(Ft),themeSequential:Ft?.colors?.sequential,themeDiverging:Ft?.colors?.diverging,barColors:te,decay:Ue,pulse:Ke,transition:Et,introAnimation:Dt,staleness:tt,clock:Gt.now,customLayout:pt,onLayoutError:bt,layoutConfig:vt,layoutMargin:Bt}),[n,pn,K,U,X,x,_t,Rt,v,a,l,c,d,m,g,y,p,G,V,ge,M,C,j,_,R,P,L,I,T,$,B,H,O,F,E,D,W,N,z,q,Y,Q,Z,ee,Ft,te,Ue,Ke,Et,Dt,tt,Gt.now,pt,bt,vt,Bt])),vn=(0,u.useRef)(null);vn.current||(vn.current=new Be(bn));const xn=function(e,t,n,o){const r=(0,ei.useRef)({accessor:t,onChange:n,readData:o}),i=(0,ei.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,ei.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(vn,Fe,Ee,e=>e.getData());!function(e,t,n,o){(0,Je.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(vn,bn,Pt,qt),function(e,t,n,o){const r=(0,Je.useRef)(null);(0,Je.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(vn,St,Pt,qt);const wn=(0,u.useRef)(null);wn.current||(wn.current=new f(e=>{const t=vn.current;t&&t.ingest(e)&&(Pt.current=!0,qt())}));const kn=(0,u.useCallback)(e=>{wn.current?.push(e)},[]),Sn=(0,u.useCallback)(e=>{wn.current?.pushMany(e)},[]),An=(0,u.useCallback)(()=>{wn.current?.clear(),vn.current?.clear(),Pt.current=!0,qt()},[qt]),Mn=(0,u.useCallback)(e=>{wn.current?.clearLastData(),wn.current?.setReplacementData(e)},[]);(0,u.useImperativeHandle)(t,()=>({push:kn,pushMany:Sn,replace:Mn,remove:e=>{wn.current?.flush();const t=vn.current?.remove(e)??[];if(t.length>0){const e=Jt.current?.data;!!Jt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Jt.current=null,tn(null)),Pt.current=!0,qt()}return t},update:(e,t)=>{wn.current?.flush();const n=vn.current?.update(e,t)??[];return n.length>0&&(Pt.current=!0,qt()),n},clear:An,getData:()=>(wn.current?.flush(),vn.current?.getData()??[]),getScales:()=>vn.current?.scales??null,getCustomLayout:()=>vn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>vn.current?.lastCustomLayoutFailure??null}),[kn,Sn,Mn,An,qt]),(0,u.useEffect)(()=>{r&&wn.current?.setBoundedData(Yt)},[r,Yt]);const{canvasRef:jn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,Qr.useRef)(null),a=(0,Qr.useRef)(null),l=(0,Qr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Mo(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Ao.useRef)(a);l.current=a,(0,Ao.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Qr.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,Qr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Lt,{storeRef:vn,dirtyRef:Pt,hydrated:Vt,wasHydratingFromSSR:Xt,cleanup:()=>wn.current?.clear(),canvasPaintDependencies:[n,Ht,Ot,oe,Xe,De,J,qt]}),{hoverHandlerRef:_n,hoverLeaveRef:Rn,onPointerMove:Ln,onPointerLeave:In}=Lt;_n.current=e=>{if(!yn)return;const t=jn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Bt.left,i=e.clientY-o.top-Bt.top;if(0>r||r>Ht||0>i||i>Ot)return void(Jt.current&&(Jt.current=null,tn(null),Mt&&Mt(null),qt()));const s=vn.current;if(!s||0===s.scene.length)return;const a="radial"===x,l=ht(s.scene,a?r-Ht/2:r,a?i-Ot/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Jt.current&&(Jt.current=null,tn(null),Mt&&Mt(null),qt()));const c=ur(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof _t?_t:void 0,__rAccessor:"string"==typeof Rt?Rt:void 0,__chartType:n});Jt.current=c,tn(c),Mt&&(Mt(c),Pt.current=!0),qt()},Rn.current=()=>{Jt.current&&(Jt.current=null,tn(null),Mt&&(Mt(null),Pt.current=!0),qt())};const Tn=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Ct)return;const o=jn.current;if(!o)return Ct(null),Pt.current=!0,void qt();const r=o.getBoundingClientRect(),i=e.clientX-r.left-Bt.left,s=e.clientY-r.top-Bt.top;if(0>i||i>Ht||0>s||s>Ot)return Ct(null),Pt.current=!0,void qt();const a=vn.current;if(!a||0===a.scene.length)return Ct(null),Pt.current=!0,void qt();const l="radial"===x,c=ht(a.scene,l?i-Ht/2:i,l?s-Ot/2:s,30,a.pointQuadtree,a.maxPointRadius);if(!c)return Ct(null),Pt.current=!0,void qt();var u;Ct(ur(c.datum||{},c.x,c.y,{...c.stats&&{stats:c.stats},...c.category&&{category:c.category},__oAccessor:"string"==typeof _t?_t:void 0,__rAccessor:"string"==typeof Rt?Rt:void 0,__chartType:n}),{type:"activate",inputType:(u=e.nativeEvent.pointerType,"touch"===u?"touch":"pointer")}),Pt.current=!0,qt()},[Ct,jn,Bt.left,Bt.top,Ht,Ot,x,_t,Rt,n,qt]),{kbFocusIndexRef:$n,focusedNavPointRef:Bn,onKeyDown:Hn}=function({chartType:e,oAccessor:t,rAccessor:n,...o}){return function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,Ui.useRef)(-1),u=(0,Ui.useRef)(null),d=(0,Ui.useRef)(null),h=(0,Ui.useCallback)(h=>{if(function(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']")}(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||m());let g;if(d.current?.version===f.version)g=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||m());g=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}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 n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),d.current={version:f.version,graph:g}}let y=c.current;if(g.flat.length>y||(m(),y=-1),("Enter"===h.key||" "===h.key)&&y>=0)return h.preventDefault(),void i(l(g.flat[y],f),{type:"activate",inputType:"keyboard"});if(0>y){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=g.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const p=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);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=n.groups.indexOf(o);return n.groups.length-1>e?Ki(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Ki(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(h.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(g,y),g);if(null===p)return;if(h.preventDefault(),0>p)return void m();c.current=p;const b=g.flat[p];u.current=b;const v=l(b,f);t.current=v,o(v),r(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...o,extractPoints:Qi,toHover:o=>({...Zi(o),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:e})})}({storeRef:vn,hoverRef:Jt,setHoverPoint:tn,customHoverBehavior:Mt,customClickBehavior:Ct,scheduleRender:qt,chartType:n,oAccessor:_t,rAccessor:Rt}),On=(0,u.useCallback)(e=>{$n.current=-1,Bn.current=null,Ln(e)},[Bn,$n,Ln]);zt.current=()=>{if(Nt.current=null,!Gt.isActive)return;const e=jn.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const o=vn.current;if(!o)return;const r=Gt.now(),i=o.advanceTransition(It.current?r+1e6:r),s=!It.current&&i,a=fn.current.w!==Ht||fn.current.h!==Ot,l=Pt.current;let c=!1;const u=gn.current.beforeCompute(o.getLastUpdateResult(),s);!l&&!a||s&&!a||(o.computeScene({width:Ht,height:Ot}),fn.current={w:Ht,h:Ot},c=!0,xn()),gn.current.afterCompute(u,c,a),Pt.current=l&&s&&!c;const d=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,c,mn);(c||s)&&e.setAttribute("aria-label",zo(o.scene,n+" chart"));const h=function(){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))}(),f=$t[0]*h,m=$t[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=$t[0]+"px",e.style.height=$t[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,$t[0],$t[1]);const g=tt&&o.lastIngestTime>0&&r-o.lastIngestTime>(tt?.threshold??5e3);g&&(t.globalAlpha=tt?.dimOpacity??.5);const y="radial"===x;t.save(),t.beginPath(),t.rect(Bt.left,Bt.top,Ht,Ot),t.clip(),y?(t.save(),t.translate(Bt.left+Ht/2,Bt.top+Ot/2)):t.translate(Bt.left,Bt.top);const p=pt?Ei.custom:Ei[n]||[],b={width:Ht,height:Ot},v=o.scales;v&&function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Wi(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Ni(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const n of p)n(t,e,v,b)}}),y&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&o.scales?(on(o.scales),cn(e=>e+1),un.current=r):s&&o.scales&&r-un.current>=33&&(cn(e=>e+1),un.current=r),tt?.showBadge&&hn(!!g),(s||null!=o.activeTransition||d.pending)&&qt()},function(e,t,n,o,r,i){const s=(0,xt.useRef)("fresh");(0,xt.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return kt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...wt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:kt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(tt,vn,Pt,qt,dn,hn);const Fn=yn&&en?be?be(en):(0,Ji.jsx)(Gi,{hover:en}):null,En="radial"===x,Dn=Fn?(0,Ji.jsx)(Sr,{x:en?En?en.x+Ht/2:en.x:0,y:en?En?en.y+Ot/2:en.y:0,containerWidth:Ht,containerHeight:Ot,margin:Bt,className:"stream-ordinal-tooltip",children:Fn}):null,Wn="horizontal"===x?_t:Rt,Nn=ro("horizontal"===x?Rt:_t,void 0,"__semiotic_resolvedO",""),zn=ro(Wn,void 0,"__semiotic_resolvedR",""),qn=Nn.key,Gn=zn.key,Vn=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(Nn,zn,Ae&&Ae.length>0||!1);if(So||!Vt&&Xt){const e=vn.current;e&&r&&(e.ingest({inserts:Yt,bounded:!0}),e.computeScene({width:Ht,height:Ot}));const t=e?.scene??[],n=e?.scales??null,o=ti(We,$t,Bt,n),i=ti(De,$t,Bt,n),s="radial"===x,a=s?Bt.left+Ht/2:Bt.left,l=s?Bt.top+Ot/2:Bt.top;return(0,Ji.jsxs)("div",{ref:Tt,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"img","aria-label":gt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:k?"100%":$t[0],height:S?"100%":$t[1]},children:[(0,Ji.jsx)(or,{summary:yt}),(0,Ji.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:$t[0],height:$t[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,Ji.jsx)("g",{transform:`translate(${Bt.left},${Bt.top})`,children:i}),(0,Ji.jsxs)("g",{transform:`translate(${a},${l})`,children:[Xe&&(0,Ji.jsx)("rect",{x:0,y:0,width:Ht,height:Ot,fill:Xe}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Wi(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ni(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:J,fallback:()=>function(e,t,n){const o=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=n=>`ord-${e.type}-${o}-${t}-${n}`,i=`ord-${e.type}-${o}-${t}`;switch(e.type){case"rect":{const t=e,n=ko(i)+"-grad",o=function(e,t){const n=e.fillGradient;if(!n)return null;let o=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(o=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(o=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in n){const e=n.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++)a.push((0,vo.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=wo(e.style.fill);a.push((0,vo.jsx)("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),a.push((0,vo.jsx)("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return(0,vo.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:o,y1:r,x2:i,y2:s,children:a})}(t,n);let r,s;if(o)s=`url(#${n})`;else if(Cn(t.style.fill)){const e=ko(i)+"-hatch";r=Pn(t.style.fill,e),s=`url(#${e})`}else s=wo(t.style.fill);const a=o||r?(0,vo.jsxs)("defs",{children:[o,r]}):null;if(t.cornerRadii&&mo(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:o,h:r}=e,{tl:i,tr:s,br:a,bl:l}=go(e);let c=`M${t+i},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+r}`),c+=` L${t+l},${n+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+r-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return(0,vo.jsxs)(ho.Fragment,{children:[a,(0,vo.jsx)("path",{d:e,fill:s,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:n,y:o,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n},${o+l} Z`;break;case"left":c=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+l-e} A${e},${e} 0 0 0 ${n+e},${o+l} L${n+r},${o+l} Z`;break;case"bottom":c=`M${n},${o} L${n+r},${o} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n+e},${o+l} A${e},${e} 0 0 1 ${n},${o+l-e} Z`;break;default:c=`M${n},${o+l} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l} Z`}return(0,vo.jsxs)(ho.Fragment,{children:[a,(0,vo.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,vo.jsxs)(ho.Fragment,{children:[a,(0,vo.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,vo.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:wo(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,n){const o=ne(e.symbolType,e.size,e.path);return(0,vo.jsx)("path",{d:o,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?wo(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}(e,t,n);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=rt(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=ct(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?ko(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:st(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:st(n.stroke??"none",a,e.accent);return r||i?(0,vo.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,vo.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,vo.jsx)("clipPath",{id:c,children:(0,vo.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,vo.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,vo.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},o)}(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const o=e;if(o._gradientBand&&o._gradientBand.colors.length>0){const e=ko(`${n?n+"-":""}gauge-grad-${o.category||i}-${t}`),{clipPath:r,slices:s}=bo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds?.start??!0,roundEnd:o.roundedEnds?.end??!0,colors:o._gradientBand.colors});return(0,vo.jsxs)("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[(0,vo.jsx)("defs",{children:(0,vo.jsx)("clipPath",{id:e,children:(0,vo.jsx)("path",{d:r})})}),(0,vo.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,vo.jsx)("path",{d:e.d,fill:wo(e.color)},t))}),o.style.stroke&&"none"!==o.style.stroke&&(0,vo.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},i)}let r;if(o.roundedEnds)r=po({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=(0,fo.arc)().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),r=e(xo)||""}return(0,vo.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:wo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return(0,vo.jsxs)("g","vertical"===t.projection?{children:[(0,vo.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:wo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,vo.jsx)("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,vo.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:wo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,vo.jsx)("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,vo.jsx)("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[(0,vo.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:wo(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,o=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?n.push((0,vo.jsx)("line",{x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,vo.jsx)("circle",{cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):n.push((0,vo.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,vo.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,vo.jsx)("g",{children:n},i)}case"connector":return(0,vo.jsx)("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,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,vo.jsx)("polygon",{points:n,fill:wo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Wt)})).filter(Boolean)]})]}),(0,Ji.jsx)(oo,{width:Ht,height:Ot,totalWidth:$t[0],totalHeight:$t[1],margin:Bt,scales:n,showAxes:oe,showCategoryTicks:re,oLabel:Ut,rLabel:Kt,oFormat:Qt,rFormat:Zt,rTickValues:fe,tickLabelEdgeAlign:me,axisExtent:ge,showGrid:_e,title:qe,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Oe,foregroundGraphics:Ge(o,Ze(vn.current?.customLayoutOverlays,St??null)),annotations:Ae,onAnnotationActivate:Me,onObservation:ke??we,chartId:Se,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:je,annotationFrame:0,xAccessor:qn,yAccessor:Gn,annotationData:Vn(e?.getData())}),Ye&&"radial"===x&&(0,Ji.jsx)("div",{style:{position:"absolute",left:Bt.left+Ht/2,top:Bt.top+Ot/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ye})]})}return(0,Ji.jsxs)("div",{ref:Tt,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"group","aria-label":gt||("string"==typeof qe?qe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:k?"100%":$t[0],height:S?"100%":$t[1],overflow:"visible"},onKeyDown:Hn,children:["production"!==process.env.NODE_ENV&&vn.current&&(0,Ji.jsx)(ze,{store:vn.current,diagnostics:gn.current}),mt&&(0,Ji.jsx)(rr,{tableId:Wt}),mt&&(0,Ji.jsx)(nr,{scene:vn.current?.scene??[],chartType:n+" chart",tableId:Wt,chartTitle:"string"==typeof qe?qe:void 0}),(0,Ji.jsx)(or,{summary:yt}),(0,Ji.jsx)(Fo,{hoverPoint:en}),(0,Ji.jsxs)("div",{role:"img","aria-label":gt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:yn?On:void 0,onMouseLeave:yn?In:void 0,onClick:jt?Tn:void 0,children:[(0,Ji.jsxs)(Jr,{size:$t,margin:Bt,children:[an,sn]}),(0,Ji.jsx)(to,{width:Ht,height:Ot,totalWidth:$t[0],totalHeight:$t[1],margin:Bt,scales:nn,showAxes:oe,showGrid:_e,rFormat:Zt,rTickValues:fe,axisExtent:ge}),(0,Ji.jsx)("canvas",{ref:jn,"aria-label":zo(vn.current?.scene??[],n+" chart"),style:{position:"absolute",top:0,left:0,width:$t[0],height:$t[1]}}),(0,Ji.jsx)(oo,{width:Ht,height:Ot,totalWidth:$t[0],totalHeight:$t[1],margin:Bt,scales:nn,showAxes:oe,showCategoryTicks:re,oLabel:Ut,rLabel:Kt,oFormat:Qt,rFormat:Zt,rTickValues:fe,axisExtent:ge,showGrid:_e,title:qe,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Oe,foregroundGraphics:Ge(rn,Ze(vn.current?.customLayoutOverlays,St??null)),annotations:Ae,onAnnotationActivate:Me,onObservation:ke??we,chartId:Se,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:je,annotationFrame:ln,xAccessor:qn,yAccessor:Gn,annotationData:Vn(vn.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(dt||ft)&&"radial"!==x&&(0,Ji.jsx)(uo,{width:Ht,height:Ot,totalWidth:$t[0],totalHeight:$t[1],margin:Bt,scales:nn,onBrush:ft||(()=>{})}),Ye&&"radial"===x&&(0,Ji.jsx)("div",{style:{position:"absolute",left:Bt.left+Ht/2,top:Bt.top+Ot/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ye}),tt?.showBadge&&(0,Ji.jsx)(At,{isStale:dn,position:tt.badgePosition}),(0,Ji.jsx)(ar,{active:$n.current>=0,hoverPoint:en,margin:Bt,size:$t,shape:Bn.current?.shape,width:Bn.current?.w,height:Bn.current?.h}),Dn]})]})}));ts.displayName="StreamOrdinalFrame";var ns=ts;function os(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function rs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};o&&(f.annotationObservationCallback=o);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function is(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:wr(t)||n}}var ss=require("react"),as=require("react"),ls=require("react"),cs=(require("react/jsx-runtime"),(0,ls.createContext)(null));function us(){return(0,ls.useContext)(cs)}var ds=require("react");function hs(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function fs(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function ms(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 n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[gs,ys]=fn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!ms(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=fs(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=fs(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),ps=require("react"),bs=(require("react"),{positions:new Map}),vs=new Set;function xs(){for(const e of vs)e()}function ws(e,t){const n=bs.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(bs.positions);o.delete(e),bs={positions:o},xs()}function ks(e,t){const n=bs.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(bs.positions);o.delete(e),bs={positions:o},xs()}function Ss(e){const t=(0,ps.useId)(),n=e.clientId||t,{name:o}=e,r=ys(e=>e.selections.get(o)),i=ys(e=>e.setClause),s=ys(e=>e.clearClause),a=(0,ps.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,ps.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(hs(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,ps.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,ps.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,ps.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function As(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ms(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Cs=(0,ds.createContext)(!1);(0,ds.createContext)(!1);var js=(0,ds.createContext)(null),_s="undefined"==typeof window?ds.useEffect:ds.useLayoutEffect;function Rs(e){const t=(0,ds.useContext)(js),n=(0,ds.useId)(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=(0,ds.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,o)||(r.current=o);const i=r.current;_s(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),_s(()=>{t&&t.registerCategories(n,i)},[t,n,i])}function Ps({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):G[i%G.length];return{label:r+"",color:a}}),label:""}]}}var Ls=l(require("react"));function Is(){return $r(e=>e.theme)}function Ts(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function $s(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Bs(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>$s(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:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Ts(e[o])&&Ts(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}function Hs(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function Os(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 Fs(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),Ls.createContext(void 0);var Es=[],Ds={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Ws(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Ds;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function Ns(){const e=Is(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function zs(e,t,n){return(0,as.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}var qs={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 Gs(e,t,n){const o=qs[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Bs({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=qs[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Vs(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Ws(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Vs(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}var Xs=require("react/jsx-runtime");function Ys(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Us(e,t){if(!t)return Ys(e);try{const n=t(e);return null==n?Ys(e):n}catch{return Ys(e)}}function Ks(e,t){return"function"==typeof t?t(e):e[t]}function Qs({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=Ks(a,e),c=Ks(a,t),u=n?Ks(a,n):void 0;return(0,Xs.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[(0,Xs.jsx)("div",{style:{fontWeight:"bold"},children:Ys(l)}),(0,Xs.jsx)("div",{style:{marginTop:4},children:Us(c,i)}),null!=u&&(0,Xs.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[o||(d=n,"string"==typeof d?d:"value"),": ",Ys(u)]})]});var d}}var Zs=require("react/jsx-runtime");function Js({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,Zs.jsx)("div",{role:"alert",style:{width:o,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:(0,Zs.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Zs.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Zs.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,Zs.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var ea=l(require("react")),ta=require("react/jsx-runtime"),na=class extends ea.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:(0,ta.jsx)(Js,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},oa=require("react/jsx-runtime"),ra="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function ia({componentName:e,width:t,height:n,children:o}){return(0,oa.jsx)(na,{fallback:o=>(0,oa.jsx)(Js,{componentName:e,message:o.message,width:t,height:n}),children:o})}var sa={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"},aa={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function la(e,t,n,o){if(!ra)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function ca(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function ua(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=ca(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function da({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"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(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=ua(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var ha=require("react"),fa=require("react");function ma(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:f,chartId:m,showLegend:g,userMargin:y,marginDefaults:p,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:A,width:M,height:C}=e,j=void 0===n,_=(0,ha.useMemo)(()=>h(t),[t]),[R,P]=(0,ha.useState)([]),L=(0,ha.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,ha.useMemo)(()=>Ws(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:$,hoverSelectionHook:B,customHoverBehavior:H,customClickBehavior:O,crosshairSourceId:F}=function({selection:e,linkedHover:t,fallbackFields:n=Es,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,as.useId)(),h=(0,as.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,as.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),m=Ss({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ss({name:t,fields:n});return{onHover:(0,ps.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Ms(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:h?.name||"hover",fields:f}),y=yn(e=>e.pushObservation),p=(0,as.useCallback)(e=>{r?.(e),y?.(e)},[r,y]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=(0,as.useState)(null),w=(0,as.useRef)(!1),k=c||n[0],S=(0,as.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),A=(0,as.useCallback)((e,n)=>{const o=!e&&w.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 n=Hs(e,t,h.xField);null!=n&&function(e,t,n){const o=bs.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(bs={positions:new Map(bs.positions).set(e,{xValue:t,sourceId:n})},xs())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||ws(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else o||x(null);(r||y)&&Vi({onObservation:p,datum:e?Os(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,g,h,d,r,i,s,y,p,l,k,u]),M=(0,as.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&l&&x(null),"x-position"===h?.mode&&(ks(h.name||"hover",d),ws(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),C=(0,as.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Hs(n,e,h.xField);null!=t&&function(e,t,n){const o=bs.positions.get(e);if(o?.locked){const t=new Map(bs.positions);return t.delete(e),bs={positions:t},xs(),!1}bs={positions:new Map(bs.positions).set(e,{xValue:t,sourceId:n,locked:!0})},xs()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const o=Os(n);if(t&&"x-position"!==h?.mode&&g.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}Fs(e)&&m.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||y)&&Xi({onObservation:p,datum:n?Os(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,y,p,i,s,h,d,u,t,g,e,m,f,l,k,M]);return(0,as.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,as.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,as.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{ks(e,d),ws(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:f,chartId:m,onClick:b,hoverHighlight:v,colorByField:I,mobileInteraction:T}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,F),D=function(e,t,n){const o=us(),r=Ns();return(0,as.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Fs(i)){const e=U(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return U(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Fs(i)){const n=U(e,t,s);return e=>i[e]||n(e)}return U(e,t,s)}if(i&&Fs(i)){const e=U([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}(_,o,r),W=(0,ha.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),N=(0,ha.useMemo)(()=>j&&R.length>0?R:W,[j,R,W]),z=function(e,t,n){const[o,r]=(0,as.useState)(null),[i,s]=(0,as.useState)(new Set),a=(0,as.useMemo)(()=>new Set,[]),l=(0,as.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,as.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,as.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,N),q=(0,ha.useMemo)(()=>B||(z.legendSelectionHook?z.legendSelectionHook:$),[B,z.legendSelectionHook,$]),V=function(e){const t=$r(e=>e.theme.colors.selectionOpacity);return(0,fa.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),Y=Ns(),K=us(),Q=(0,ha.useMemo)(()=>{if(D)return D;if(!o||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:G,t="__streamCat",n=U(N.map(e=>({[t]:e})),t,e);return e=>K?.[e]||n(e)||"#999"},[D,o,N,r,Y,K]),{legend:Z,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,ds.useContext)(Cs),c=null!==(0,ds.useContext)(js),u=void 0!==o?o:!l&&!!t,d=!!t&&(u||c),h=(0,as.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,d]);Rs(c&&t?h:[]);const f=(0,as.useMemo)(()=>{if(!u||!t)return;const o=Ps({data:e,colorBy:t,colorScale:n,getColor:X,categories:h});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,h]),m=(0,as.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:_,colorBy:o,colorScale:Q,showLegend:g,legendPosition:s,userMargin:y,defaults:p,categories:N}),te=(0,ha.useMemo)(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=ee),i&&"none"!==i&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[Z,ee,i,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,j,o,L]),ne=Array.isArray(n)?h(n):n,oe=function(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,oa.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,oa.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,oa.jsx)("div",{className:"semiotic-loading-bar",style:{...aa,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}(k,M,C,S),re=oe?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,oa.jsx)("div",{style:{...sa,width:t,height:n},children:o||"No data available"}):null}(ne,M,C,A);return{data:_,colorScale:D,allCategories:N,legendState:z,effectiveSelectionHook:q,activeSelectionHook:$,customHoverBehavior:H,customClickBehavior:O,mobileInteraction:T,legend:Z,margin:J,legendPosition:ee,earlyReturn:oe||re||null,legendBehaviorProps:te,crosshairProps:E,resolvedSelection:V}}var ga=require("react");function ya({ref:e,frameRef:t,setup:n}){return(0,ga.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}var pa=require("react");function ba(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function va(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>ka(t(e))}function xa(e,t){const n=va(e),o=va(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function wa(e,t){const n=va(t??"value"),o=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=o?o(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function ka(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 Sa(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))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=ka(o);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,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function Aa(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):Sa(o,t,n))}function Ma(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Aa(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Ca(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,Ma(s,t,n(s,i))),a}:r}function ja(e,t,n){return e&&0!==e.length?(o,r)=>{const i=Ma(o,e,t(o,r)),s=n?n(o,r):void 0;return s?{...i,...s}:i}:n}function _a(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1,styleRules:y,resolveRuleValue:p}=e,b=(0,pa.useMemo)(()=>(e,a)=>{const l="function"==typeof m?m(e,a):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=X(e,t,n)}else c.fill=function(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Y(n,o);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=z[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}(o,r,i,f?a:void 0,s);if(y&&y.length>0){const t=Ma(e,y,{value:p?p(e):void 0,category:a});Object.assign(c,t)}return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,r,i,s,f,m,g,y,p]),v=(0,pa.useMemo)(()=>ba(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,pa.useMemo)(()=>{return e=v,n=h,(t=d??null)?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e;var e,t,n},[v,d,h])}function Ra(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}}}var Pa=require("react/jsx-runtime"),La=(0,ss.forwardRef)(function(e,t){const n=Gs(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}),o=(0,ss.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sort:m=!1,barPadding:g=40,roundedTop:y,gradientFill:p=!1,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,regression:k,valueExtent:S,frameProps:A={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,showCategoryTicks:D,categoryFormat:W,dataIdAccessor:N}=e,{width:z,height:q,enableHover:G,showGrid:V,showLegend:X,title:Y,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=(0,ss.useMemo)(()=>h(r),[r]),te=ma({data:ee,rawData:r,colorBy:d,colorScheme:f,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:X,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:q}),{effectiveLegendProps:ne,effectiveMargin:oe}=ya({ref:t,frameRef:o,setup:te});la("BarChart",ee,"categoryAccessor",a),la("BarChart",ee,"valueAccessor",l);const re=zs(ee,m,l),ie=Ns(),se=(0,ss.useMemo)(()=>new Map,[]),ae=(0,ss.useMemo)(()=>va(l),[l]),le=_a({colorBy:d,colorScale:te.colorScale,color:H,themeCategorical:ie,colorScheme:f,categoryIndexMap:se,userPieceStyle:A?.pieceStyle,stroke:O,strokeWidth:F,opacity:E,styleRules:b,resolveRuleValue:ae,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=(0,ss.useMemo)(()=>Qs({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=da({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,Pa.jsx)(Js,{componentName:"BarChart",message:ue,width:z,height:q});const de=Ra(k),he=de?[de,...w||[]]:w,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[z,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:g,...null!=y&&{roundedTop:y},...p&&{gradientFill:!0===p?{topOpacity:.8,bottomOpacity:.05}:p},...N&&{dataIdAccessor:N},baselinePadding:v,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:u,...W&&{oFormat:W},showGrid:V,showCategoryTicks:D,oSort:m,...ne,...os({title:Y,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:x,defaultTooltipContent:ce}),...rs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...S&&{rExtent:S},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return(0,Pa.jsx)(ia,{componentName:"BarChart",width:z,height:q,children:(0,Pa.jsx)(ns,{ref:o,...fe})})});La.displayName="BarChart";var Ia=require("react"),Ta=require("react/jsx-runtime"),$a=(0,Ia.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Ia.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:m,normalize:g=!1,sort:y=!1,barPadding:p=40,roundedTop:b,styleRules:v,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:S,frameProps:A={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,categoryFormat:D}=e,{width:W,height:N,enableHover:z,showGrid:q,showLegend:G,title:V,description:X,summary:Y,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=(0,Ia.useMemo)(()=>h(r),[r]),J=f||l,ee=ma({data:Z,rawData:r,colorBy:J,colorScheme:m,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:W,height:N}),te=Ns(),ne=(0,Ia.useMemo)(()=>new Map,[]),oe=(0,Ia.useMemo)(()=>va(c),[c]),re=_a({colorBy:J,colorScale:ee.colorScale,color:H,themeCategorical:te,colorScheme:m,categoryIndexMap:ne,userPieceStyle:A?.pieceStyle,stroke:O,strokeWidth:F,opacity:E,styleRules:v,resolveRuleValue:oe,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,Ia.useMemo)(()=>Qs({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=da({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=ya({ref:t,frameRef:o,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,stackBy:l,normalize:g,oSort:y,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[W,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:p,...null!=b&&{roundedTop:b},baselinePadding:x,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:d,...D&&{oFormat:D},showGrid:q,...ae,...os({title:V,description:X,summary:Y,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:w,defaultTooltipContent:ie}),...rs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return se?(0,Ta.jsx)(Js,{componentName:"StackedBarChart",message:se,width:W,height:N}):(0,Ta.jsx)(ia,{componentName:"StackedBarChart",width:W,height:N,children:(0,Ta.jsx)(ns,{ref:o,...ce})})});$a.displayName="StackedBarChart";var Ba=require("react"),Ha=require("react/jsx-runtime"),Oa=(0,Ba.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Ba.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:m,sort:g=!1,barPadding:y=60,roundedTop:p,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:F,categoryFormat:E}=e,{width:D,height:W,enableHover:N,showGrid:z,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=(0,Ba.useMemo)(()=>h(r),[r]),Z=f||l,J=ma({data:Q,rawData:r,colorBy:Z,colorScheme:m,legendInteraction:T,legendPosition:$,selection:A,linkedHover:M,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GroupedBarChart",chartId:R,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:D,height:W}),ee=Ns(),te=(0,Ba.useMemo)(()=>new Map,[]),ne=(0,Ba.useMemo)(()=>va(c),[c]),oe=_a({colorBy:Z,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:S.pieceStyle,stroke:H,strokeWidth:O,opacity:F,styleRules:b,resolveRuleValue:ne,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Ba.useMemo)(()=>Qs({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=da({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=ya({ref:t,frameRef:o,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,groupBy:l,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:v,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,...se,...os({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:x,defaultTooltipContent:re}),...rs({linkedHover:M,selection:A,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ie?(0,Ha.jsx)(Js,{componentName:"GroupedBarChart",message:ie,width:D,height:W}):(0,Ha.jsx)(ia,{componentName:"GroupedBarChart",width:D,height:W,children:(0,Ha.jsx)(ns,{ref:o,...le})})});Oa.displayName="GroupedBarChart";var Fa=require("react"),Ea=require("react");function Da({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=(i="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const s="string"==typeof o?o:"value",a=function(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ss({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,ps.useCallback)(e=>{if(!e)return void a();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)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&As(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&As(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Ms(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,ps.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,Ea.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,Ea.useCallback)(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}var Wa=require("react/jsx-runtime"),Na=(0,Fa.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Fa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:f,colorScheme:m,barPadding:g,tooltip:y,annotations:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O,rTickValues:F,tickLabelEdgeAlign:E,showCategoryTicks:D,gradientFill:W,trackFill:N,roundedTop:z,valueExtent:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,Fa.useMemo)(()=>h(r),[r]),oe=f||l,re=(0,Fa.useMemo)(()=>{if(null!=g)return g;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof a?a(e):e[a])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*n)/(n-1))):1},[g,e.mode,ne,a,u,G,V]),ie=ma({data:ne,rawData:r,colorBy:oe,colorScheme:m,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:G,height:V}),se=Da({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:c}),ae=Ns(),le=(0,Fa.useMemo)(()=>new Map,[]),ce=_a({colorBy:oe,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:m,categoryIndexMap:le,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Fa.useMemo)(()=>Qs({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=da({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=ya({ref:t,frameRef:o,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:ne},oAccessor:a,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:n.showAxes,oLabel:!1===D?void 0:ee,rLabel:te,rFormat:d,...F&&{rTickValues:F},...null!=E&&{tickLabelEdgeAlign:E},...O&&{oFormat:O},...void 0!==D&&{showCategoryTicks:D},showGrid:Y,...he,...os({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:y,defaultTooltipContent:ue}),...rs({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...p&&p.length>0&&{annotations:p},...W&&{gradientFill:!0===W?{topOpacity:.8,bottomOpacity:.05}:W},...null!=N&&{trackFill:N},...null!=z&&{roundedTop:z},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return de?(0,Wa.jsx)(Js,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,Wa.jsx)(ia,{componentName:"SwimlaneChart",width:G,height:V,children:(0,Wa.jsx)(ns,{ref:o,...me})})});Na.displayName="SwimlaneChart";var za=require("react"),qa=require("react");function Ga(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,qa.useImperativeHandle)(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,n)=>e.current?.update(t,n)??[],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 n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,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,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},[o,r,n])}var Va=require("react/jsx-runtime"),Xa=(0,za.forwardRef)(function(e,t){const n=Gs(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}),o=(0,za.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sizeBy:m,sizeRange:g=[3,8],symbolBy:y,symbolMap:p,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:H,legendInteraction:O,legendPosition:F,color:E,stroke:D,strokeWidth:W,opacity:N,showCategoryTicks:z,categoryFormat:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:U,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=n,oe=(0,za.useMemo)(()=>h(r),[r]),re=ma({data:oe,rawData:r,colorBy:d,colorScheme:f,legendInteraction:O,legendPosition:F,selection:_,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:B,emptyContent:H,width:G,height:V}),ie=Da({brushProp:A,onBrushProp:M,linkedBrush:C,valueAccessor:l}),se=(0,za.useMemo)(()=>{if(m)return le(oe.map(e=>"function"==typeof m?m(e):e[m]))},[oe,m]),ae=Ns(),ce=(0,za.useMemo)(()=>new Map,[]),ue=_a({colorBy:d,colorScale:re.colorScale,color:E,themeCategorical:ae,colorScheme:f,categoryIndexMap:ce,userPieceStyle:j?.pieceStyle,stroke:D,strokeWidth:W,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:m?K(e,m,g,se):b})}),de=(0,za.useMemo)(()=>Qs({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(re.earlyReturn)return re.earlyReturn;const he=da({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(he)return(0,Va.jsx)(Js,{componentName:"SwarmPlot",message:he,width:G,height:V});const fe={chartType:"swarm",...null!=r&&{data:oe},oAccessor:a,rAccessor:l,...y&&{symbolAccessor:y},...p&&{symbolMap:p},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ue,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:te,rLabel:ne,rFormat:u,...q&&{oFormat:q},showGrid:Y,showCategoryTicks:z,...re.legendBehaviorProps,...os({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:w,defaultTooltipContent:de}),...rs({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,Va.jsx)(ia,{componentName:"SwarmPlot",width:G,height:V,children:(0,Va.jsx)(ns,{ref:o,...fe})})});Xa.displayName="SwarmPlot";var Ya=require("react"),Ua=require("react/jsx-runtime");function Ka(e){return t=>{const n=t.category||t.data&&t.data[0]?.category||"",o=t.stats||(t.data||t).stats;if(o&&null!=o.median)return(0,Ua.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[n&&(0,Ua.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o.n&&(0,Ua.jsxs)("div",{children:["n = ",o.n]}),null!=o.min&&(0,Ua.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),null!=o.q1&&(0,Ua.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,Ua.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),null!=o.q3&&(0,Ua.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),null!=o.max&&(0,Ua.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),null!=o.mean&&(0,Ua.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const o=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,Ua.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[n&&(0,Ua.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),i>0&&(0,Ua.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,Ua.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,Ua.jsx)("div",{className:"semiotic-tooltip",style:pr,children:(0,Ua.jsx)("div",{style:{fontWeight:"bold"},children:n+""})})}}var Qa=require("react/jsx-runtime"),Za=(0,Ya.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Ya.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,showOutliers:m=!0,outlierRadius:g=3,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,Ya.useMemo)(()=>h(r),[r]),K=ma({data:U,rawData:r,colorBy:d,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:E}),Q=Ns(),Z=(0,Ya.useMemo)(()=>new Map,[]),J=_a({colorBy:d,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:f,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Ya.useMemo)(()=>Ka(),[]);if(K.earlyReturn)return K.earlyReturn;const te=da({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,Qa.jsx)(Js,{componentName:"BoxPlot",message:te,width:F,height:E});const ne={chartType:"boxplot",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:m,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:y,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:W,showCategoryTicks:H,...K.legendBehaviorProps,...os({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:p,defaultTooltipContent:ee}),...rs({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,Qa.jsx)(ia,{componentName:"BoxPlot",width:F,height:E,children:(0,Qa.jsx)(ns,{ref:o,...ne})})});Za.displayName="BoxPlot";var Ja=require("react"),el=require("react/jsx-runtime"),tl=e=>{const t=e?.category;return null==t?"All":t+""},nl=(0,Ja.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Ja.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a=tl,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:f,colorScheme:m,categoryPadding:g=20,tooltip:y,annotations:p,valueExtent:b,brush:v,onBrush:x,linkedBrush:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:R,loadingContent:P,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,showCategoryTicks:F,categoryFormat:E}=e,{width:D,height:W,enableHover:N,showGrid:z,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=(0,Ja.useMemo)(()=>h(r),[r]),Z=ma({data:Q,rawData:r,colorBy:f,colorScheme:m,legendInteraction:I,legendPosition:T,selection:S,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:L,width:D,height:W}),J=Da({brushProp:v,onBrushProp:x,linkedBrush:w,valueAccessor:l}),ee=(0,Ja.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,n=-1/0;for(const o of Q){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Q,l]),te=Ns(),ne=(0,Ja.useMemo)(()=>new Map,[]),oe=_a({colorBy:f,colorScale:Z.colorScale,color:$,themeCategorical:te,colorScheme:m,categoryIndexMap:ne,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,Ja.useMemo)(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return(0,el.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[n&&(0,el.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o&&(0,el.jsxs)("div",{children:["Count: ",o]}),r&&2===r.length&&(0,el.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=da({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,el.jsx)(Js,{componentName:"Histogram",message:ie,width:D,height:W});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:c,normalize:u,...b?{rExtent:b}:ee&&{rExtent:ee},size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:g,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,showCategoryTicks:F,...Z.legendBehaviorProps,...os({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:y,defaultTooltipContent:re}),...rs({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...p&&p.length>0&&{annotations:p},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,el.jsx)(ia,{componentName:"Histogram",width:D,height:W,children:(0,el.jsx)(ns,{ref:o,...se})})});nl.displayName="Histogram";var ol=require("react"),rl=require("react/jsx-runtime"),il=(0,ol.forwardRef)(function(e,t){const n=Gs(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}),o=(0,ol.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:f=!0,valueFormat:m,colorBy:g,colorScheme:y,categoryPadding:p=20,tooltip:b,annotations:v,valueExtent:x,brush:w,onBrush:k,linkedBrush:S,frameProps:A={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,showCategoryTicks:D,categoryFormat:W}=e,{width:N,height:z,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=(0,ol.useMemo)(()=>h(r),[r]),ee=ma({data:J,rawData:r,colorBy:g,colorScheme:y,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:N,height:z}),te=Da({brushProp:w,onBrushProp:k,linkedBrush:S,valueAccessor:l}),ne=Ns(),oe=(0,ol.useMemo)(()=>new Map,[]),re=_a({colorBy:g,colorScale:ee.colorScale,color:H,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:void 0,stroke:O,strokeWidth:F,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,ol.useMemo)(()=>Ka({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=da({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,rl.jsx)(Js,{componentName:"ViolinPlot",message:se,width:N,height:z});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:f,size:[N,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:p,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:m,...W&&{oFormat:W},showGrid:G,showCategoryTicks:D,...ee.legendBehaviorProps,...os({title:X,description:Y,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:b,defaultTooltipContent:ie}),...rs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...te.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return(0,rl.jsx)(ia,{componentName:"ViolinPlot",width:N,height:z,children:(0,rl.jsx)(ns,{ref:o,...ae})})});il.displayName="ViolinPlot";var sl=require("react"),al=require("react/jsx-runtime"),ll=(0,sl.forwardRef)(function(e,t){const n=Gs(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}),o=(0,sl.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:f,sort:m="auto",dotRadius:g=5,categoryPadding:y=10,tooltip:p,annotations:b,regression:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,sl.useMemo)(()=>h(r),[r]),K=ma({data:U,rawData:r,colorBy:d,colorScheme:f,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:E}),Q=zs(U,m,l),Z=Ns(),J=(0,sl.useMemo)(()=>new Map,[]),ee=_a({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:g,fillOpacity:.8}}),te=(0,sl.useMemo)(()=>Qs({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const ne=da({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ne)return(0,al.jsx)(Js,{componentName:"DotPlot",message:ne,width:F,height:E});const oe=Ra(v),re=oe?[oe,...b||[]]:b,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:y,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:W,oSort:m,...K.legendBehaviorProps,...os({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:p,defaultTooltipContent:te}),...rs({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...x&&{rExtent:x},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,al.jsx)(ia,{componentName:"DotPlot",width:F,height:E,children:(0,al.jsx)(ns,{ref:o,...ie})})});ll.displayName="DotPlot";var cl=require("react"),ul=require("react/jsx-runtime"),dl=(0,cl.forwardRef)(function(e,t){const n=Gs(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}),o=(0,cl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:f,tooltip:m,annotations:g,frameProps:y={},selection:p,linkedHover:b,onObservation:v,onClick:x,hoverHighlight:w,chartId:k,loading:S,loadingContent:A,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:H,description:O,summary:F,accessibleTable:E}=n,D=(0,cl.useMemo)(()=>h(r),[r]),W=c||a,N=ma({data:D,rawData:r,colorBy:W,colorScheme:u,legendInteraction:C,legendPosition:j,selection:p,linkedHover:b,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:B,userMargin:i,marginDefaults:n.marginDefaults,loading:S,loadingContent:A,emptyContent:M,width:I,height:T}),z=Ns(),q=(0,cl.useMemo)(()=>new Map,[]),G=_a({colorBy:W,colorScale:N.colorScale,color:_,themeCategorical:z,colorScheme:u,categoryIndexMap:q,userPieceStyle:y?.pieceStyle,stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:N.effectiveSelectionHook,resolvedSelection:N.resolvedSelection,cycleByCategory:!0}),V=(0,cl.useMemo)(()=>Qs({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),X=da({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:U}=ya({ref:t,frameRef:o,setup:N});if(N.earlyReturn)return N.earlyReturn;const K={chartType:"pie",...null!=r&&{data:D},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=f&&{cornerRadius:f},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...os({title:H,description:O,summary:F,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:m,defaultTooltipContent:V}),...rs({linkedHover:b,selection:p,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return X?(0,ul.jsx)(Js,{componentName:"PieChart",message:X,width:I,height:T}):(0,ul.jsx)(ia,{componentName:"PieChart",width:I,height:T,children:(0,ul.jsx)(ns,{ref:o,...K})})});dl.displayName="PieChart";var hl=require("react"),fl=require("react/jsx-runtime"),ml=(0,hl.forwardRef)(function(e,t){const n=Gs(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}),o=(0,hl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:f,startAngle:m=0,cornerRadius:g,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:H,showLegend:O,title:F,description:E,summary:D,accessibleTable:W}=n,N=(0,hl.useMemo)(()=>h(r),[r]),z=d||a,q=ma({data:N,rawData:r,colorBy:z,colorScheme:f,legendInteraction:_,legendPosition:R,selection:v,linkedHover:x,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DonutChart",chartId:A,showLegend:O,userMargin:i,marginDefaults:n.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=Ns(),X=(0,hl.useMemo)(()=>new Map,[]),Y=_a({colorBy:z,colorScale:q.colorScale,color:P,themeCategorical:V,colorScheme:f,categoryIndexMap:X,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,hl.useMemo)(()=>Qs({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=da({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=ya({ref:t,frameRef:o,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:N},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:G,startAngle:m,...null!=g&&{cornerRadius:g},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...os({title:F,description:E,summary:D,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:y,defaultTooltipContent:U}),...rs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return K?(0,fl.jsx)(Js,{componentName:"DonutChart",message:K,width:$,height:B}):(0,fl.jsx)(ia,{componentName:"DonutChart",width:$,height:B,children:(0,fl.jsx)(ns,{ref:o,...J})})});ml.displayName="DonutChart";var gl=require("react");function yl(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function pl(e){return Math.max(0,Math.min(1,e))}function bl(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function vl(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function xl(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:pl(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=pl(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1];if(t.offset>o||o>r.offset)continue;const i=r.offset-t.offset,s=i>0?(o-t.offset)/i:0,a=bl(t.color),l=bl(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,m]=l;return vl(c+(h-c)*s,u+(f-u)*s,d+(m-d)*s)}return n[n.length-1].color}function wl(e,t,n){return null==n?`${e}-${t}`:`${e}-${t}-${n}`}var kl=require("react/jsx-runtime"),Sl=(0,gl.forwardRef)(function(e,t){const n=Gs(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}),o=(0,gl.useRef)(null),r="context"===e.mode,{compactMode:i}=n,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:R,height:P,title:L,description:I,summary:T,accessibleTable:$}=n,B=u&&"object"==typeof u?u:void 0,H=Math.max(a,Math.min(l,s)),O=l-a||1,F=(H-a)/O,{gaugeData:E,pieceStyle:D,gaugeAnnotations:W}=(0,gl.useMemo)(()=>function(e){const{min:t,max:n,value:o,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:n,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],y=new Map,p=[];if(m){const e=a?h:1,t=wl("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(xl(c.colorStops,e*(t+.5)/n));const r=wl("fill",0);g.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(r,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],r=(o.value-e)/d,i=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=wl("fill",n);g.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=wl("bg",n);g.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&n>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),N=(0,gl.useMemo)(()=>ba(D,{stroke:C,strokeWidth:j,opacity:_}),[D,C,j,_]),{sweepRad:z,startAngleDeg:q}=yl(x),G=function(e=240){const{sweepRad:t,offsetRad:n}=yl(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const r=o.map(e=>e[0]),i=o.map(e=>e[1]),[s,a]=le(r),[l,c]=le(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(R,P)/12)),X=G.cx,Y=G.cy,U=Math.max(4,Math.min((R-2*V)/G.width,(P-2*V)/G.height)-2),K=Math.max(0,Math.min(U-1.5,U*(1-f))),Q=R/2-X*U,Z=P/2-Y*U,J=2*(U+4),ee=(0,gl.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(H,a,l):p;const e=b?b(H):Math.round(H)+"";return(0,kl.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,kl.jsx)("div",{style:{fontSize:Math.max(16,.3*U),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,kl.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,H,a,l,b,v,U,i]),te=(0,gl.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(H):Math.round(H)+""}:null,[r,p,H,b]),ne=(0,gl.useMemo)(()=>{if(!g)return null;const e=-Math.PI/2+q*Math.PI/180+F*z,t=K>20?K-8:U-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,q,F,z,K,U,y]),oe=(0,gl.useMemo)(()=>(e,t,n)=>{if("gauge-needle"===e.type){const o=(n.width||R)/2,r=(n.height||P)/2,i=Math.max(1,U-K),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,kl.jsxs)("g",{transform:`translate(${o},${r})`,children:[(0,kl.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,kl.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const o=-Math.PI/2+q*Math.PI/180+(e.value-a)/O*z,r=(n.width||R)/2,i=(n.height||P)/2,s=K-1,l=U+1,c=Math.cos(o)*s,u=Math.sin(o)*s,d=Math.cos(o)*l,h=Math.sin(o)*l,f=U+10,m=Math.cos(o)*f,g=Math.sin(o)*f,y=((o+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,kl.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,kl.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,kl.jsx)("text",{x:m,y:g,textAnchor:p,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?(0,kl.jsx)("text",{x:(n.width||R)/2,y:(n.height||P)/2-.2*K,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*U)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[R,P,a,O,q,z,K,U]),re=(0,gl.useMemo)(()=>{const e=[...W,...S||[]];return ne&&e.push(ne),te&&e.push(te),e},[W,S,ne,te]),ie=(0,gl.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,n=t?._zone||"",o=t?._isFill;return(0,kl.jsxs)("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:[(0,kl.jsx)("div",{style:{fontWeight:600},children:n}),(0,kl.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:o?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===E.length)return(0,kl.jsx)(Js,{componentName:"GaugeChart",message:"No data to display",width:R,height:P});const se={chartType:"donut",data:E,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:N,innerRadius:K,startAngle:q,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[R,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:Z-J/2,bottom:P-Z-J/2,left:Q-J/2,right:R-Q-J/2},enableHover:n.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:wr(k)||ie,svgAnnotationRules:oe,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,kl.jsx)(ia,{componentName:"GaugeChart",width:R,height:P,children:(0,kl.jsx)(ns,{ref:o,...se})})});Sl.displayName="GaugeChart";var Al=require("react"),Ml=require("react/jsx-runtime"),Cl=(0,Al.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Al.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:y=5,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,Al.useMemo)(()=>h(r),[r]),K=ma({data:U,rawData:r,colorBy:m,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:E}),Q=Ns(),Z=(0,Al.useMemo)(()=>new Map,[]),J=_a({colorBy:m,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:g,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,Al.useMemo)(()=>Ka(),[]);if(K.earlyReturn)return K.earlyReturn;const te=da({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,Ml.jsx)(Js,{componentName:"RidgelinePlot",message:te,width:F,height:E});const ne={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:y,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:f,...O&&{oFormat:O},showGrid:W,showCategoryTicks:H,oSort:!1,amplitude:d,...K.legendBehaviorProps,...os({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...is({tooltip:p,defaultTooltipContent:ee}),...rs({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,Ml.jsx)(ia,{componentName:"RidgelinePlot",width:F,height:E,children:(0,Ml.jsx)(ns,{ref:o,...ne})})});Cl.displayName="RidgelinePlot";var jl=require("react"),_l=require("react/jsx-runtime"),Rl=(0,jl.forwardRef)(function(e,t){const n=Gs(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}),o=(0,jl.useRef)(null);Ga(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:g=!0,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===f,{width:H,height:O,enableHover:F,showLegend:E,title:D,description:W,summary:N,accessibleTable:z}=n,q=B?{top:D?60:40,right:20,bottom:60,left:60}:{top:D?40:10,right:10,bottom:10,left:10},G=(0,jl.useMemo)(()=>h(r),[r]),V=u||c,X=!V,Y=ma({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:R,selection:v,linkedHover:x,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FunnelChart",chartId:A,showLegend:E,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:H,height:O});la("FunnelChart",G,"stepAccessor",a),la("FunnelChart",G,"valueAccessor",l);const U=Ns(),K=(0,jl.useMemo)(()=>new Map,[]),Q=(0,jl.useMemo)(()=>{if(X)return P||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[X,P,U,d]),Z=_a({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??P,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=(0,jl.useMemo)(()=>e=>{const t=e?.data||e,n=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",o=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,_l.jsxs)("div",{className:"semiotic-tooltip",style:pr,children:[n&&(0,_l.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),a&&a!==n&&(0,_l.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,_l.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,_l.jsxs)("div",{style:{marginTop:4},children:[o+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=da({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,_l.jsx)(Js,{componentName:"FunnelChart",message:ee,width:H,height:O});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:Z,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:m},showLabels:g,...Y.legendBehaviorProps,...D&&{title:D},...W&&{description:W},...N&&{summary:N},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===y?()=>null:!0===y||null==y?J:wr(y)||J,...rs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return(0,_l.jsx)(ia,{componentName:"FunnelChart",width:H,height:O,children:(0,_l.jsx)(ns,{ref:o,...te})})});Rl.displayName="FunnelChart";var Pl=l(require("react")),Ll=require("react"),Il=require("react"),Tl=require("react"),$l={RdBu:H,PiYG:O,PRGn:F,BrBG:E,RdYlBu:D,RdYlGn:W,Spectral:N},Bl="__likert_neutral_neg",Hl="__likert_neutral_pos";function Ol(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Fl(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function El(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Bl,__likertPct:-e}),i.push({...t,__likertLevel:Hl,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Dl(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Bl?i=n:n.__likertLevel===Hl?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}var Wl=["Very Low","Low","Neutral","High","Very High"],Nl=require("react/jsx-runtime"),zl=new Map,ql=(0,Ll.forwardRef)(function(e,t){const n=Gs(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}),o=(0,Ll.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=Wl,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:R,legendPosition:P,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showGrid:F,showLegend:E,title:D,description:W,summary:N,accessibleTable:z,categoryLabel:q,valueLabel:V}=n,Y="horizontal"===h,K=void 0===r,Q=!c,Z=function(){const e=Is();return e?.colors?.diverging||void 0}(),J=(0,Ll.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const n=$l[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(d.length,Z),[f,d.length,Z]),ee=(0,Ll.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],J[t]||"#888");return e},[d,J]),{processedData:te,reAggregate:ne,accumulatorRef:oe}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,Tl.useMemo)(()=>Ol(n,"question"),[n]),u=(0,Tl.useMemo)(()=>l?Ol(o,"score"):null,[l,o]),d=(0,Tl.useMemo)(()=>l?null:Ol(r,"level"),[l,r]),h=(0,Tl.useMemo)(()=>l?null:Ol(i,"count"),[l,i]),f=(0,Tl.useRef)([]);return{processedData:(0,Tl.useMemo)(()=>{const n=e||[];if(0===n.length)return[];let o=Fl(n,t,c,u,d,h);return s&&(o=El(o,t),o=Dl(o,t)),o},[e,t,c,u,d,h,s]),reAggregate:(0,Tl.useCallback)(e=>{let n=Fl(e,t,c,u,d,h);s&&(n=El(n,t),n=Dl(n,t)),a.current?.replace(n)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:Y,frameRef:o}),re="__likertLevelLabel",ie=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:r="right"}){const i=(0,Il.useRef)(new Set),s=(0,Il.useRef)([]),[a,l]=(0,Il.useState)(0),c=us(),u=Ns(),d=(0,Il.useCallback)(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),h=(0,Il.useCallback)(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),o=!0)}o&&l(e=>e+1)},[e,t,d]),f=(0,Il.useCallback)(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),r=s.current;r.length===o.length&&r.every((e,t)=>e===o[t])||(i.current=new Set(o),s.current=o,l(e=>e+1))},[e,t]),m=(0,Il.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,Il.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,Il.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);Rs(e&&t?s.current:[]);const p=(0,Il.useMemo)(()=>{if(!e||!t||!1===o)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:u&&u.length>0?u:G,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=U(l,a,i);return Ps({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:X})},[e,t,o,n,c,u,a]),b=(0,Il.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:E,legendPosition:P}),{wrapPush:se,wrapPushMany:ae}=ie,le=(0,Ll.useCallback)(e=>se(e=>{oe.current.push(e),ne(oe.current)})(e),[se,ne,oe]),ce=(0,Ll.useCallback)(e=>ae(e=>{oe.current.push(...e),ne(oe.current)})(e),[ae,ne,oe]);(0,Ll.useImperativeHandle)(t,()=>({push:le,pushMany:ce,remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>{oe.current=[],ie.resetCategories(),o.current?.clear()},getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}),[le,ce,oe,ie]);const ue=ma({data:te,rawData:r,colorBy:re,colorScheme:J,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:E,userMargin:i,marginDefaults:n.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:H}),de=(0,Ll.useMemo)(()=>{const e=d.length;return e%2!=0&&ee.get(d[Math.floor(e/2)])||"#888"},[d,ee]),he=_a({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:zl,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,n=e.__likertLevel||e.data?.__likertLevel;if(n===Bl||n===Hl)return{fill:de};const o=t||n;return o&&ee.has(o)?{fill:ee.get(o)}:{fill:"#888"}}}),fe=(0,Ll.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),me=(0,Ll.useMemo)(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Bl||n===Hl?fe:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Bl||n===Hl?2*i:i,a=t.__likertCount||0;return Pl.createElement("div",{className:"semiotic-tooltip",style:pr},Pl.createElement("div",{style:{fontWeight:"bold"}},r),Pl.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),ge=(0,Ll.useMemo)(()=>{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:a};return Q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),da({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,Q]),ye=(0,Ll.useMemo)(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,ee]),pe=(0,Ll.useMemo)(()=>!1!==E?{...ue.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:P||ue.legendPosition||"bottom"}:ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,P,E,ye]),be=(0,Ll.useMemo)(()=>{const e={...ue.margin};if(K&&!1!==E){const t=P||"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(ie.streamingMarginAdjust)for(const[t,n]of Object.entries(ie.streamingMarginAdjust))n>e[t]&&(e[t]=n);return Y&&100>e.left&&(e.left=100),e},[ue.margin,ie.streamingMarginAdjust,Y,K,E,P]),ve=(0,Ll.useMemo)(()=>M||(Y?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Y,M]);if(ue.earlyReturn)return ue.earlyReturn;const xe={chartType:"bar",...null!=r&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Y?"horizontal":"vertical",pieceStyle:he,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:m,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:q,rLabel:V||(Y?void 0:"Percentage"),rFormat:ve,...L&&{oFormat:L},showGrid:F,...pe,...D&&{title:D},...W&&{description:W},...N&&{summary:N},...void 0!==z&&{accessibleTable:z},...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===g?()=>null:!0===g?me:wr(g)||me,...rs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ge?(0,Nl.jsx)(Js,{componentName:"LikertChart",message:ge,width:B,height:H}):(0,Nl.jsx)(ia,{componentName:"LikertChart",width:B,height:H,children:(0,Nl.jsx)(ns,{ref:o,...xe})})});ql.displayName="LikertChart";var Gl=require("react"),Vl=require("react");var Xl=require("react/jsx-runtime"),Yl=(0,Gl.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:R,earlyReturn:P}=function(e){const t=function(e){const t=(0,Vl.useRef)(null);return Ga(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Gs(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:(0,Vl.useMemo)(()=>function(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}(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=ma({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:n.showLegend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:p,onClick:b,chartId:w,loading:k,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}),L=R.effectiveSelectionHook,I=(0,Gl.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(P)return P;const{width:T,height:$,enableHover:B,showGrid:H,title:O,description:F,summary:E,accessibleTable:D}=j,W={chartType:"custom",...null!=n&&{data:_},customLayout:o,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:B,showAxes:g,showGrid:H,annotations:y,...os({title:O,description:F,summary:E,accessibleTable:D,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rs({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...M};return(0,Xl.jsx)(ia,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,Xl.jsx)(ns,{ref:C,...W})})});Yl.displayName="OrdinalCustomChart";var Ul={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Kl=8;function Ql(e){return null==e?void 0:e+""}function Zl(e){const t=Ql(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Kl,style:{...Ul},datum:e.datum,pointId:t,_transitionKey:t}}function Jl(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...Ul},datum:e.datum,group:e.group,_transitionKey:Ql(e.id)}}