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 +1 @@
1
- import{interpolateLab as e,interpolateRgb as t}from"d3-interpolate";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{symbol as r,symbolCircle as i,symbolWye as l,symbolCross as s,symbolStar as a,symbolDiamond as c,symbolTriangle as u,symbolSquare as d}from"d3-shape";import*as h from"react";import{scaleLinear as f}from"d3-scale";function m(e){return"function"==typeof e?e:t=>t[e]}function y(e,t,n){const o=null==e?void 0:e.data,r=o?o[t]:void 0;if(null!=r)return r;const i=null==e?void 0:e[t];return null==i?n:i}function p(e,t){const n=new Map;for(const o of e){const e=t(o),r=n.get(e);r?r.push(o):n.set(e,[o])}return n}function g(e){const t=Object.create(null);return e((e,n)=>{t[e]=n}),t}function v(e,t){if(!t)return!0;const n=Array.isArray(t)?t:[t],o=e;for(const e of n)if(null!=e.value&&o[e.field]+""!=e.value+"")return!1;return!0}function x(e,t={}){var n,o,r;const i=null!==(n=t.baseOpacity)&&void 0!==n?n:1;return t.highlight||t.predicate?!v(e,t.highlight)||t.predicate&&!t.predicate(e)?null!==(r=t.dimOpacity)&&void 0!==r?r:.16:Math.min(1,i+(null!==(o=t.brighten)&&void 0!==o?o:0)):i}function b(e){return e.join("|")}class w{constructor(e=12){this.maxSize=e,this.store=new Map}get(e){return this.store.get(e)}set(e,t){this.maxSize>this.store.size||this.store.clear(),this.store.set(e,t)}getOrCompute(e,t){const n=this.store.get(e);if(void 0!==n)return n;const o=t();return this.set(e,o),o}clear(){this.store.clear()}get size(){return this.store.size}}function M(t,n=.72){const o=e(t,"#ffffff"),r=e(t,"#000000"),i=e(t,t)(0);return e=>{const t=0>e?0:e>1?1:e;return.5===t?i:.5>t?o(2*(.5-t)*n):r(2*(t-.5)*n)}}function k(e,t,n=.72){return M(e,n)(t)}const $=e=>{var t,n,o,r,i,l;const s=e.config,a=null!==(t=s.rows)&&void 0!==t?t:10,c=null!==(n=s.columns)&&void 0!==n?n:10,u=null!==(o=s.gutter)&&void 0!==o?o:2,d=a*c;if(0>=a||0>=c||0>=d)return{nodes:[]};const{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=(h.width-u*(c-1))/c,m=(h.height-u*(a-1))/a;if(0>=f||0>=m)return{nodes:[]};const y=null!==(r=null==(p=s.categoryAccessor)?null:"function"==typeof p?p:e=>e[p])&&void 0!==r?r:()=>"_default";var p;const v=null!==(i=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(s.valueAccessor))&&void 0!==i?i:()=>1,x=new Map,b=[];for(const t of e.data){const e=y(t)+"",n=Number(v(t)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(e)||b.push(e),x.set(e,(null!==(l=x.get(e))&&void 0!==l?l:0)+o)}const w=Array.from(x.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let M;if(s.categoryOrder&&s.categoryOrder.length>0){const e=new Set,t=[];for(const n of s.categoryOrder)x.has(n)&&!e.has(n)&&(e.add(n),t.push(n));M=[...t,...b.filter(t=>!e.has(t))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(e=>{var t;return{cat:e,exact:(null!==(t=x.get(e))&&void 0!==t?t:0)/w*d}}),$=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),A=$.reduce((e,t)=>e+t.count,0),N=$.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;d-A>e;e++)$[N[e%N.length].i].count+=1;const S="string"==typeof s.categoryAccessor?s.categoryAccessor:"category",C="string"==typeof s.valueAccessor?s.valueAccessor:"value",O=(e,t,n)=>g(o=>{var r,i;o("category",e),o("value",null!==(r=x.get(e))&&void 0!==r?r:0),"category"!==S&&o(S,e),"value"!==C&&o(C,null!==(i=x.get(e))&&void 0!==i?i:0),o("cells",n),o("_waffleCategory",e),o("_waffleIndex",t)}),z=[];let W=0;for(const t of $){const n=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)z.push({type:"rect",x:h.x+W%c*(f+u),y:h.y+(a-1-Math.floor(W/c))*(m+u),w:f,h:m,style:{fill:n,stroke:"none"},datum:O(t.cat,W,t.count),group:t.cat}),W++}return{nodes:z}},A=864e5,N=e=>{var n,o,r,i,l,s,a,c;const u=e.config,{plot:d}=e.dimensions;if(0>=d.width||0>=d.height)return{nodes:[]};const h=e=>{const t="function"==typeof u.dateAccessor?u.dateAccessor(e):e[u.dateAccessor];return t instanceof Date?t:new Date(t)},f=e=>{const t="function"==typeof u.valueAccessor?u.valueAccessor(e):e[u.valueAccessor];return Number(t)},m=new Map;let y=null;for(const t of e.data){const e=h(t);if(!isFinite(e.getTime()))continue;null==y&&(y=e.getUTCFullYear());const o=S(e),r=f(t);m.set(o,(null!==(n=m.get(o))&&void 0!==n?n:0)+(Number.isFinite(r)?r:0))}const p=null!==(r=null!==(o=u.year)&&void 0!==o?o:y)&&void 0!==r?r:(new Date).getUTCFullYear();let g=1/0,v=-1/0;for(const e of m.values())g>e&&(g=e),e>v&&(v=e);g===1/0&&(g=0,v=0);const[x,b]=null!==(i=u.colorRamp)&&void 0!==i?i:[null!==(l=e.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=e.theme.semantic.primary)&&void 0!==s?s:"#216e39"],w=e=>{if(v===g)return x;const n=(e-g)/(v-g);return t(x,b)(n)},M=null!==(a=u.gutter)&&void 0!==a?a:2,k=null!==(c=u.labelInset)&&void 0!==c?c:0,$=Math.min((d.width-k-53*M)/54,(d.height-6*M)/7);if(0>=$)return{nodes:[]};const N=new Date(Date.UTC(p,0,1)),C=N.getUTCDay(),O=new Date(N.getTime()-C*A),z=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const n=new Date(O.getTime()+(7*e+t)*A);if(n.getUTCFullYear()!==p)continue;const o=S(n),r=m.get(o),i=null==r?x:w(r);z.push({type:"rect",x:d.x+k+e*($+M),y:d.y+t*($+M),w:$,h:$,style:{fill:i,stroke:"none"},datum:{date:n,value:null!=r?r:0}})}return{nodes:z}};function S(e){return`${e.getUTCFullYear()}-${C(e.getUTCMonth()+1)}-${C(e.getUTCDate())}`}function C(e){return 10>e?"0"+e:e+""}const O=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",m=null!==(r=u.edgeCurve)&&void 0!==r?r:"curved",p=!1!==u.showLabels,g=null!==(i=u.labelAccessor)&&void 0!==i?i:"id",v="function"==typeof g?g:e=>{var t;return y(e,g,null!==(t=e.id)&&void 0!==t?t:"")+""},x=new Map,b=[],w=[],M=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:r,h:i}=M(t);null!=n&&null!=o&&(x.set(t.id,{x:n,y:o,w:r,h:i}),b.push({type:"rect",x:n-r/2,y:o-i/2,w:r,h:i,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:v(t)+""}),p&&w.push({x:n,y:o,text:v(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const k=[];for(const t of e.edges){const n="string"==typeof t.target?t.target:t.target.id,o=x.get("string"==typeof t.source?t.source:t.source.id),r=x.get(n);if(!o||!r)continue;const i="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:r.x,y:r.y-r.h/2}:{x:r.x-r.w/2,y:r.y};if("line"===m)k.push({type:"line",x1:i.x,y1:i.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:t});else{const n=(i.y+l.y)/2,o=(i.x+l.x)/2;k.push({type:"curved",pathD:"vertical"===f?`M${i.x},${i.y} C${i.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${i.x},${i.y} C${o},${i.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:b,sceneEdges:k,labels:w}},z=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"label",g="function"==typeof p?p:e=>{var t;return y(e,p,null!==(t=e.id)&&void 0!==t?t:"")+""},v=new Map,x=[],b=[],w=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:r,h:s}=w(t);null!=n&&null!=o&&(v.set(t.id,{x:n,y:o,w:r,h:s}),x.push({type:"rect",x:n-r/2,y:o-s/2,w:r,h:s,style:{fill:null!==(i=u.nodeFill)&&void 0!==i?i:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),m&&b.push({x:n,y:o,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#666"})`,k=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,n=v.get("string"==typeof t.source?t.source:t.source.id),o=v.get(e);if(!n||!o)continue;const r=null!==(c=t.data)&&void 0!==c?c:{},i=Array.isArray(r.points)?r.points:t.points;if(i&&i.length>=2)if("smooth"!==f||3>i.length){const e="M"+i.map(e=>`${e.x},${e.y}`).join(" L ");k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${i[0].x},${i[0].y}`;for(let t=1;i.length-1>t;t++)e+=` Q${i[t].x},${i[t].y} ${(i[t].x+i[t+1].x)/2},${(i[t].y+i[t+1].y)/2}`;const n=i[i.length-1];e+=` T${n.x},${n.y}`,k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else k.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:M,strokeWidth:1},datum:t})}return{sceneNodes:x,sceneEdges:k,labels:b}},W={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},F={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function j(e){return Array.isArray(e)?e.map((e,t)=>{var n,o;return"string"==typeof e?{storeName:e,slotIndex:t}:{storeName:(null!==(n=e.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=e.slotIndex)&&void 0!==o?o:t}}):[]}const I=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,p,g,v,x,b,w,M,k,$,A,N,S,C;const O=e.config||{},z=e.dimensions.plot,I=null!==(t=O.layerAccessor)&&void 0!==t?t:"x",L=null!==(r=O.rowAccessor)&&void 0!==r?r:"y",E=null!==(i=O.partitionAccessor)&&void 0!==i?i:"partition",Y=null!==(l=O.semanticAccessor)&&void 0!==l?l:"semantic",D=null!==(s=O.labelAccessor)&&void 0!==s?s:"label",P=null!==(a=O.storesAccessor)&&void 0!==a?a:"stores",T=null!==(c=O.backEdgeAccessor)&&void 0!==c?c:"isBackEdge",X=null!==(u=O.edgeTypeAccessor)&&void 0!==u?u:"edgeType",R=Object.assign(Object.assign({},W),O.partitionColors),V=Object.assign(Object.assign({},F),O.edgeColors),B=null!==(d=O.accentColor)&&void 0!==d?d:"var(--semiotic-focus, #ffcc33)",H=null!==(h=O.borderColor)&&void 0!==h?h:"var(--semiotic-border, #555)",G=null!==(f=O.dimOpacity)&&void 0!==f?f:.14,q=null!==(m=O.edgeOpacity)&&void 0!==m?m:.5,U=null!==(p=O.edgeWidth)&&void 0!==p?p:1.25,_=null!==(v=null!==(g=O.backEdgeWidth)&&void 0!==g?g:O.edgeWidth)&&void 0!==v?v:1.5,K=!1!==O.showStoreChips,J=null!==(x=O.storeChipColor)&&void 0!==x?x:"var(--semiotic-info, #6a8caf)";let Q=O.layerCount,Z=O.maxLayerSize;if(null==Q||null==Z){let t=0;const n=new Map;for(const o of e.nodes){const e=Math.round(Number(y(o,I,0)));t=Math.max(t,e),n.set(e,(null!==(b=n.get(e))&&void 0!==b?b:0)+1)}Q=null!=Q?Q:t+1,Z=null!=Z?Z:Math.max(1,...n.values())}const ee=z.width/Math.max(1,Q),te=z.height/Math.max(1,Z);let ne=Math.min(null!==(w=O.nodeWidth)&&void 0!==w?w:172,Math.max(8,ee-(null!==(M=O.minGapX)&&void 0!==M?M:26))),oe=Math.min(null!==(k=O.nodeHeight)&&void 0!==k?k:54,Math.max(8,te-(null!==($=O.minGapY)&&void 0!==$?$:18)));const re=O.lod&&"auto"!==O.lod?O.lod:16>ne?"dot":48>ne?"icon":108>ne?"compact":"full";if("dot"===re){const e=Math.min(ne,oe,11);ne=e,oe=e}const ie=Math.max(1,z.width-ne),le=Math.max(1,z.height-oe),se=Math.max(1,Z-1),ae=e=>z.x+ne/2+(Q>1?e/(Q-1):.5)*ie,ce=e=>z.y+oe/2+(e+se/2)/se*le,ue=O.reachableIds?new Set(O.reachableIds):null,de=null!==(A=O.selectedId)&&void 0!==A?A:null,he=e.selection,fe=new Map,me=new Map,ye=[],pe=[];for(const t of e.nodes){const e=t.id,n=Number(y(t,I,0)),o=Number(y(t,L,0)),r=y(t,E,"processor")+"",i=y(t,Y,"processor")+"",l=y(t,D,e)+"",s=j(y(t,P,[])),a=null!==(N=t.data)&&void 0!==N?N:t,c=ae(n),u=ce(o);fe.set(e,{cx:c,cy:u});const d=ue?ue.has(e):null,h=(null==he?void 0:he.isActive)?he.predicate(a):null,f=null!==d?!d:null!==h&&!h;me.set(e,f);const m=null!=de&&e===de,p=f&&!m?G:1,g=null!==(S=R[r])&&void 0!==S?S:R.unknown;"dot"===re?ye.push({type:"circle",cx:c,cy:u,r:ne/2,style:{fill:g,opacity:p,stroke:m?B:"transparent",strokeWidth:m?2:0},datum:t,id:e,label:l}):(ye.push({type:"rect",x:c-ne/2,y:u-oe/2,w:ne,h:oe,style:{fill:g,opacity:p,stroke:m?B:H,strokeWidth:m?3:1},datum:t,id:e,label:l}),pe.push({id:e,cx:c,cy:u,partition:r,semantic:i,label:l,stores:s,opacity:p,selected:m,node:a}))}const ge=[];for(const t of e.edges){const e="string"==typeof t.source?t.source:t.source.id,n="string"==typeof t.target?t.target:t.target.id,o=fe.get(e),r=fe.get(n);if(!o||!r)continue;const i=!!y(t,T,!1),l=y(t,X,"internal")+"",s=me.get(e)||me.get(n)?Math.min(q,1.4*G):q,a=i?V.back:null!==(C=V[l])&&void 0!==C?C:V.internal;let c;if(i){const e=o.cx,t=o.cy+oe/2,n=r.cx,i=r.cy+oe/2,l=Math.max(48,.28*Math.abs(e-n))+oe;c=`M${e},${t} C${e},${t+l} ${n},${i+l} ${n},${i}`}else{const e=o.cx+ne/2,t=o.cy,n=r.cx-ne/2,i=r.cy,l=(e+n)/2;c=`M${e},${t} C${l},${t} ${l},${i} ${n},${i}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:i?_:U,fill:"none",opacity:s},i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:t};ge.push(u)}const ve=0===pe.length?null:n("g",{className:"lineage-dag-glyphs",children:pe.map(e=>function(e,t){var r,i;const{w:l,h:s,lod:a}=t,c="icon"===a?Math.min(l,s):Math.min(s-14,26),u=null!==(i=null!==(r=t.partColors[e.partition])&&void 0!==r?r:t.partColors.unknown)&&void 0!==i?i:"#5a5a6a",d="icon"===a?0:8+c+8,h=null!=t.renderIcon?t.renderIcon({semantic:e.semantic,partition:e.partition,size:c,color:u,node:e.node}):function(e,t,r){var i;const l=t.startsWith("topic")?"T":null!==(i={source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[e])&&void 0!==i?i:"PR";return o("g",{children:[n("rect",{width:r,height:r,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),n("text",{x:r/2,y:r/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*r,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:l})]})}(e.semantic,e.partition,c),f="full"===a,m="icon"!==a,y="full"===a&&t.showChips&&e.stores.length>0;return o("g",{transform:`translate(${e.cx-l/2}, ${e.cy-s/2})`,opacity:e.opacity,style:{pointerEvents:"none"},children:[n("g",{transform:`translate(${"icon"===a?(l-c)/2:8}, ${(s-c)/2})`,children:h}),m&&n("foreignObject",{x:d,y:f?s/2-12:s/2-9,width:Math.max(8,l-d-8),height:18,style:{pointerEvents:"none"},children:n("div",{title:e.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===a?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label})}),f&&n("text",{x:d,y:s/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:t.typeLabel?t.typeLabel({semantic:e.semantic,partition:e.partition,node:e.node}):e.partition.startsWith("topic")?"topic":e.semantic}),y&&e.stores.map((e,o)=>n("rect",{x:d+15*o,y:s-10,width:12,height:5,rx:1.5,fill:t.chipColor,children:n("title",{children:e.storeName})},e.storeName+o))]},e.id)}(e,{w:ne,h:oe,lod:re,partColors:R,chipColor:J,showChips:K,renderIcon:O.renderIcon,typeLabel:O.typeLabel}))});return{sceneNodes:ye,sceneEdges:ge,overlays:ve}};function L(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+"…":e}const E={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Y(e,t,r,i,l,s,a,c){const u=t-i/2,d=r-l/2,h={fill:s,stroke:a,strokeWidth:c};switch(e){case"diamond":return n("polygon",Object.assign({points:`${t},${d} ${t+i/2},${r} ${t},${r+l/2} ${u},${r}`},h));case"circle":return n("circle",Object.assign({cx:t,cy:r,r:Math.min(i,l)/2},h));case"stadium":case"round":return n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:"stadium"===e?l/2:8,ry:"stadium"===e?l/2:8},h));case"hexagon":{const e=Math.min(.18*i,16);return n("polygon",Object.assign({points:`${u+e},${d} ${t+i/2-e},${d} ${t+i/2},${r} ${t+i/2-e},${r+l/2} ${u+e},${r+l/2} ${u},${r}`},h))}case"cylinder":{const e=Math.min(.16*l,8),t=`M${u},${d+e} a${i/2},${e} 0 0 1 ${i},0`;return o("g",{children:[n("path",Object.assign({d:`M${u},${d+e} a${i/2},${e} 0 0 0 ${i},0 v${l-2*e} a${i/2},${e} 0 0 1 ${-i},0 z`},h)),n("path",{d:t,fill:"none",stroke:a,strokeWidth:c})]})}case"subroutine":{const e=Math.min(8,.08*i);return o("g",{children:[n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:3},h)),n("line",{x1:u+e,y1:d,x2:u+e,y2:d+l,stroke:a,strokeWidth:c}),n("line",{x1:u+i-e,y1:d,x2:u+i-e,y2:d+l,stroke:a,strokeWidth:c})]})}default:return n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:4},h))}}const D=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,p;const g=e.config||{},v=e.dimensions.plot,x=null!==(t=g.direction)&&void 0!==t?t:"TD",b="LR"===x||"RL"===x,w="BT"===x||"RL"===x,M=null!==(r=g.layerAccessor)&&void 0!==r?r:"layer",k=null!==(i=g.rowAccessor)&&void 0!==i?i:"row",$=null!==(l=g.labelAccessor)&&void 0!==l?l:"label",A=null!==(s=g.shapeAccessor)&&void 0!==s?s:"shape",N=null!==(a=g.edgeLabelAccessor)&&void 0!==a?a:"label",S=null!==(c=g.nodeFill)&&void 0!==c?c:"var(--semiotic-surface, #20242d)",C=null!==(u=g.nodeStroke)&&void 0!==u?u:"var(--semiotic-border, #5a6573)",O=null!==(d=g.textColor)&&void 0!==d?d:"var(--semiotic-text, #e6e6e6)",z=null!==(h=g.edgeColor)&&void 0!==h?h:"var(--semiotic-text-secondary, #9aa0a6)",W=null!==(f=g.accentColor)&&void 0!==f?f:"var(--semiotic-warning, #d49a00)";if(0===e.nodes.length)return{sceneNodes:[],overlays:null};const F=new Map;let j=0;for(const t of e.nodes){const e=Math.round(Number(y(t,M,0)));j=Math.max(j,e);const n=F.get(e)||[];n.push(t),F.set(e,n)}const I=j+1;let D=1;for(const e of F.values())e.sort((e,t)=>Number(y(e,k,0))-Number(y(t,k,0))),D=Math.max(D,e.length);const P=b?v.width:v.height,T=b?v.height:v.width,X=P/I,R=T/(D+1),V=Math.max(44,Math.min(null!==(m=g.nodeWidth)&&void 0!==m?m:150,b?X-36:.92*R)),B=Math.max(26,Math.min(null!==(p=g.nodeHeight)&&void 0!==p?p:46,b?.7*R:.5*X)),H=(b?V:B)/2+6,G=Math.max(1,P-2*H),q=e=>(b?v.x:v.y)+H+(I>1?(w?I-1-e:e)/(I-1)*G:G/2),U=new Map,_=[],K=[];for(const[e,t]of F)t.forEach((r,i)=>{var l;const s=q(e),a=(b?v.y:v.x)+(i+1)/(t.length+1)*T,c=b?s:a,u=b?a:s,d=y(r,A,"rect")+"",h=y(r,$,r.id)+"";U.set(r.id,{cx:c,cy:u,shape:d}),_.push({type:"rect",x:c-V/2,y:u-B/2,w:V,h:B,style:{fill:"transparent",stroke:"transparent"},datum:{id:r.id,name:h,type:null!==(l=E[d])&&void 0!==l?l:"process",shape:d},id:r.id,label:h}),K.push(o("g",{children:[Y(d,c,u,V,B,S,"diamond"===d?W:C,1.5),n("text",{x:c,y:u,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:O,style:{pointerEvents:"none"},children:L(h,Math.max(4,Math.floor((V-12)/7)))})]},"n-"+r.id))});const J=[];e.edges.forEach((e,t)=>{const r="string"==typeof e.target?e.target:e.target.id,i=U.get("string"==typeof e.source?e.source:e.source.id),l=U.get(r);if(!i||!l)return;const s=b?i.cx+V/2:i.cx,a=b?i.cy:i.cy+B/2,c=b?l.cx-V/2:l.cx,u=b?l.cy:l.cy-B/2,d=b?`M${s},${a} C${(s+c)/2},${a} ${(s+c)/2},${u} ${c},${u}`:`M${s},${a} C${s},${(a+u)/2} ${c},${(a+u)/2} ${c},${u}`,h=Math.atan2(u-a,c-s),f=c-9*Math.cos(h),m=u-9*Math.sin(h),p=4.5*-Math.sin(h),g=4.5*Math.cos(h),v=`${c},${u} ${f+p},${m+g} ${f-p},${m-g}`,x=y(e,N,void 0),w=(s+c)/2,M=(a+u)/2;J.push(o("g",{children:[n("path",{d:d,fill:"none",stroke:z,strokeWidth:1.4}),n("polygon",{points:v,fill:z}),"string"==typeof x&&x.length>0&&o("g",{children:[n("rect",{x:w-6.5*x.length/2-4,y:M-9,width:6.5*x.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:C,strokeWidth:.75}),n("text",{x:w,y:M,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:O,style:{pointerEvents:"none"},children:x})]})]},"e-"+t))});const Q=o("g",{className:"mermaid-dag",children:[J,K]});return{sceneNodes:_,overlays:Q}},P={circle:i,square:d,triangle:u,diamond:c,star:a,cross:s,wye:l},T=["circle","triangle","diamond","star","square","chevron","cross","wye"];function X(e,t,n){var o,l;if(n)return n;const s=null!=e?e:"circle";if("chevron"===s)return function(e){const t=1.5*R(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=P[s])&&void 0!==o?o:i;return null!==(l=r(a,Math.max(1,t))())&&void 0!==l?l:""}function R(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const V=new Map;function B(e,t,n){if(!n&&"circle"===(null!=e?e:"circle"))return R(t);const o=n?"p:"+n:`${e}:${Math.round(t)}`,r=V.get(o);if(null!=r)return r;const i=(null!=n?n:X(e,t)).match(/-?\d*\.?\d+(?:e-?\d+)?/gi);let l=0;if(i)for(let e=0;i.length>e+1;e+=2){const t=+i[e],n=+i[e+1],o=Math.sqrt(t*t+n*n);o>l&&(l=o)}return l>0||(l=R(t)),V.size>512&&V.clear(),V.set(o,l),l}function H(e){var t,o,r,i,l;return n("rect",{className:e.className,x:e.x,y:e.y,width:Math.max(0,e.width),height:Math.max(0,e.height),rx:null!==(t=e.radius)&&void 0!==t?t:10,ry:null!==(o=e.radius)&&void 0!==o?o:10,fill:null!==(r=e.fill)&&void 0!==r?r:"none",stroke:e.stroke,strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1.5,strokeDasharray:e.strokeDasharray,opacity:null!==(l=e.opacity)&&void 0!==l?l:.6,style:{pointerEvents:"none"}},e.keyId)}function G(e,t=0){var n;let o=1/0,r=1/0,i=-1/0,l=-1/0;for(const t of e){const e=null!==(n=t.r)&&void 0!==n?n:0;o>t.x-e&&(o=t.x-e),t.x+e>i&&(i=t.x+e),r>t.y-e&&(r=t.y-e),t.y+e>l&&(l=t.y+e)}return Number.isFinite(o)?{x:o-t,y:r-t,width:i-o+2*t,height:l-r+2*t}:null}function q(e){var t,o,r;const i=null!==(t=e.fontSize)&&void 0!==t?t:12;return null!=e.maxWidth&&e.text.length*i*.56>e.maxWidth?null:n("text",{className:e.className,x:e.x,y:e.y,textAnchor:null!==(o=e.anchor)&&void 0!==o?o:"middle",dominantBaseline:null!==(r=e.baseline)&&void 0!==r?r:"middle",fontSize:i,fontWeight:e.fontWeight,fill:e.color,style:{pointerEvents:"none"},children:e.text},e.keyId)}function U(e){var t,r,i,l,s,a,c;const u=null!==(t=e.stroke)&&void 0!==t?t:"var(--semiotic-text, #f4f4f8)",d=null!==(r=e.strokeWidth)&&void 0!==r?r:1,h=null!==(i=e.markRadius)&&void 0!==i?i:0,f=e.labelX-e.markX,m=e.labelY-e.markY,y=Math.hypot(f,m)||1,p=e.markX+f/y*h,g=e.markY+m/y*h;let v;return v="elbow"===e.connector?`M${p},${g} L${p},${e.labelY} L${e.labelX},${e.labelY}`:"curve"===e.connector?`M${p},${g} Q${(p+e.labelX)/2},${g} ${e.labelX},${e.labelY}`:`M${p},${g} L${e.labelX},${e.labelY}`,o("g",{className:e.className,style:{pointerEvents:"none"},children:[h>0&&n("circle",{cx:e.markX,cy:e.markY,r:h,fill:"none",stroke:u,strokeWidth:d}),n("path",{d:v,fill:"none",stroke:u,strokeWidth:d}),n("text",{x:e.labelX,y:e.labelY,textAnchor:null!==(l=e.labelAnchor)&&void 0!==l?l:"middle",dominantBaseline:null!==(s=e.labelBaseline)&&void 0!==s?s:"hanging",fontSize:null!==(a=e.fontSize)&&void 0!==a?a:11,fontWeight:e.fontWeight,fill:null!==(c=e.color)&&void 0!==c?c:u,children:e.label})]},e.keyId)}const _=new w(12);function K(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const t=e+"",n=Number(t);if(!Number.isNaN(n)&&""!==t.trim())return n;const o=Date.parse(t);return Number.isNaN(o)?NaN:o}function J(e,t,n){return t>e?t:e>n?n:e}const Q=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,g,v,w,k,$,A,N,S,C,O,z,W,F,j,I,L,E,Y,D,P,R,V,G,Q,te,ne,oe,re,ie,le;const se=e.config||{},ae=e.dimensions.plot,ce=null!==(t=se.columnAccessor)&&void 0!==t?t:"column",ue=null!==(r=se.rowAccessor)&&void 0!==r?r:"row",de=se.sizeAccessor,he=se.colorAccessor,fe=se.symbolAccessor,me=se.shadeAccessor,ye=se.markerAccessor,pe=se.iconAccessor,ge=null!==(i=se.defaultSymbol)&&void 0!==i?i:"circle",[ve,xe]=null!==(l=se.sizeRange)&&void 0!==l?l:[2,8],be=null!==(s=se.shadeStrength)&&void 0!==s?s:.72,we=null!==(a=se.shadeReverse)&&void 0!==a&&a,Me=null!==(c=se.rowMode)&&void 0!==c?c:"banded",ke=null!==(u=se.cellSizing)&&void 0!==u?u:"proportional",$e=null!==(d=se.proportionExponent)&&void 0!==d?d:1,Ae=null!==(h=se.columnGap)&&void 0!==h?h:16,Ne=null!==(f=se.rowGap)&&void 0!==f?f:12,Se=null!==(m=se.packPadding)&&void 0!==m?m:1,Ce=null!==(g=se.iterations)&&void 0!==g?g:12,Oe=!1!==se.showEnclosures,ze=!1!==se.showColumnHeaders,We=!1!==se.showRowLabels,Fe=ze?null!==(v=se.headerHeight)&&void 0!==v?v:26:0,je=We?null!==(w=se.labelWidth)&&void 0!==w?w:66:0,Ie=se.callouts&&se.callouts.length>0?null!==(k=se.footerHeight)&&void 0!==k?k:30:0,Le=ae.x+je,Ee=ae.y+Fe,Ye=Math.max(1,ae.width-je),De=Math.max(1,ae.height-Fe-Ie),Pe=[];for(const t of e.nodes){const e=null!==($=t.data)&&void 0!==$?$:t;Pe.push({id:t.id,col:y(t,ce,"—")+"",row:y(t,ue,"—")+"",sizeVal:de?Number(y(t,de,1)):1,colorKey:he?y(t,he,"")+"":"",symVal:fe?y(t,fe,"")+"":"",shadeVal:me?K(y(t,me,null)):NaN,marker:!!ye&&!!y(t,ye,!1),iconVal:pe?y(t,pe,"")+"":"",datum:e,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===Pe.length)return{sceneNodes:[]};let Te=1/0,Xe=-1/0;if(de)for(const e of Pe)Number.isFinite(e.sizeVal)&&(Te>e.sizeVal&&(Te=e.sizeVal),e.sizeVal>Xe&&(Xe=e.sizeVal));se.sizeDomain&&([Te,Xe]=se.sizeDomain),Number.isFinite(Te)&&Number.isFinite(Xe)||(Te=0,Xe=1);const Re=e=>{if(Te>=Xe)return(ve+xe)/2;const t=Math.sqrt(J((e-Te)/(Xe-Te),0,1));return ve+t*(xe-ve)};let Ve=1/0,Be=-1/0;if(me)for(const e of Pe)Number.isFinite(e.shadeVal)&&(Ve>e.shadeVal&&(Ve=e.shadeVal),e.shadeVal>Be&&(Be=e.shadeVal));se.shadeDomain&&([Ve,Be]=se.shadeDomain);const He=e=>{if(!me||!Number.isFinite(e)||Ve>=Be)return.5;const t=J((e-Ve)/(Be-Ve),0,1);return we?1-t:t},Ge=se.colorMap,qe=new Map,Ue=(t,n)=>{let o=qe.get(t);return o||(o=M(Ge&&Ge[t]||e.resolveColor(t),be),qe.set(t,o)),o(n)},_e=new Map;if(se.symbolMap)for(const[e,t]of Object.entries(se.symbolMap))_e.set(e,t);let Ke=0;const Je=se.iconMap,Qe=e=>pe&&Je&&Je[e]?Je[e]:null,Ze=e=>pe?"circle":(e=>{if(!fe)return ge;let t=_e.get(e);return t||(t=T[Ke%T.length],Ke++,_e.set(e,t)),t})(e.symVal),et=null!==(A=se.maxAreaFraction)&&void 0!==A?A:.4;let tt=0;const nt=Array(Pe.length),ot=Array(Pe.length);for(let e=0;Pe.length>e;e++){const t=Pe[e],n=Re(t.sizeVal);nt[e]=n,t.baseShape=Ze(t),t.iconShape=Qe(t.iconVal);const o=B(t.baseShape,Math.PI*n*n);ot[e]=o,tt+=Math.PI*o*o}const rt=et*Ye*De,it=tt>rt?Math.sqrt(rt/tt):1;for(let e=0;Pe.length>e;e++){const t=Pe[e],n=nt[e]*it;t.size=Math.PI*n*n,t.packR=ot[e]*it}const lt=new Map,st=new Map;for(const e of Pe)lt.set(e.col,(null!==(N=lt.get(e.col))&&void 0!==N?N:0)+1),st.set(e.row,(null!==(S=st.get(e.row))&&void 0!==S?S:0)+1);const at=null!==(O=null===(C=se.columnOrder)||void 0===C?void 0:C.filter(e=>lt.has(e)))&&void 0!==O?O:[...lt.keys()].sort((e,t)=>{var n,o;return(null!==(n=lt.get(t))&&void 0!==n?n:0)-(null!==(o=lt.get(e))&&void 0!==o?o:0)}),ct=null!==(W=null===(z=se.rowOrder)||void 0===z?void 0:z.filter(e=>st.has(e)))&&void 0!==W?W:[...st.keys()].sort((e,t)=>{var n,o;return(null!==(n=st.get(t))&&void 0!==n?n:0)-(null!==(o=st.get(e))&&void 0!==o?o:0)}),ut=b([Math.round(ae.x),Math.round(ae.y),Math.round(ae.width),Math.round(ae.height),Fe,je,Ie,Me,ke,$e,Ae,Ne,Se,Ce,ve,xe,Te,Xe,et,at.join(","),ct.join(","),Pe.length,ee(Pe)]),dt=_.getOrCompute(ut,()=>function(e,t){var n;const o=new Map;for(const t of e){let e=o.get(t.col);e||(e=[],o.set(t.col,e)),e.push(t)}const r=t.columnOrder.filter(e=>o.has(e)),i=Math.max(1,t.innerW-t.columnGap*Math.max(0,r.length-1)),l=t.proportionExponent,s=r.map(e=>Math.pow(o.get(e).length,l)),a=s.reduce((e,t)=>e+t,0)||1,c=e=>"uniform"===t.cellSizing?i/r.length:s[e]/a*i,u=new Map,d=[];let h=t.innerX;for(let e=0;r.length>e;e++)d.push({col:r[e],x:h,w:c(e)}),h+=c(e)+t.columnGap;let f=1;const m=new Map,y=[],g=(e,t,n,o)=>{let r=m.get(e);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(e,r)),r.minX>t-o&&(r.minX=t-o),t+o>r.maxX&&(r.maxX=t+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},v=(e,n,o,r,i,l)=>{const s=e.map(e=>({id:e.id,r:e.packR})),a=function(e,t,n,o,r,i,l,s){const a=t+o/2,c=n+r/2,u=new Map,d=e.length;if(0===d)return u;if(1===d)return u.set(e[0].id,{px:a,py:c}),u;const h=function(e){let t=e>>>0||1;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}(s),f=new Float64Array(d);let m=0;for(let t=0;d>t;t++)f[t]=e[t].r+i,f[t]>m&&(m=f[t]);const y=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),p=new Float64Array(d),g=new Float64Array(d),v=o/y,x=r/Math.ceil(d/y);for(let e=0;d>e;e++){const o=e%y,r=Math.floor(e/y);p[e]=t+(o+.3+.4*h())*v,g[e]=n+(r+.3+.4*h())*x}const b=Math.max(0,Math.min(l,14)),w=Math.max(1,2*m),M=new Map,k=Math.max(1,Math.ceil(o/w)+3),$=(e,t)=>(t+1)*k+(e+1);for(let e=0;b>e;e++){M.clear();for(let e=0;d>e;e++){const o=$(Math.floor((p[e]-t)/w),Math.floor((g[e]-n)/w)),r=M.get(o);r?r.push(e):M.set(o,[e])}for(let e=0;d>e;e++){const o=Math.floor((p[e]-t)/w),r=Math.floor((g[e]-n)/w);for(let t=-1;1>=t;t++)for(let n=-1;1>=n;n++){const i=M.get($(o+t,r+n));if(i)for(let t=0;i.length>t;t++){const n=i[t];if(e>=n)continue;let o=p[n]-p[e],r=g[n]-g[e];const l=f[e]+f[n],s=o*o+r*r;if(l*l>s)if(s>1e-9){const t=Math.sqrt(s),i=(l-t)/2;o/=t,r/=t,p[e]-=o*i,g[e]-=r*i,p[n]+=o*i,g[n]+=r*i}else{const t=2.39996323*e;p[e]+=Math.cos(t)*f[e],g[e]+=Math.sin(t)*f[e]}}}}for(let e=0;d>e;e++){const i=f[e],l=t+i,s=t+o-i,u=n+i,d=n+r-i;p[e]=s>l?J(p[e],l,s):a,g[e]=d>u?J(g[e],u,d):c}}for(let t=0;d>t;t++)u.set(e[t].id,{px:p[t],py:g[t]});return u}(s,n,o,r,i,t.packPadding,t.iterations,f++);let c=1/0,d=1/0,h=-1/0,m=-1/0;for(const e of s){const t=a.get(e.id);u.set(e.id,{px:t.px,py:t.py}),g(l,t.px,t.py,e.r),c>t.px-e.r&&(c=t.px-e.r),t.px+e.r>h&&(h=t.px+e.r),d>t.py-e.r&&(d=t.py-e.r),t.py+e.r>m&&(m=t.py+e.r)}return Number.isFinite(c)?{x:c-Z,y:d-Z,w:h-c+2*Z,h:m-d+2*Z}:null};if("banded"===t.rowMode){const i=new Map;for(const t of e)i.set(t.row,(null!==(n=i.get(t.row))&&void 0!==n?n:0)+1);const s=t.rowOrder.filter(e=>i.has(e)),a=Math.max(1,t.innerH-t.rowGap*Math.max(0,s.length-1)),c=s.map(e=>Math.pow(i.get(e),l)),h=c.reduce((e,t)=>e+t,0)||1,f=new Map;let y=t.innerY+t.innerH;for(let e=0;s.length>e;e++){const n="uniform"===t.cellSizing?a/s.length:c[e]/h*a,o=y-n;f.set(s[e],{y:o,h:n}),y=o-t.rowGap}r.forEach((e,t)=>{const n=p(o.get(e),e=>e.row);for(const e of s){const o=n.get(e),r=f.get(e);o&&r&&v(o,d[t].x,r.y,d[t].w,r.h,e)}});const g=[],x=new Map;for(const e of s){const t=f.get(e);x.set(e,t.y+t.h/2);const n=m.get(e);n&&Number.isFinite(n.minX)&&g.push({x:n.minX-Z,y:n.minY-Z,w:n.maxX-n.minX+2*Z,h:n.maxY-n.minY+2*Z})}return{positions:u,enclosures:g,colBands:d,rowLabelY:x}}const x=new Map;r.forEach((e,n)=>{const r=p(o.get(e),e=>e.row),i=t.rowOrder.filter(e=>r.has(e)),s=Math.max(1,t.innerH-t.rowGap*Math.max(0,i.length-1)),a=i.map(e=>Math.pow(r.get(e).length,l)),c=a.reduce((e,t)=>e+t,0)||1;let u=t.innerY+t.innerH;i.forEach((e,o)=>{var l;const h="uniform"===t.cellSizing?s/i.length:a[o]/c*s,f=u-h,m=v(r.get(e),d[n].x,f,d[n].w,h,e);if(m){y.push(m);const t=null!==(l=x.get(e))&&void 0!==l?l:{sum:0,n:0};t.sum+=m.y+m.h/2,t.n+=1,x.set(e,t)}u=f-t.rowGap})});const b=new Map;for(const[e,t]of x)b.set(e,t.sum/t.n);return{positions:u,enclosures:y,colBands:d,rowLabelY:b}}(Pe,{columnOrder:at,rowOrder:ct,innerX:Le,innerY:Ee,innerW:Ye,innerH:De,rowMode:Me,cellSizing:ke,proportionExponent:$e,columnGap:Ae,rowGap:Ne,packPadding:Se,iterations:Ce})),ht=e.selection,ft=(null==ht?void 0:ht.isActive)?ht.predicate:null,mt=null!==(F=se.highlight)&&void 0!==F?F:null,yt=null!==(j=se.dimOpacity)&&void 0!==j?j:.16,pt=se.markStroke,gt=null!==(I=se.markStrokeWidth)&&void 0!==I?I:0,vt=null!==(L=se.markerColor)&&void 0!==L?L:"#ffffff",xt=null!==(E=se.iconColor)&&void 0!==E?E:"rgba(255,255,255,0.92)",bt=null!==(Y=se.iconStrokeWidth)&&void 0!==Y?Y:1,wt=null!==(D=se.iconScale)&&void 0!==D?D:.72,Mt=[],kt=[],$t=[];for(const e of Pe){const t=dt.positions.get(e.id);if(!t)continue;const n=x(e.datum,{highlight:mt,predicate:ft,dimOpacity:yt}),o={type:"symbol",cx:t.px,cy:t.py,size:e.size,symbolType:e.baseShape,style:Object.assign({fill:Ue(e.colorKey,He(e.shadeVal)),opacity:n},pt?{stroke:pt,strokeWidth:gt}:{}),datum:e.datum,id:e.id,label:e.id+""};if(Mt.push(o),e.iconShape){const o=Math.sqrt(e.size/Math.PI)*wt,r=B(e.iconShape,100);$t.push({x:t.px,y:t.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:e.iconShape,opacity:n})}e.marker&&n>yt+.001&&kt.push({x:t.px,y:t.py,r:Math.max(1,.4*Math.sqrt(e.size/Math.PI))})}const At=[];if(se.callouts&&se.callouts.length>0){const e=null!==(P=se.calloutColor)&&void 0!==P?P:"var(--semiotic-text, #f4f4f8)",t=ae.y+ae.height-(Ie>0?.45*Ie:9),n=[];for(let e=0;se.callouts.length>e;e++){const t=se.callouts[e],o=Pe.find(e=>e.datum[t.field]+""==t.value+"");if(!o)continue;const r=dt.positions.get(o.id);r&&n.push({c:t,ci:e,px:r.px,py:r.py,markR:Math.sqrt(o.size/Math.PI)})}const o=n.filter(e=>null==e.c.at).sort((e,t)=>e.px-t.px),r=new Map;o.forEach((e,t)=>{r.set(e.ci,Le+(t+.5)/o.length*Ye)});for(const o of n){const n=o.c;let i=null!==(R=r.get(o.ci))&&void 0!==R?R:o.px,l=t;const s=null!==(V=n.connector)&&void 0!==V?V:r.has(o.ci)?"elbow":"straight";"object"==typeof n.at&&n.at?(i=n.at.x,l=n.at.y):"number"==typeof n.at&&(l=ae.y+n.at*ae.height),At.push({keyId:"callout-"+o.ci,markX:o.px,markY:o.py,labelX:i,labelY:l,label:n.label,connector:s,markRadius:Math.max(o.markR+3,7),stroke:e,color:e,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const Nt=function(e,t){var r,i;const l=null!==(r=t.columnLabel)&&void 0!==r?r:e=>e,s=null!==(i=t.rowLabel)&&void 0!==i?i:e=>e;return o("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[t.showEnclosures&&e.enclosures.map((e,n)=>H({keyId:"enc-"+n,x:e.x,y:e.y,width:e.w,height:e.h,radius:t.enclosureRadius,stroke:t.enclosureColor,strokeWidth:t.enclosureWidth,opacity:t.enclosureOpacity})),t.iconMarks.length>0&&n("g",{className:"packed-cluster-matrix-icons",children:t.iconMarks.map((e,o)=>n("path",{d:X(e.shape,e.size),transform:`translate(${e.x},${e.y})`,fill:"none",stroke:t.iconColor,strokeWidth:t.iconStrokeWidth,opacity:e.opacity},"ic-"+o))}),t.markerDots.length>0&&n("g",{className:"packed-cluster-matrix-markers",children:t.markerDots.map((e,o)=>n("circle",{cx:e.x,cy:e.y,r:e.r,fill:t.markerColor},"mk-"+o))}),t.showColumnHeaders&&e.colBands.map((e,n)=>q({keyId:"col-"+n,text:l(e.col),x:e.x+e.w/2,y:t.headerY,anchor:"middle",fontSize:t.headerFontSize,fontWeight:700,color:t.headerColor})),t.showRowLabels&&[...e.rowLabelY].map(([e,n])=>q({keyId:"row-"+e,text:s(e),x:t.labelX,y:n,anchor:"end",fontSize:t.labelFontSize,fontWeight:600,color:t.labelColor})),t.callouts.map(e=>U(e))]})}(dt,{markerDots:kt,markerColor:vt,iconMarks:$t,iconColor:xt,iconStrokeWidth:bt,callouts:At,showEnclosures:Oe,showColumnHeaders:ze,showRowLabels:We,enclosureColor:null!==(G=se.enclosureColor)&&void 0!==G?G:"var(--semiotic-text, #f4f4f8)",enclosureRadius:null!==(Q=se.enclosureRadius)&&void 0!==Q?Q:9,enclosureOpacity:null!==(te=se.enclosureOpacity)&&void 0!==te?te:.5,enclosureWidth:null!==(ne=se.enclosureWidth)&&void 0!==ne?ne:1.5,headerColor:null!==(oe=se.headerColor)&&void 0!==oe?oe:"var(--semiotic-text, #f4f4f8)",labelColor:null!==(re=se.labelColor)&&void 0!==re?re:"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:null!==(ie=se.headerFontSize)&&void 0!==ie?ie:13,labelFontSize:null!==(le=se.labelFontSize)&&void 0!==le?le:11,headerY:ae.y+.62*Fe,labelX:ae.x+je-10,columnLabel:se.columnLabel,rowLabel:se.rowLabel});return{sceneNodes:Mt,overlays:Nt}},Z=4;function ee(e){let t=2166136261;const n=e=>{for(let n=0;e.length>n;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(const o of e)n(o.id),n(o.col),n(o.row),t^=Math.round(8*o.packR),t=Math.imul(t,16777619);return(t>>>0).toString(36)}const te=e=>{var t,n,o,r,i,l,s;const a=e.config,{plot:c}=e.dimensions;if(0>=c.width||0>=c.height)return{nodes:[]};const u=m(a.categoryAccessor),d=m(a.stackBy),f=e=>{const t="function"==typeof a.valueAccessor?a.valueAccessor(e):e[a.valueAccessor],n=Number(t);return Number.isFinite(n)&&n>0?n:0},y=null!==(t=a.gutter)&&void 0!==t?t:2,p="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",v="string"==typeof a.stackBy?a.stackBy:"stack",x="string"==typeof a.valueAccessor?a.valueAccessor:"value",b=(e,t,n)=>g(o=>{o("category",e),o("stack",t),o("value",n),"category"!==p&&o(p,e),"stack"!==v&&o(v,t),"value"!==x&&o(x,n)}),w=!1!==a.showCategoryLabels,M=null!==(n=a.labelPadding)&&void 0!==n?n:w?22:0,k=Math.max(0,c.height-M),$=[],A=new Map,N=[],S=new Set,C=new Map;for(const t of e.data){const e=u(t)+"",n=d(t)+"",i=f(t);A.has(e)||($.push(e),A.set(e,0),C.set(e,new Map)),S.has(n)||(S.add(n),N.push(n)),A.set(e,(null!==(o=A.get(e))&&void 0!==o?o:0)+i);const l=C.get(e);l.set(n,(null!==(r=l.get(n))&&void 0!==r?r:0)+i)}const O=a.categoryOrder?ne(a.categoryOrder,$,e=>A.has(e)):$,z=a.stackOrder?ne(a.stackOrder,N,()=>!0):N,W=O.reduce((e,t)=>{var n;return e+(null!==(n=A.get(t))&&void 0!==n?n:0)},0);if(0>=W)return{nodes:[]};const F=Math.max(0,c.width-y*Math.max(0,O.length-1)),j=[],I=[];let L=c.x;for(const t of O){const n=null!==(i=A.get(t))&&void 0!==i?i:0,o=n/W*F;if(0>=o)continue;I.push({cat:t,x:L,w:o});const r=C.get(t);let s=c.y;for(const i of z){const a=null!==(l=r.get(i))&&void 0!==l?l:0;if(0>=a)continue;const c=a/n*k;j.push({type:"rect",x:L,y:s,w:o,h:c,style:{fill:e.resolveColor(i),stroke:"none"},datum:b(t,i,a),group:i}),s+=c}L+=o+y}return{nodes:j,overlays:w&&I.length>0?function(e,t,n){const o=e.map((e,o)=>q({keyId:"marimekko-label-"+o,text:e.cat,x:e.x+e.w/2,y:t+12,anchor:"middle",baseline:"auto",maxWidth:e.w-4,fontSize:12,color:n}));return h.createElement(h.Fragment,null,...o)}(I,c.y+k+4,`var(--semiotic-text, ${null!==(s=e.theme.semantic.text)&&void 0!==s?s:"currentColor"})`):null}};function ne(e,t,n){const o=new Set,r=[];for(const t of e)n(t)&&!o.has(t)&&(o.add(t),r.push(t));for(const e of t)o.has(e)||r.push(e);return r}const oe=e=>{var t,n,o,r,i,l,s,a,c,u,d,f;const y=e.config,{plot:p}=e.dimensions;if(0>=p.width||0>=p.height||0===e.data.length)return{nodes:[]};const v=null!==(t=y.rowHeight)&&void 0!==t?t:28,x=null!==(n=y.rowGap)&&void 0!==n?n:12,b=!1!==y.showLabels,w=b?null!==(o=y.labelWidth)&&void 0!==o?o:120:0,M=!1!==y.showTicks,k=M?14:0,$=null!==(r=y.tickFormat)&&void 0!==r?r:e=>e.toLocaleString(),A=p.x+w,N=Math.max(0,p.width-w);if(0>=N)return{nodes:[]};const S=m(y.categoryAccessor),C=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},O=e=>C("function"==typeof y.valueAccessor?y.valueAccessor(e):e[y.valueAccessor]),z=e=>C("function"==typeof y.targetAccessor?y.targetAccessor(e):e[y.targetAccessor]),W=e=>{const t="function"==typeof y.rangesAccessor?y.rangesAccessor(e):e[y.rangesAccessor];return Array.isArray(t)?t.map(C).sort((e,t)=>e-t):[]},F="string"==typeof y.categoryAccessor?y.categoryAccessor:"metric",j="string"==typeof y.valueAccessor?y.valueAccessor:"value",I="string"==typeof y.targetAccessor?y.targetAccessor:"target",L=null!==(l=null!==(i=y.actualColor)&&void 0!==i?i:e.theme.semantic.primary)&&void 0!==l?l:"#3b6cb1",E=null!==(s=e.theme.semantic.text)&&void 0!==s?s:"currentColor",Y=null!==(a=e.theme.semantic.textSecondary)&&void 0!==a?a:"#888",D=null!==(c=e.theme.semantic.surface)&&void 0!==c?c:"#e8eaed",P=null!==(u=e.theme.semantic.grid)&&void 0!==u?u:"#cdd1d6",T=null!==(d=e.theme.semantic.border)&&void 0!==d?d:"#a3a8af",X=null!==(f=y.targetColor)&&void 0!==f?f:`var(--semiotic-text, ${E})`,R=[`var(--semiotic-surface, ${D})`,`var(--semiotic-grid, ${P})`,`var(--semiotic-border, ${T})`],V=`var(--semiotic-text, ${E})`,B=`var(--semiotic-text-secondary, ${Y})`,H=[],G=[];for(let t=0;e.data.length>t;t++){const n=e.data[t],o=W(n),r=O(n),i=z(n),l=Math.max(r,i,...o.length?o:[0]);if(0>=l)continue;const s=p.y+t*(v+x+k);if(s+v+k>p.y+p.height)break;G.push({yTop:s,label:S(n),actual:r,target:i,maxVal:l});const a=e=>A+e/l*N,c=S(n),u=e=>g(t=>{t("metric",c),"metric"!==F&&t(F,c),e(t)});let d=A;for(let e=0;o.length>e;e++){const t=a(o[e]),n=t-d;n>0&&H.push({type:"rect",x:d,y:s,w:n,h:v,style:{fill:R[Math.min(e,R.length-1)],stroke:"none"},datum:u(t=>{t("range",e),t("rangeValue",o[e]),t("kind","range")}),group:"range-"+e}),d=t}const h=Math.max(6,Math.floor(.45*v));H.push({type:"rect",x:A,y:s+(v-h)/2,w:a(r)-A,h:h,style:{fill:L,stroke:"none"},datum:u(e=>{e("value",r),e("kind","actual"),"value"!==j&&e(j,r)}),group:"actual"});const f=3,m=Math.floor(.8*v);H.push({type:"rect",x:a(i)-f/2,y:s+(v-m)/2,w:f,h:m,style:{fill:X,stroke:"none"},datum:u(e=>{e("target",i),e("kind","target"),"target"!==I&&e(I,i)}),group:"target"})}const U=[];for(let e=0;G.length>e;e++){const t=G[e];if(b&&U.push(q({keyId:"bullet-label-"+e,text:t.label,x:p.x+w-8,y:t.yTop+v/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:V})),M){const n=5,o=t.yTop+v+2;for(let r=0;n>r;r++){const i=t.maxVal*r/(n-1),l=A+i/t.maxVal*N;U.push(h.createElement("line",{key:`bullet-tick-${e}-${r}`,x1:l,x2:l,y1:o,y2:o+3,stroke:B,strokeWidth:1}),q({keyId:`bullet-ticktext-${e}-${r}`,text:$(i),x:l,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:B}))}}}return{nodes:H,overlays:U.length>0?h.createElement(h.Fragment,null,...U):null}},re=e=>{var t,n,o,r,i,l,s,a,c,u,d,m;const y=e.config,{plot:p}=e.dimensions,g=null!==(t=y.fields)&&void 0!==t?t:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of g){if(null===(n=y.domains)||void 0===n?void 0:n[t]){v[t]=y.domains[t];continue}let o=1/0,r=-1/0;for(const n of e.data){const e=Number(n[t]);Number.isFinite(e)&&(o>e&&(o=e),e>r&&(r=e))}v[t]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const b=!1!==y.showAxes,w=b?null!==(o=y.axisLabelPadding)&&void 0!==o?o:24:8,M=b?18:8,k=g.map(e=>f().domain(v[e]).range([p.y+p.height-M,p.y+w])),$=g.map((e,t)=>1===g.length?p.x+p.width/2:p.x+t/(g.length-1)*p.width),A=y.colorBy?"function"==typeof y.colorBy?y.colorBy:e=>{var t;return(null!==(t=e[y.colorBy])&&void 0!==t?t:"")+""}:null,N=null!==(r=y.opacity)&&void 0!==r?r:.45,S=null!==(i=y.strokeWidth)&&void 0!==i?i:1.25,C=null!==(l=e.theme.semantic.primary)&&void 0!==l?l:"#3b6cb1",O=null!==(s=y.dimmedOpacity)&&void 0!==s?s:.08,z=y.highlightFn,W=[],F=[];for(const t of e.data){const n=A?e.resolveColor(A(t)+""):C,o=!z||z(t),r=x(t,{predicate:z,baseOpacity:N,dimOpacity:O,brighten:.4}),i=o?F:W;for(let e=0;g.length-1>e;e++){const l=Number(t[g[e]]),s=Number(t[g[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:$[e],y1:k[e](l),x2:$[e+1],y2:k[e+1](s),style:{stroke:n,strokeWidth:z&&o?S+.75:S,opacity:r,fill:"none"},datum:t};i.push(a)}if(y.showPoints)for(let e=0;g.length>e;e++){const o=Number(t[g[e]]);if(!Number.isFinite(o))continue;const l={type:"point",x:$[e],y:k[e](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,r+.3)},datum:t};i.push(l)}}let j=null;if(b){const t=`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#aaa"})`,n=`var(--semiotic-text, ${null!==(c=e.theme.semantic.text)&&void 0!==c?c:"currentColor"})`,o=`var(--semiotic-text-secondary, ${null!==(u=e.theme.semantic.textSecondary)&&void 0!==u?u:"#888"})`,r=p.y+w,i=p.y+p.height-M,l=[];for(let e=0;g.length>e;e++){const s=g[e],a=$[e],c=null!==(m=null===(d=y.tickFormat)||void 0===d?void 0:d[s])&&void 0!==m?m:e=>e.toLocaleString();l.push(h.createElement("line",{key:"pc-axis-line-"+e,x1:a,x2:a,y1:r,y2:i,stroke:t,strokeWidth:1})),l.push(q({keyId:"pc-axis-label-"+e,text:s,x:a,y:p.y+w-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:n}));const[u,f]=v[s],x=5;for(let n=0;x>n;n++){const r=u+(f-u)*n/(x-1),i=k[e](r);l.push(h.createElement("line",{key:`pc-tick-${e}-${n}`,x1:a-3,x2:a+3,y1:i,y2:i,stroke:t,strokeWidth:1}),q({keyId:`pc-ticktext-${e}-${n}`,text:c(r),x:a+6,y:i+3,anchor:"start",baseline:"auto",fontSize:10,color:o}))}}j=h.createElement(h.Fragment,null,...l)}return{nodes:W.concat(F),overlays:j}};function ie(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function le(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function se(e){return null==e?null:e+""}function ae(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const ce=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ue(e){return!!e&&"object"==typeof e&&ce.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}new Set(["label","callout","callout-circle","callout-rect"]);const de=2e4;function he(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function fe(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 me(e){var t,n;let o;const r=null==e?void 0:e.emphasis;o="primary"===r?100:"secondary"===r?10:50;const i=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(o+=15*Math.max(0,Math.min(1,i))),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}function ye(e){var t;const{annotations:n,width:o,height:r}=e,i=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=fe(o,r,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,ue(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(e=>he(e.annotation)),u=a.filter(e=>!he(e.annotation)).sort((e,t)=>me(t.annotation)-me(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,i-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],m=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?f.push(e):m.push(e);return{visible:f,deferred:m,budget:l}}const pe=32,ge=6,ve=4,xe=8,be=72;const we={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Me(e){return ue(e)}function ke(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 $e(e,t,n,o,r){const i=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?l-r.height:l,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?l-r.height-4:l+4,width:r.width,height:r.height}}function Ae(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ne(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 Se(e,t,n,o,r,i,l,s){const a=Ae(e,l);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}(a,r,i,s);for(const e of n)c+=12*Ne(a,e);for(const e of o)c+=4*Ne(a,e);return c}function Ce(e,t,n){var o,r;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const i=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=i&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(r=n.scales)||void 0===r?void 0:r.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,r;const i=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===i){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 ae(t,n,{x:r.x,y:r.y})}const o=function(e){var t,n,o,r,i,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?ae(t,n,o):null}if("semantic"===i){const o=function(e,t,n){var o,r;const i=function(e){var t,n;return se(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!i)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>se(e.pointId)===i);if(l)return ae(t,n,{x:l.x,y:l.y});const s=null===(r=n.data)||void 0===r?void 0:r.find(e=>function(e){var t,n,o;return se(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)===i);if(!s)return null;const a=ie(s,n),c=le(s,n);return null==a||null==c?null:ae(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let l=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=ie(e,n),s=le(e,n)),null!=l&&null!=s)return ae(t,n,{x:l,y:s});if("sticky"===i){const e=null===(r=n.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}function Oe(e){var t;const{annotations:n,context:o,defaultOffset:r=pe,notePadding:i=ge,markPadding:l=ve,edgePadding:s=xe,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=be,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:m,cohesion:y,audience:p}=e,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=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,l);let w=!1;const M=n.map((e,t)=>{if(!Me(e))return e;const n=Ce(e,t,o);if(!n)return e;const l=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=[...ke("string"==typeof e.title?e.title:void 0,t),...ke("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 x.push(Ae($e(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),i)),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}]}(r)){const t=Se($e(n.x,n.y,e.dx,e.dy,l),e,x,b,g,v,i,s);f>t&&(h=e,f=t)}if(!h)return e;const m=Ae($e(n.x,n.y,h.dx,h.dy,l),i);x.push(m);const y=Math.hypot(h.dx,h.dy),p=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}),p?{connector:p}:{})}),k=w?M:n.slice();let $=k;if(f){let e=!1;const t=k.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});$=e?t:k}{let e=!1;const t=$.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=we[n.source])&&void 0!==t?t:n.source:null,r="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[o,r].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${i})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${i})`:`(${i})`})}(t);return n!==t&&(e=!0),n});$=e?t:$}const A=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}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:fe(g,v,e))*n))}),{deferred:r}=ye(Object.assign({annotations:$,width:g,height:v},o));for(const e of r)A.add(e)}if(m&&("object"==typeof m&&"number"==typeof m.minWidth?m.minWidth:480)>=g)for(const e of $)Me(e)&&"secondary"===e.emphasis&&A.add(e);if(A.size>0)for(const e of $)!0===(null==e?void 0:e.defensive)&&A.delete(e);let N;return N=0===A.size?$:h?$.map(e=>A.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):$.filter(e=>!A.has(e)),y?function(e,t){let n=!1;const o=e.map(e=>Me(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(N,y):N}const ze="var(--semiotic-text, currentColor)";function We(e,t){const n=B(e,100);return n>0?t/n*100*(t/n):Math.PI*t*t}function Fe(e){var t,o,r,i,l,s,a;const c=[],u=e.colorMap?Object.entries(e.colorMap):e.keys?e.keys.map(t=>[t,e.color?e.color(t):void 0]):[];if(u.length>0){const n=null!==(t=e.colorType)&&void 0!==t?t:"fill",r=u.map(([e,t])=>({label:e,color:t})),i="line"===n?e=>{var t;return{stroke:null!==(t=e.color)&&void 0!==t?t:ze,strokeWidth:2,fill:"none"}}:e=>{var t,n;return{fill:null!==(t=e.color)&&void 0!==t?t:ze,stroke:null!==(n=e.color)&&void 0!==n?n:ze}};c.push({type:n,label:null!==(o=e.colorLabel)&&void 0!==o?o:"",items:r,styleFn:i})}if(e.symbolMap&&Object.keys(e.symbolMap).length>0){const t=null!==(r=e.symbolColor)&&void 0!==r?r:ze,o=Object.entries(e.symbolMap).map(([e,n])=>({label:e,shape:n,color:t}));c.push({label:null!==(i=e.symbolLabel)&&void 0!==i?i:"",items:o,styleFn:()=>({}),type:e=>{var o;const r=e.shape;return n("path",{d:X(r,We(r,7)),transform:"translate(8,8)",fill:null!==(o=e.color)&&void 0!==o?o:t})}})}if(e.sizeStops&&e.sizeStops.length>0&&e.sizeRadius){const t=e.sizeRadius,o=null!==(l=e.sizeFormat)&&void 0!==l?l:e=>e+"",r=null!==(s=e.sizeColor)&&void 0!==s?s:ze,i=e.sizeStops.map(e=>({label:o(e),r:Math.max(.5,t(e)),color:r}));c.push({label:null!==(a=e.sizeLabel)&&void 0!==a?a:"",items:i,styleFn:()=>({}),type:e=>{var t;return n("circle",{cx:8,cy:8,r:e.r,fill:null!==(t=e.color)&&void 0!==t?t:r})}})}return c}const je={isActive:!1,predicate:()=>!0},Ie=h.createContext(null);function Le(){var e;return null!==(e=h.useContext(Ie))&&void 0!==e?e:je}const Ee=new Set(["rows"]);function Ye(e){const t=e,n=[Xe(t,["datum","data"]),Xe(t,["datum"]),Xe(t,["data","data"]),Xe(t,["data"]),Xe(t,["node","datum","data"]),Xe(t,["node","datum"]),e];for(const e of n){if(!Re(e))continue;const t={};for(const[n,o]of Object.entries(e))n.startsWith("_")||"function"==typeof o||(t[n]=o);if(Object.keys(t).length>0)return t}return null}function De(e,t={}){var n;const o=Ye(e);if(!o)return[];const r=new Set(Ee);if(t.excludeKeys)for(const e of t.excludeKeys)r.add(e);const i=[];for(const[e,l]of Object.entries(o))if((t.includeInternal||!e.startsWith("_"))&&!r.has(e)&&(t.includeEmpty||null!=l&&""!==l)&&"function"!=typeof l&&(i.push({key:e,label:Te(e,t.labels),value:l,formatted:t.valueFormat?t.valueFormat(l,e,o):Pe(l)}),i.length>=(null!==(n=t.maxEntries)&&void 0!==n?n:8)))break;return i}function Pe(e){if(null==e)return"";if(e instanceof Date)return e.toISOString();if("number"==typeof e)return Number.isInteger(e)?e+"":e.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof e)return e?"true":"false";if(Array.isArray(e))return e.length+" items";if("object"==typeof e)try{return JSON.stringify(e)}catch(t){return e+""}return e+""}function Te(e,t){return"function"==typeof t?t(e):t&&t[e]?t[e]:e}function Xe(e,t){let n=e;for(const e of t){if(!Re(n))return;n=n[e]}return n}function Re(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}export{de as DEFAULT_AREA_PER_ANNOTATION,w as LayoutCache,T as SYMBOL_SEQUENCE,fe as annotationBudget,ye as annotationDensity,Oe as annotationLayout,q as bandLabel,G as boundsOf,De as buildTooltipEntries,oe as bulletLayout,N as calendarLayout,z as dagreLayout,x as dimFor,Ye as extractTooltipDatum,O as flextreeLayout,Pe as formatTooltipValue,p as groupBy,Fe as legendGroupsFrom,I as lineageDagLayout,M as makeShade,te as marimekkoLayout,U as markCallout,v as matchesHighlight,D as mermaidDagLayout,Q as packedClusterMatrix,re as parallelCoordinatesLayout,y as readField,H as roundedEnclosure,k as shade,b as signatureKey,B as symbolExtent,X as symbolPathString,R as symbolRadius,Le as useCustomLayoutSelection,$ as waffleLayout};
1
+ import{interpolateLab as t}from"d3-interpolate";function e(t){return"function"==typeof t?t:e=>e[t]}function n(t,e,n){const o=t?.data,r=o?o[e]:void 0;if(null!=r)return r;const i=t?.[e];return null==i?n:i}function o(t){return null==t?null:t.data??t.datum??t}function r(t,e){const n=new Map;for(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n}function i(t){const e=Object.create(null);return t((t,n)=>{e[t]=n}),e}function a(t,e){if(!e)return!0;const n=Array.isArray(e)?e:[e],o=t;for(const t of n)if(null!=t.value&&o[t.field]+""!=t.value+"")return!1;return!0}function s(t,e={}){const n=e.baseOpacity??1;return e.highlight||e.predicate?!a(t,e.highlight)||e.predicate&&!e.predicate(t)?e.dimOpacity??.16:Math.min(1,n+(e.brighten??0)):n}function c(t){return t.join("|")}var l=class{constructor(t=12){this.maxSize=t,this.store=new Map}get(t){return this.store.get(t)}set(t,e){this.maxSize>this.store.size||this.store.clear(),this.store.set(t,e)}getOrCompute(t,e){const n=this.store.get(t);if(void 0!==n)return n;const o=e();return this.set(t,o),o}clear(){this.store.clear()}get size(){return this.store.size}};function u(e,n=.72){const o=t(e,"#ffffff"),r=t(e,"#000000"),i=t(e,e)(0);return t=>{const e=0>t?0:t>1?1:t;return.5===e?i:.5>e?o(2*(.5-e)*n):r(2*(e-.5)*n)}}function d(t,e,n=.72){return u(t,n)(e)}function h(t){return i(e=>{for(const[n,o]of Object.entries(t))e(n,o)})}function f(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}function m(t,e,n){return Math.max(e,Math.min(n,t))}function p(t){const e=Number(t);return Number.isFinite(e)?Math.max(0,e):0}function y(t){if(0===t.length)return 0;let e=0;for(const n of t)e+=n;return e/t.length}function g(t,e){const n=m(e,0,1),o=t.trim().replace(/^#/,""),r=3===o.length?o.split("").map(t=>t+t).join(""):o;return/^[0-9a-fA-F]{6}$/.test(r)?`rgba(${parseInt(r.slice(0,2),16)}, ${parseInt(r.slice(2,4),16)}, ${parseInt(r.slice(4,6),16)}, ${n})`:t}var x=t=>{const e=t.config,n=e.rows??10,o=e.columns??10,r=e.gutter??2,a=n*o;if(0>=n||0>=o||0>=a)return{nodes:[]};const{plot:s}=t.dimensions;if(0>=s.width||0>=s.height)return{nodes:[]};const c=(s.width-r*(o-1))/o,l=(s.height-r*(n-1))/n;if(0>=c||0>=l)return{nodes:[]};const u=(null==(d=e.categoryAccessor)?null:"function"==typeof d?d:t=>t[d])??(()=>"_default");var d;const h=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(e.valueAccessor)??(()=>1),f=new Map,m=[];for(const e of t.data){const t=u(e)+"",n=Number(h(e)),o=Number.isFinite(n)?Math.max(0,n):0;f.has(t)||m.push(t),f.set(t,(f.get(t)??0)+o)}const p=Array.from(f.values()).reduce((t,e)=>t+e,0);if(0>=p)return{nodes:[]};let y;if(e.categoryOrder&&e.categoryOrder.length>0){const t=new Set,n=[];for(const o of e.categoryOrder)f.has(o)&&!t.has(o)&&(t.add(o),n.push(o));y=[...n,...m.filter(e=>!t.has(e))]}else y=m;if(0===y.length)return{nodes:[]};const g=y.map(t=>({cat:t,exact:(f.get(t)??0)/p*a})).map(t=>({...t,count:Math.floor(t.exact)})),x=g.reduce((t,e)=>t+e.count,0),b=g.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;a-x>t;t++)g[b[t%b.length].i].count+=1;const w="string"==typeof e.categoryAccessor?e.categoryAccessor:"category",M="string"==typeof e.valueAccessor?e.valueAccessor:"value",v=(t,e,n)=>i(o=>{o("category",t),o("value",f.get(t)??0),o("share",(f.get(t)??0)/p),"category"!==w&&o(w,t),"value"!==M&&o(M,f.get(t)??0),o("cells",n),o("_waffleCategory",t),o("_waffleIndex",e)}),k=[];let $=0;for(const e of g){const i=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)k.push({type:"rect",x:s.x+$%o*(c+r),y:s.y+(n-1-Math.floor($/o))*(l+r),w:c,h:l,style:{fill:i,stroke:"none"},datum:v(e.cat,$,e.count),group:e.cat,_transitionKey:`waffle-${e.cat}-${t}`}),$++}return{nodes:k}};function b(t,e,n){const o=Math.max(0,Math.floor(n?.minPerCategory??0)),r=t.reduce((t,e)=>t+Math.max(0,e.weight),0);if(0>=e||0>=r)return t.map(t=>({...t,exact:0,cells:0,remainder:0}));const i=t.map(t=>{const n=Math.max(0,t.weight)/r*e;return{...t,exact:n,cells:Math.max(o,Math.floor(n)),remainder:n-Math.floor(n)}});let a=i.reduce((t,e)=>t+e.cells,0);for(;a>e;){const t=i.filter(t=>t.cells>o).sort((t,e)=>e.cells-t.cells||t.remainder-e.remainder||t.key.localeCompare(e.key))[0];if(!t)break;t.cells--,a--}const s=[...i].sort((t,e)=>e.remainder-t.remainder||e.weight-t.weight||t.key.localeCompare(e.key));for(let t=0;e>a;t++)s[t%s.length].cells++,a++;return i}var w=1e-6;function M(t){return Number.isFinite(t)?Math.max(0,t):0}function v(t,e){const n=Number(e.unit),o=M(t),r=e.maxUnits??1/0,i=e.minFraction??0;if(0>=n||0>=r||0>=o)return{units:[],unit:n>0?n:0,total:o,shown:0,overflow:o>0&&!(r>0)};const a=Math.ceil(o/n-w),s=Math.min(r,a),c=a>r,l=[];for(let t=0;s>t;t+=1){const e=t*n;let r=Math.min(1,Math.max(0,(Math.min(o,e+n)-e)/n));w>1-r&&(r=1),l.push({index:t,fraction:r,start:e,end:e+r*n,value:r*n})}const u=l[l.length-1];u&&i>u.fraction&&1>u.fraction&&l.pop();const d=l.reduce((t,e)=>t+e.value,0);return{units:l,unit:n,total:o,shown:d,overflow:c}}function k(t,e,n){const o=v(t,n),r=Math.max(M(e),o.total);if(o.total>=r)return{...o,rangeUnits:[],rangeTotal:o.total};const i=v(r,{unit:n.unit,maxUnits:n.maxUnits}),a=i.unit>0?o.total/i.unit:0,s=Math.floor(a+w);let c=Math.min(1,Math.max(0,a-s));w>c&&(c=0);const l=[];for(const t of i.units)s>t.index||(t.index===s&&c>0?t.fraction-c>w&&l.push({...t,startFraction:c,start:t.index*i.unit+c*i.unit,value:(t.fraction-c)*i.unit}):l.push({...t,startFraction:0}));return{...o,overflow:o.overflow||i.overflow,rangeUnits:l,rangeTotal:r}}import{forceCenter as $,forceCollide as A,forceLink as S,forceManyBody as I,forceSimulation as z,forceX as N,forceY as C}from"d3-force";function T(t){let e=t>>>0;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function E(t,e,n={}){const o=n.iterations??260,r=n.repulsion??5200,i=n.linkDistance??165,a=n.linkStrength??.045,s=n.centerStrength??.018,c=n.damping??.84,l=n.nodeRadius??12,u=n.nodePadding??3,d=n.inset??.06,h=T(n.seed??1),f=new Map;for(const e of t)f.set(e.id,0);for(const t of e)f.set(t.source,(f.get(t.source)??0)+1),f.set(t.target,(f.get(t.target)??0)+1);const m=500,p=t.map(t=>({id:t.id,data:t,x:200+600*h(),y:200+600*h()})),y=new Set(t.map(t=>t.id)),g=e.filter(t=>y.has(t.source)&&y.has(t.target)).map(t=>({source:t.source,target:t.target}));if(o>0){const t=z(p).randomSource(h).alphaDecay(1-Math.pow(.001,1/o)).velocityDecay(Math.max(0,Math.min(1,1-c))).force("charge",I().strength(t=>{const e=f.get(t.id)??0;return 2.5*-Math.sqrt(r)*Math.sqrt(e+1)})).force("collide",A(t=>(t=>"function"==typeof l?l(t.data):l)(t)+u).strength(.9).iterations(2)).force("center",$(m,m).strength(.8)).force("x",N(m).strength(s)).force("y",C(m).strength(s));g.length>0&&t.force("link",S(g).id(t=>t.id).distance(i).strength(t=>{const e="string"==typeof t.target?t.target:t.target.id,n=Math.max(1,Math.min(f.get("string"==typeof t.source?t.source:t.source.id)??1,f.get(e)??1));return a/.045/n})),t.stop();for(let e=0;o>e;e+=1)t.tick()}let x=1/0,b=1/0,w=-1/0,M=-1/0;for(const t of p){const e=t.x??m,n=t.y??m;x>e&&(x=e),b>n&&(b=n),e>w&&(w=e),n>M&&(M=n)}const v=w-x,k=M-b,E={};for(const t of p)E[t.id]={x:0===v?.5:d+((t.x??m)-x)/v*(1-2*d),y:0===k?.5:d+((t.y??m)-b)/k*(1-2*d)};return E}function W(t){return t?t.map(Number).filter(Number.isFinite):[]}function L(t){if("fixed-denominator"===t.countStrategy)return 1/0;const e=t.maxTokens??1/0;return e>0?Math.floor(e):0}function F(t){const e=t.unitValue??t.unit,n=t.icon??t.token;return{...t,...null!=e&&{unitValue:e},...null!=n&&{icon:n}}}function j(t){if(t.samples)return W(t.samples);if(!t.data||!t.valueAccessor)return[];const e=t.valueAccessor;return t.data.map(t=>"function"==typeof e?e(t):Number(t[e])).filter(Number.isFinite)}function R(t,e,n,o={}){return{index:e,tokenType:t.tokenType,tokenSemantics:t.tokenSemantics,countStrategy:t.countStrategy,fraction:1,startFraction:0,value:n,start:e,end:e+n,unitValue:t.unitValue,unitMeaning:t.unitMeaning,...o}}function O(t,e){const n=F(e),o=function(t){return"number"==typeof t?{value:t}:Array.isArray(t)?{samples:W(t),data:t}:t}(t);let r,i,a,s,c,l,u,d=0,h=!1;if("unitized"===n.countStrategy){c=n.unitValue??1;const t={unit:c,maxUnits:n.maxTokens,minFraction:n.minFraction},e=null==o.rangeValue?v(p(o.value),t):k(p(o.value),p(o.rangeValue),t);r=e.units.map(t=>R(n,t.index,t.value,{fraction:t.fraction,start:t.start,end:t.end,unitValue:e.unit})),i=e.total,d=e.shown,h=e.overflow,null!=o.rangeValue&&(l=e.rangeTotal,u=e.rangeUnits.map(t=>R(n,t.index,t.value,{fraction:t.fraction,startFraction:t.startFraction,start:t.start,end:t.end,unitValue:e.unit,range:"scenario"})))}else if("fixed-denominator"===n.countStrategy){s=Math.floor(p(o.denominator??n.denominator)),a=p(o.numerator??n.numerator??o.value);const t=Math.min(s,Math.max(0,Math.round(a)));r=Array.from({length:s},(e,o)=>R(n,o,1,{highlighted:t>o,start:o,end:o+1})),i=s,d=r.length,h=!1}else if("quantile"===n.countStrategy){const t=j(o).sort((t,e)=>t-e),e=Math.max(0,Math.floor(n.tokenCount??50)),a=t.length>0?Math.min(e,L(n)):0;r=Array.from({length:a},(e,o)=>{const r=(o+.5)/a,i=function(t,e){const n=t.length;if(0===n)return 0;if(1===n)return t[0];const o=(n-1)*Math.min(1,Math.max(0,e)),r=Math.floor(o),i=o-r;return t[r]*(1-i)+t[Math.ceil(o)]*i}(t,r);return R(n,o,i,{sample:i,quantile:r,start:i,end:i})}),i=t.length,d=r.length,h=t.length>0&&e>r.length}else if("sample"===n.countStrategy||"posterior-sample"===n.countStrategy||"random-sample"===n.countStrategy){const t=j(o),e=Math.min(t.length,Math.max(0,Math.floor(n.tokenCount??t.length))),a=Math.min(e,L(n));r=("random-sample"===n.countStrategy?function(t,e=1){const n=Array.from({length:t},(t,e)=>e),o=T(Math.floor(e)||1);for(let t=n.length-1;t>0;t-=1){const e=Math.floor(o()*(t+1)),r=n[t];n[t]=n[e],n[e]=r}return n}(t.length,n.seed).slice(0,a):Array.from({length:a},(e,n)=>Math.floor(n/Math.max(1,a-1)*(t.length-1)))).map((e,o)=>{const r=t[e];return R(n,o,r,{sample:r,start:r,end:r})}),i=t.length,d=r.length,h=e>r.length}else{const t=o.data;if(t&&null==o.value)r=t.map((t,e)=>R(n,e,1,{datum:t})),i=t.length;else{const t=v(p(o.value),{unit:1,maxUnits:n.maxTokens,minFraction:n.minFraction});r=t.units.map(t=>R(n,t.index,t.value,{fraction:t.fraction,start:t.start,end:t.end,unitValue:1})),i=t.total,d=t.shown,h=t.overflow}if(t&&null==o.value){const t=function(t,e){const n=L(e);return t.length>n?{tokens:t.slice(0,n),overflow:!0}:{tokens:t,overflow:!1}}(r,n);r=t.tokens,d=r.length,h=t.overflow}}return{tokens:r,encoding:n,total:i,shown:d,overflow:h,numerator:a,denominator:s,unitValue:c,rangeTotal:l,rangeTokens:u,diagnostics:q(n,{visibleTokens:r.length+(u?.length??0)})}}function P(t,e={}){const n=Array.isArray(t)?t:t.tokens,o=n.length;if(0===o)return[];const r=e.flow??"row",i=e.cellWidth??16,a=e.cellHeight??i,s=e.gutter??2,c=e.anchor??[.5,.5],l=Math.max(1,Math.floor(e.columns??Math.ceil(e.rows?o/e.rows:Math.sqrt(o)))),u=Math.max(1,Math.floor(e.rows??Math.ceil(o/l))),d="row"===r?Math.max(u,Math.ceil(o/l)):u,h="column"===r?Math.max(l,Math.ceil(o/u)):l,f=e.x??0,m=e.y??0;return n.map((t,n)=>{let o,p;return"column"===r?(p=Math.floor(n/u),o=n%u):(o=Math.floor(n/l),p=n%l),"left"===e.columnDirection&&(p=h-1-p),"up"===e.rowDirection&&(o=d-1-o),{...t,row:o,column:p,x:f+p*(i+s)+c[0]*i,y:m+o*(a+s)+c[1]*a}})}function q(t,e={}){const n=[],o=t.tokenSemantics,r=t.countStrategy,i=e.maxRecommendedTokens??("fixed-denominator"!==r||p(t.denominator)>100?80:100);return o||n.push({code:"TOKEN_SEMANTICS_UNCLEAR",severity:"warning",message:"Every tokenized encoding should state what one token represents."}),r||n.push({code:"MISSING_COUNT_STRATEGY",severity:"warning",message:"Every tokenized encoding should state how token counts are produced."}),"icon"!==t.tokenType&&"glyph"!==t.tokenType||"icon-only"!==t.labelPolicy&&"token-only"!==t.labelPolicy||n.push({code:"ICON_ONLY_LABELS",severity:"warning",message:"Icons should supplement text labels, not replace them."}),null!=e.visibleTokens&&e.visibleTokens>i&&n.push({code:"TOO_MANY_VISIBLE_TOKENS",severity:"warning",message:`This encoding renders ${e.visibleTokens} visible tokens. Consider unitizing, sampling, or a hybrid bar/token view.`}),"decorative"!==o||"icon"!==t.tokenType&&"glyph"!==t.tokenType||n.push({code:"DECORATIVE_PICTOGRAPHS",severity:"warning",message:"Decorative pictographs can harm recall and speed when they do not clarify the data."}),"unitized-measure"===o&&r&&"unitized"!==r&&n.push({code:"TOKEN_STRATEGY_MISMATCH",severity:"warning",message:"Unitized measures should use the unitized count strategy so each token has a stable value."}),"risk-case"===o&&r&&"fixed-denominator"!==r&&n.push({code:"TOKEN_STRATEGY_MISMATCH",severity:"warning",message:"Risk cases are usually clearest as a fixed-denominator natural frequency."}),"possible-outcome"!==o&&"posterior-sample"!==o&&"hypothetical-case"!==o||!r||"quantile"===r||"sample"===r||"posterior-sample"===r||"random-sample"===r||n.push({code:"TOKEN_STRATEGY_MISMATCH",severity:"warning",message:"Outcome/sample tokens should come from quantiles or samples, not from a unitized magnitude."}),"unitized-measure"===o&&"unitized"===r&&null==t.unitValue&&null==t.unit&&n.push({code:"MISSING_UNIT_VALUE",severity:"warning",message:"Unitized measures should set unitValue so each token has a declared value."}),"unitized-measure"!==o||"unitized"!==r||t.unitMeaning||n.push({code:"MISSING_UNIT_MEANING",severity:"info",message:"Add unitMeaning so readers know what one full token represents."}),n}function D(t){return"measure"===t?"precise-comparison":"estimate probability"===t?"probability-estimation":"understand risk"===t?"risk-communication":"remember"===t?"memory":"decide"===t?"support-decision":t}function B(t){const e=D(t);return"precise-comparison"===e?["compare-categories","rank"]:"probability-estimation"===e?["distribution"]:"risk-communication"===e?["part-to-whole","distribution"]:"frequency-reasoning"===e?["distribution","compare-categories"]:"memory"===e||"editorial-engagement"===e?["compare-categories"]:"public-explanation"===e||"support-decision"===e?["distribution","compare-categories"]:["compare-categories"]}function Y(t){const e=D(t.taskIntent),n="small"===(o=t.availableSpace)?25:"large"===o?100:50;var o;if("precise-comparison"===e)return{recommendedEncoding:"bar-or-line",rationale:"Use continuous position/length encodings when precise magnitude comparison is the primary task.",warnings:[],alternatives:["hybrid-bar-token","unitized-measure"]};if("probability-estimation"===e){const t={tokenType:"dot",tokenSemantics:"possible-outcome",countStrategy:"quantile",tokenCount:n,layout:"dotplot",labelPolicy:"text-plus-token"};return{recommendedEncoding:"quantile-dotplot",tokenEncoding:t,rationale:"This task asks readers to estimate probability from a distribution. Quantile tokens turn probability mass into countable possible outcomes.",warnings:q(t),alternatives:["cdf-with-threshold","density-with-threshold"]}}if("risk-communication"===e){const e={tokenType:t.concreteEntity?"icon":"dot",icon:t.concreteEntity,tokenSemantics:"risk-case",countStrategy:"fixed-denominator",denominator:100,layout:"waffle",labelPolicy:"text-plus-token"};return{recommendedEncoding:"fixed-denominator-icon-array",tokenEncoding:e,rationale:"Risk is often clearer as natural frequency: highlighted cases out of a fixed denominator.",warnings:q(e,{visibleTokens:100,maxRecommendedTokens:100}),alternatives:["labeled-percent","bar-with-risk-threshold"]}}if("memory"===e||"editorial-engagement"===e){const e={tokenType:t.concreteEntity?"glyph":"icon",icon:t.concreteEntity,tokenSemantics:"unitized-measure",countStrategy:"unitized",unitValue:1,layout:"grid",labelPolicy:"text-plus-token",unitMeaning:t.concreteEntity?"one token represents a unit of "+t.concreteEntity:"one token represents one unit"};return{recommendedEncoding:"semantic-isotype",tokenEncoding:e,rationale:"Semantic tokens are useful when the chart needs to make a topic concrete and memorable.",warnings:q(e),alternatives:["labeled-bar","hybrid-bar-token"]}}if("frequency-reasoning"===e||"public-explanation"===e||"support-decision"===e){const e={tokenType:t.concreteEntity?"icon":"dot",icon:t.concreteEntity,tokenSemantics:"distribution"===t.dataType?"possible-outcome":"unitized-measure",countStrategy:"distribution"===t.dataType?"quantile":"unitized",unitValue:"distribution"===t.dataType?void 0:1,tokenCount:n,layout:"distribution"===t.dataType?"dotplot":"bar-segment",labelPolicy:"text-plus-token",unitMeaning:"distribution"===t.dataType?void 0:"one token represents one unit interval"};return{recommendedEncoding:"hybrid-continuous-token",tokenEncoding:e,rationale:"A hybrid view preserves measurement while adding countable tokens for explanation and decisions.",warnings:q(e),alternatives:["bar-or-line","quantile-dotplot","fixed-denominator-icon-array"]}}return{recommendedEncoding:"bar-or-line",rationale:"Use continuous encodings unless the task needs frequency, risk, memory, or outcome reasoning.",warnings:[],alternatives:["unitized-measure","quantile-dotplot","fixed-denominator-icon-array"]}}import{symbol as V,symbolCircle as H,symbolCross as X,symbolDiamond as _,symbolSquare as G,symbolStar as U,symbolTriangle as K,symbolWye as Q}from"d3-shape";var Z={circle:H,square:G,triangle:K,diamond:_,star:U,cross:X,wye:Q},J=["circle","triangle","diamond","star","square","chevron","cross","wye"];function tt(t,e,n){if(n)return n;const o=t??"circle";return"chevron"===o?function(t){const e=1.5*et(t),n=.92*e;return`M0,${-e}L${n},${(.78*e).toFixed(3)}L0,${(.28*e).toFixed(3)}L${-n},${(.78*e).toFixed(3)}Z`}(e):V(Z[o]??H,Math.max(1,e))()??""}function et(t){return Math.sqrt(Math.max(1,t)/Math.PI)}var nt=new Map;function ot(t,e,n){if(!n&&"circle"===(t??"circle"))return et(e);const o=n?"p:"+n:`${t}:${Math.round(e)}`,r=nt.get(o);if(null!=r)return r;const i=(n??tt(t,e)).match(/-?\d*\.?\d+(?:e-?\d+)?/gi);let a=0;if(i)for(let t=0;i.length>t+1;t+=2){const e=+i[t],n=+i[t+1],o=Math.sqrt(e*e+n*n);o>a&&(a=o)}return a>0||(a=et(e)),nt.size>512&&nt.clear(),nt.set(o,a),a}var rt="#334155",it="#f8fafc",at="#cbd5e1",st={viewBox:[40,40],anchor:[.5,1],parts:[{d:"M8 3h24v34H8z",fill:"color"},{d:"M12 9h16v5H12zM12 18h16v5H12zM12 27h16v5H12z",fill:"accent"},{d:"M23.8 11.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 20.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 29.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",fill:"color"}]},ct={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M10 8h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z",fill:"color"},{d:"M15 15h10v10H15z",fill:"accent"},{d:"M7 2v6M14 2v6M21 2v6M28 2v6M7 32v6M14 32v6M21 32v6M28 32v6M2 7h6M2 14h6M2 21h6M2 28h6M32 7h6M32 14h6M32 21h6M32 28h6",fill:"none",stroke:"color",strokeWidth:3}]},lt={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M23 1L7 23h10l-3 16 19-25H22z",fill:"color"}]},ut={viewBox:[48,40],anchor:[.5,.78],parts:[{d:"M7 12c0-4 3-7 7-7h20c4 0 7 3 7 7v15H7z",fill:"color"},{d:"M11 15h26v8H11z",fill:"accent",opacity:.9},{d:"M12 27h7v4h-7zM29 27h7v4h-7z",fill:"accent",opacity:.95},{d:"M12 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0M28 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0",fill:"color",stroke:"accent",strokeWidth:1.8},{d:"M5 13h4v8H5zM39 13h4v8h-4z",fill:"color"}]},dt="M 9.12,3.34 C 8.28,3.29 7.44,3.40 6.64,3.69 4.17,3.63 1.97,5.37 0.91,7.51 -1.32,11.80 2.55,17.76 8.19,16.55 11.62,16.13 15.55,14.04 16.17,10.33 16.38,6.53 12.77,3.52 9.12,3.34 Z M 9.35,19.86 C 8.89,19.84 8.41,19.92 7.92,20.11 5.12,21.55 3.72,24.68 2.79,27.54 2.32,29.86 0.87,32.04 1.36,34.49 1.63,37.60 8.04,38.95 8.04,38.95 8.04,38.95 14.67,39.65 16.50,36.33 17.16,31.95 16.34,27.23 14.01,23.42 13.07,21.69 11.36,19.92 9.35,19.86 Z",ht={viewBox:[18,40],anchor:[.5,1],parts:[{d:dt,fill:"color",stroke:"color",strokeWidth:1.4}]},ft={server:st,chip:ct,bolt:lt,bus:ut,person:ht},mt="var(--semiotic-primary, #4e79a7)",pt="var(--semiotic-border, #d1d5db)";function yt(t){return"object"==typeof t&&null!==t&&"tokens"in t&&"encoding"in t}function gt(t,e,n){return"function"==typeof t?t(e)??n:t??n}function xt(t,e){return"function"==typeof t?t(e):t}function bt(t){return t.sample??t.value??t.index}var wt=new Set(J);function Mt(t,e){return void 0!==e.datum?gt(e.datum,t,null):t.datum??null}function vt(t,e){return{fill:!1!==t.highlighted?"scenario"===t.range?gt(e.rangeColor,t,"var(--semiotic-secondary, #9ca3af)"):gt(e.color,t,mt):gt(e.inactiveColor,t,pt),stroke:"none",...xt(e.style,t)??{}}}function kt(t,e){const n=xt(e.pointId,t)??(e.idPrefix?`${e.idPrefix}-${"scenario"===t.range?"range-":""}${t.index}`:void 0);return{datum:Mt(t,e),accessibleDatum:xt(e.accessibleDatum,t),accessibility:xt(e.accessibility,t),pointId:n,_transitionKey:n}}function $t({input:t,encoding:e,options:n={}}){if(!yt(t)&&!e)throw Error("tokenLayer requires an encoding when input is not a TokenSet.");const o=yt(t)?{...t,encoding:F(t.encoding)}:O(t,e),r=function(t,e){const n=e.includeRange&&t.rangeTokens?[...t.tokens,...t.rangeTokens]:t.tokens;if(e.positionToken)return function(t,e){const n=e.positionToken;return n?t.map((e,o)=>{const r=n(e,o,t);return{...e,x:r.x,y:r.y,row:r.row??o,column:r.column??0}}):[]}(n,e);const o=e.layout??t.encoding.layout??"grid";if("quantile-strip"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),i=e.gutter??2,a=Math.max(1,Math.floor(e.rows??1)),s=t.map(bt),c=Math.min(...s),l=Math.max(...s)-c||1;return t.map((s,u)=>{const d=bt(s),h=u%a,f=e.valueToX?e.valueToX(d,s):n+(d-c)/l*(e.width??12*Math.max(1,t.length-1)),m=e.valueToY?e.valueToY(d,s):o+h*(r+i);return{...s,x:f,y:m,row:h,column:u}})}(n,e);if("dotplot"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r="number"==typeof e.tokenSize?e.tokenSize:12,i=e.gutter??2,a=e.cellWidth??r+i,s=e.cellHeight??r+i,c=t.map(bt),l=Math.min(...c),u=Math.max(...c)-l||1,d=new Map;return t.map(r=>{const i=bt(r),c=e.valueToX?e.valueToX(i,r):n+(i-l)/u*(e.width??Math.max(1,t.length-1)*a),h=Math.round((c-n)/Math.max(1,a)),f=d.get(h)??0;d.set(h,f+1);const m=e.valueToY?e.valueToY(i,r):o+f*s;return{...r,x:n+h*a,y:m,row:f,column:h}})}(n,e);if("bar-segment"===o){if(!e.valueToX)throw Error('tokenLayer layout "bar-segment" requires valueToX and optionally valueToY.');return function(t,e){if(!e.valueToX)return[];const n=e.y??0,o=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),r=e.anchor??[.5,.5];return t.map((t,i)=>{const a=Number.isFinite(t.start)?t.start:bt(t),s=(a+(Number.isFinite(t.end)?t.end:a+t.value))/2,c=e.valueToY?e.valueToY(s,t):n+r[1]*o;return{...t,x:e.valueToX(s,t),y:c,row:0,column:i}})}(n,e)}if("beeswarm"===o||"small-multiple"===o)throw Error(`tokenLayer layout "${o}" is not implemented yet; use row, column, stack, grid, waffle, dotplot, quantile-strip, bar-segment with valueToX, or positionToken.`);const r="number"==typeof e.tokenSize?e.tokenSize:void 0,i=e.cellWidth??r??12,a=e.cellHeight??r??i,s="row"===o?Math.max(1,n.length):"column"===o||"stack"===o?1:"waffle"===o&&"fixed-denominator"===t.encoding.countStrategy&&100===t.denominator?10:function(t,e,n){if(e.columns)return e.columns;if(e.width&&n>0){const t=e.gutter??2;return Math.max(1,Math.floor((e.width+t)/(n+t)))}return t.length>0?Math.ceil(Math.sqrt(t.length)):1}(n,e,i);return P(n,{...e,columns:s,cellWidth:i,cellHeight:a})}(o,n).filter(t=>!n.include||n.include(t));return{tokenSet:o,positionedTokens:r,nodes:r.map(t=>function(t,e,n){if("dot"===n.tokenType)return function(t,e){const n=gt(e.tokenSize,t,12);return{type:"point",x:t.x,y:t.y,r:gt(e.radius,t,n/2),style:vt(t,e),...kt(t,e)}}(t,e);const o=xt(e.glyph,t)??function(t){if(t)return ft[t]}(n.icon);if(o)return function(t,e,n){const o=vt(t,n),r=gt(n.tokenSize,t,12);return{type:"glyph",x:t.x,y:t.y,size:r,glyph:e,color:(o.fill??mt)+"",accent:gt(n.accent,t,"var(--semiotic-bg, #ffffff)"),fraction:1>t.fraction?t.fraction:void 0,fractionStart:t.startFraction>0?t.startFraction:void 0,fractionDirection:gt(n.fractionDirection,t,"horizontal"),ghostColor:1>t.fraction?xt(n.ghostColor,t)??pt:void 0,rotation:xt(n.rotation,t),style:o,...kt(t,n)}}(t,o,e);const r=(i=n.icon)&&wt.has(i)?i:void 0;var i;return function(t,e){const n=gt(e.tokenSize,t,12);return{type:"symbol",x:t.x,y:t.y,size:Math.PI*Math.max(1,n/2)**2,symbolType:gt(e.symbolType,t,"circle"),path:xt(e.symbolPath,t),rotation:xt(e.rotation,t),style:vt(t,e),...kt(t,e)}}(t,r&&null==e.symbolType?{...e,symbolType:r}:e)}(t,n,o.encoding))}}import{interpolateRgb as At}from"d3-interpolate";var St=864e5,It=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const o=t=>{const n="function"==typeof e.dateAccessor?e.dateAccessor(t):t[e.dateAccessor];return n instanceof Date?n:new Date(n)},r=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor];return Number(n)},i=new Map;let a=null;for(const e of t.data){const t=o(e);if(!isFinite(t.getTime()))continue;null==a&&(a=t.getUTCFullYear());const n=zt(t),s=r(e);i.set(n,(i.get(n)??0)+(Number.isFinite(s)?s:0))}const s=e.year??a??(new Date).getUTCFullYear();let c=1/0,l=-1/0;for(const t of i.values())c>t&&(c=t),t>l&&(l=t);c===1/0&&(c=0,l=0);const[u,d]=e.colorRamp??[t.theme.semantic.surface??"#ebedf0",t.theme.semantic.primary??"#216e39"],h=t=>{if(l===c)return u;const e=(t-c)/(l-c);return At(u,d)(e)},f=e.gutter??2,m=e.labelInset??0,p=Math.min((n.width-m-53*f)/54,(n.height-6*f)/7);if(0>=p)return{nodes:[]};const y=new Date(Date.UTC(s,0,1)),g=y.getUTCDay(),x=new Date(y.getTime()-g*St),b=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const o=new Date(x.getTime()+(7*t+e)*St);if(o.getUTCFullYear()!==s)continue;const r=zt(o),a=i.get(r),c=null==a?u:h(a);b.push({type:"rect",x:n.x+m+t*(p+f),y:n.y+e*(p+f),w:p,h:p,style:{fill:c,stroke:"none"},datum:{date:o,value:a??0}})}return{nodes:b}};function zt(t){return`${t.getUTCFullYear()}-${Nt(t.getUTCMonth()+1)}-${Nt(t.getUTCDate())}`}function Nt(t){return 10>t?"0"+t:t+""}import*as Ct from"react";import{jsx as Tt}from"react/jsx-runtime";var Et={isActive:!1,predicate:()=>!0},Wt=Ct.createContext(null);function Lt(){return Ct.useContext(Wt)??Et}import{jsx as Ft,jsxs as jt}from"react/jsx-runtime";var Rt={resource:32,city:64},Ot=["#739b58","#83a964","#668d52","#8baa68"],Pt={land:"#78985c",ocean:"#4d8192",forest:"#4f7c4b",grassland:"#8eaa68",cropland:"#a6a568",wetland:"#668f79",urban:"#8d8a72",scrub:"#9b9665",bare:"#aa906a",snow:"#d8ddcf"},qt={land:"Open land",ocean:"Open ocean",forest:"Forest",grassland:"Grassland",cropland:"Cropland",wetland:"Wetland",urban:"Urban district",scrub:"Scrubland",bare:"Bare ground",snow:"Snow cover"},Dt=new Set(["city","culture","monument","faith","nature","knowledge","defense","arena","transport"]);function Bt(t,e){if("function"==typeof t)return t;const n=t??e;return t=>t[n]}function Yt(t,e,n){return[111.32*(t-n.lon)*Math.cos((e+n.lat)/2*(Math.PI/180)),110.574*(e-n.lat)]}function Vt(t){const e=Math.max(3,Math.round(t??5));return e%2==0?e+1:e}function Ht(t){return Dt.has(t)?t:"monument"}function Xt(t,e){const n=Vt(e.gridSize),o=Math.max(1,e.gridRadiusKm??75),r=2*o/n,i=Math.floor(n/2),a=Bt(e.idAccessor,"id"),s=Bt(e.nameAccessor,"name"),c=Bt(e.longitudeAccessor,"lon"),l=Bt(e.latitudeAccessor,"lat"),u=Bt(e.kindAccessor,"kind"),d=e.candidatePriorityAccessor?Bt(e.candidatePriorityAccessor,"priority"):()=>0,h=new Map;let f=null;for(const m of t){const t=Number(c(m)),p=Number(l(m));if(!Number.isFinite(t)||!Number.isFinite(p))continue;const y=(a(m)??`${t},${p}`)+"",g=(s(m)??y)+"",x=Ht(u(m)),[b,w]=Yt(t,p,e.center);if(Math.abs(b)>o||Math.abs(w)>o)continue;const M=Math.min(n-1,Math.max(0,Math.floor((b+o)/r))),v=Math.min(n-1,Math.max(0,Math.floor((o-w)/r))),k=(M+.5)*r-o,$=o-(v+.5)*r,A={...m,id:y,name:g,kind:x,lon:t,lat:p,distanceKm:Math.sqrt(b*b+w*w),row:v,column:M,cellDistanceSq:(b-k)**2+(w-$)**2,candidatePriority:Number(d(m))||0};(null!=e.centerId&&y===e.centerId||!f&&"city"===x||!f&&v===i&&M===i)&&(f=A);const S=`${v}:${M}`,I=h.get(S)??[];I.push(A),h.set(S,I)}const m=new Map;f&&m.set("city",1);const p=[];for(let t=0;n>t;t++)for(let e=0;n>e;e++){const n=`tile-${t}-${e}`,a=(e+.5)*r-o,s=o-(t+.5)*r;let c,l;if(t===i&&e===i&&f){c=f;const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id).sort((t,e)=>t.candidatePriority-e.candidatePriority||t.cellDistanceSq-e.cellDistanceSq||t.name.localeCompare(e.name));l=[f,...n]}else{const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id);n.sort((t,e)=>{const n=t.candidatePriority-e.candidatePriority;if(0!==n)return n;const o=m.get(t.kind)??0,i=m.get(e.kind)??0,a=r*r*.35;return t.cellDistanceSq+o*a-(e.cellDistanceSq+i*a)||t.name.localeCompare(e.name)}),c=n[0]??null,l=n}c&&m.set(c.kind,(m.get(c.kind)??0)+1),p.push({id:n,row:t,column:e,centerXKm:a,centerYKm:s,terrainIndex:Math.abs((17*t+31*e)%Ot.length),landmark:c,landmarks:l})}return p}var _t=t=>{const e=Vt(t.config.gridSize),n=Math.max(20,t.config.tileWidth??80),o=Math.max(10,t.config.tileHeight??40),r=t.config.terrainColors?.length?t.config.terrainColors:Ot,i=t.dimensions.width/2,a=(t.dimensions.height-e*o)/2+o/2,s=Xt(t.points,t.config).map(t=>({...t,x:i+n/2*(t.column-t.row),y:a+(t.column+t.row)*(o/2)}));return{nodes:s.map(e=>{const i=t.config.terrainByCell?.[e.id],a="string"==typeof i?{kind:i}:i,s="city"===e.landmark?.kind?"urban":a?.kind??"land",c=a?.fill??t.config.terrainPalette?.[s]??Pt[s],l=e.landmark?{...e.landmark,gridRow:e.row,gridColumn:e.column,cellId:e.id,terrainKind:s,terrainCoverage:a?.coverage,features:e.landmarks,featureCount:e.landmarks.length}:{id:e.id,name:qt[s],kind:"terrain",terrainKind:s,terrainCoverage:a?.coverage,gridRow:e.row,gridColumn:e.column,cellId:e.id,features:[],featureCount:0};return{type:"geoarea",pathData:(u=e.x,d=e.y,h=n,f=o,`M${u},${d-f/2}L${u+h/2},${d}L${u},${d+f/2}L${u-h/2},${d}Z`),centroid:[e.x,e.y],bounds:[[e.x-n/2,e.y-o/2],[e.x+n/2,e.y+o/2]],screenArea:n*o/2,style:{fill:a||"urban"===s?c:r[e.terrainIndex%r.length],stroke:"ocean"===s?"#315d6c":t.config.tileStroke??"#314934",strokeWidth:1},datum:l,group:e.landmark?.kind??s,interactive:!0};var u,d,h,f}),overlays:Ft(Gt,{tiles:s,tileWidth:n,tileHeight:o,sprites:t.config.sprites,resourceSize:t.config.resourceSpriteSize??32,citySize:t.config.citySpriteSize??64,showCityLabel:!1!==t.config.showCityLabel}),restyle:(t,e)=>e?.isActive&&t.datum&&"terrain"!==t.datum.kind?{fillOpacity:e.predicate(t.datum)?1:.28}:{fillOpacity:1}}};function Gt({tiles:t,tileWidth:e,tileHeight:n,sprites:o,resourceSize:r,citySize:i,showCityLabel:a}){const s=Lt(),c=t.filter(t=>t.landmark).sort((t,e)=>t.y-e.y||t.x-e.x);return jt("g",{"aria-hidden":"true",pointerEvents:"none",children:[c.map(t=>{const a=t.landmark,c="city"===a.kind?i:r,l=t.y+n/2,u=s.isActive&&!s.predicate(a)?.28:1;return jt("g",{opacity:u,children:[Ft("ellipse",{cx:t.x,cy:t.y+.15*n,rx:.28*c,ry:.1*c,fill:"#17251d",opacity:.32}),Ft(Zt,{kind:a.kind,href:o?.[a.kind],x:t.x-c/2,y:l-c,size:c}),t.landmarks.length>1&&Ft(Ut,{x:t.x+.3*e,y:t.y-.19*n,count:t.landmarks.length-1,tileHeight:n})]},a.id)}),a&&c.filter(t=>"city"===t.landmark?.kind).map(t=>{const e=t.landmark.name.toUpperCase(),o=Math.max(56,6.4*e.length+14);return jt("g",{transform:`translate(${t.x},${t.y+.72*n})`,children:[Ft("rect",{x:-o/2,y:-7,width:o,height:14,rx:1,fill:"#17251d",opacity:.92}),Ft("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:9,fontWeight:700,letterSpacing:.8,children:e})]},t.landmark.id+"-label")})]})}function Ut({x:t,y:e,count:n,tileHeight:o}){const r=Math.max(10,Math.min(15,.34*o)),i="+"+n,a=Math.max(r,i.length*r*.58);return jt("g",{transform:`translate(${t},${e})`,children:[Ft("rect",{x:-a/2,y:-r/2,width:a,height:r,rx:1,fill:"#17251d",stroke:"#f0d36d",strokeWidth:1}),Ft("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:Math.max(7,.62*r),fontWeight:700,children:i})]})}var Kt={city:["..1111..","..1221..",".111111.",".133331.","11111111","13311331","14411441","11111111"],culture:["..1111..",".122221.","11111111",".133331.",".133331.",".133331.","11111111",".444444."],monument:["...11...","..1221..","..1221..","..1331..",".113311.",".133331.","11111111",".444444."],faith:["...11...","...11...","..1111..","...11...","..1221..",".133331.","11111111",".444444."],nature:["...11...","..1221..",".122221.","12222221",".133331.","...11...","..1441..",".144441."],knowledge:[".111111.","12211221","12211221","13311331","13311331","13311331","11111111",".444444."],defense:["11.11.11","11111111","12222221","12211221","13311331","13333331","11111111",".444444."],arena:["..1111..",".122221.","12333321","12344321","12344321","12333321",".122221.","..1111.."],transport:["...11...","..1221..",".122221.","11111111","..1331..","..1331..",".114411.","11444411"]},Qt={city:{1:"#29364a",2:"#d8b45b",3:"#b7693c",4:"#6d9fc5"},culture:{1:"#29364a",2:"#d5c9a3",3:"#9c6fb2",4:"#ece3c4"},monument:{1:"#29364a",2:"#d8cba8",3:"#9c8f79",4:"#ece3c4"},faith:{1:"#29364a",2:"#d9c36d",3:"#a877a5",4:"#ece3c4"},nature:{1:"#29364a",2:"#4f8a4e",3:"#79aa56",4:"#79583a"},knowledge:{1:"#29364a",2:"#d5c9a3",3:"#4f7da0",4:"#ece3c4"},defense:{1:"#29364a",2:"#a6a298",3:"#777b7f",4:"#d5c9a3"},arena:{1:"#29364a",2:"#cb8056",3:"#d8cba8",4:"#6d9fc5"},transport:{1:"#29364a",2:"#d8b45b",3:"#6d9fc5",4:"#ece3c4"}};function Zt({kind:t,href:e,x:n,y:o,size:r}){if(e)return Ft("image",{href:e,x:n,y:o,width:r,height:r,preserveAspectRatio:"xMidYMax meet",style:{imageRendering:"pixelated"}});const i=Qt[t];return Ft("svg",{x:n,y:o,width:r,height:r,viewBox:"0 0 8 8",shapeRendering:"crispEdges",children:Kt[t].flatMap((t,e)=>[...t].map((t,n)=>"."===t?null:Ft("rect",{x:n,y:e,width:1,height:1,fill:i[t]},`${e}-${n}`)))})}var Jt=t=>{const e=t.config,o=e.nodeWidth??80,r=e.nodeHeight??30,i=e.orientation??"vertical",a=e.edgeCurve??"curved",s=!1!==e.showLabels,c=e.labelAccessor??"id",l="function"==typeof c?c:t=>n(t,c,t.id??"")+"",u=new Map,d=[],h=[],f=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??o,h:("number"==typeof e.height?e.height:t.height)??r}};for(const n of t.nodes){const{x:o,y:r,w:i,h:a}=f(n);null!=o&&null!=r&&(u.set(n.id,{x:o,y:r,w:i,h:a}),d.push({type:"rect",x:o-i/2,y:r-a/2,w:i,h:a,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-surface, ${t.theme.semantic.surface??"#fff"})`,strokeWidth:1.5},datum:n,id:n.id,label:l(n)+""}),s&&h.push({x:o,y:r,text:l(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const m=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=u.get("string"==typeof e.source?e.source:e.source.id),r=u.get(n);if(!o||!r)continue;const s="vertical"===i?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},c="vertical"===i?{x:r.x,y:r.y-r.h/2}:{x:r.x-r.w/2,y:r.y};if("line"===a)m.push({type:"line",x1:s.x,y1:s.y,x2:c.x,y2:c.y,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1},datum:e});else{const n=(s.y+c.y)/2,o=(s.x+c.x)/2;m.push({type:"curved",pathD:"vertical"===i?`M${s.x},${s.y} C${s.x},${n} ${c.x},${n} ${c.x},${c.y}`:`M${s.x},${s.y} C${o},${s.y} ${o},${c.y} ${c.x},${c.y}`,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:d,sceneEdges:m,labels:h}},te=t=>{const e=t.config,o=e.nodeWidth??100,r=e.nodeHeight??36,i=e.edgeStyle??"polyline",a=!1!==e.showLabels,s=e.labelAccessor??"label",c="function"==typeof s?s:t=>n(t,s,t.id??"")+"",l=new Map,u=[],d=[],h=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??o,h:("number"==typeof e.height?e.height:t.height)??r}};for(const n of t.nodes){const{x:o,y:r,w:i,h:s}=h(n);null!=o&&null!=r&&(l.set(n.id,{x:o,y:r,w:i,h:s}),u.push({type:"rect",x:o-i/2,y:r-s/2,w:i,h:s,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#888"})`,strokeWidth:1.5},datum:n,id:n.id,label:c(n)+""}),a&&d.push({x:o,y:r,text:c(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const f=e.edgeStroke??`var(--semiotic-border, ${t.theme.semantic.border??"#666"})`,m=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=l.get("string"==typeof e.source?e.source:e.source.id),o=l.get(t);if(!n||!o)continue;const r=e.data??{},a=Array.isArray(r.points)?r.points:e.points;if(a&&a.length>=2)if("smooth"!==i||3>a.length){const t="M"+a.map(t=>`${t.x},${t.y}`).join(" L ");m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${a[0].x},${a[0].y}`;for(let e=1;a.length-1>e;e++)t+=` Q${a[e].x},${a[e].y} ${(a[e].x+a[e+1].x)/2},${(a[e].y+a[e+1].y)/2}`;const n=a[a.length-1];t+=` T${n.x},${n.y}`,m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else m.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:f,strokeWidth:1},datum:e})}return{sceneNodes:u,sceneEdges:m,labels:d}};import{jsx as ee,jsxs as ne}from"react/jsx-runtime";var oe={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},re={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function ie(t){return Array.isArray(t)?t.map((t,e)=>"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(t.storeName??"")+"",slotIndex:t.slotIndex??e}):[]}var ae=t=>{const e=t.config||{},o=t.dimensions.plot,r=e.layerAccessor??"x",i=e.rowAccessor??"y",a=e.partitionAccessor??"partition",s=e.semanticAccessor??"semantic",c=e.labelAccessor??"label",l=e.storesAccessor??"stores",u=e.backEdgeAccessor??"isBackEdge",d=e.edgeTypeAccessor??"edgeType",h={...oe,...e.partitionColors},f={...re,...e.edgeColors},m=e.accentColor??"var(--semiotic-focus, #ffcc33)",p=e.borderColor??"var(--semiotic-border, #555)",y=e.dimOpacity??.14,g=e.edgeOpacity??.5,x=e.edgeWidth??1.25,b=e.backEdgeWidth??e.edgeWidth??1.5,w=!1!==e.showStoreChips,M=e.storeChipColor??"var(--semiotic-info, #6a8caf)";let v=e.layerCount,k=e.maxLayerSize;if(null==v||null==k){let e=0;const o=new Map;for(const i of t.nodes){const t=Math.round(Number(n(i,r,0)));e=Math.max(e,t),o.set(t,(o.get(t)??0)+1)}v=v??e+1,k=k??Math.max(1,...o.values())}const $=o.width/Math.max(1,v),A=o.height/Math.max(1,k);let S=Math.min(e.nodeWidth??172,Math.max(8,$-(e.minGapX??26))),I=Math.min(e.nodeHeight??54,Math.max(8,A-(e.minGapY??18)));const z=e.lod&&"auto"!==e.lod?e.lod:16>S?"dot":48>S?"icon":108>S?"compact":"full";if("dot"===z){const t=Math.min(S,I,11);S=t,I=t}const N=Math.max(1,o.width-S),C=Math.max(1,o.height-I),T=Math.max(1,k-1),E=t=>o.x+S/2+(v>1?t/(v-1):.5)*N,W=t=>o.y+I/2+(t+T/2)/T*C,L=e.reachableIds?new Set(e.reachableIds):null,F=e.selectedId??null,j=t.selection,R=new Map,O=new Map,P=[],q=[];for(const e of t.nodes){const t=e.id,o=Number(n(e,r,0)),u=Number(n(e,i,0)),d=n(e,a,"processor")+"",f=n(e,s,"processor")+"",g=n(e,c,t)+"",x=ie(n(e,l,[])),b=e.data??e,w=E(o),M=W(u);R.set(t,{cx:w,cy:M});const v=L?L.has(t):null,k=j?.isActive?j.predicate(b):null,$=null!==v?!v:null!==k&&!k;O.set(t,$);const A=null!=F&&t===F,N=$&&!A?y:1,C=h[d]??h.unknown;"dot"===z?P.push({type:"circle",cx:w,cy:M,r:S/2,style:{fill:C,opacity:N,stroke:A?m:"transparent",strokeWidth:A?2:0},datum:e,id:t,label:g}):(P.push({type:"rect",x:w-S/2,y:M-I/2,w:S,h:I,style:{fill:C,opacity:N,stroke:A?m:p,strokeWidth:A?3:1},datum:e,id:t,label:g}),q.push({id:t,cx:w,cy:M,partition:d,semantic:f,label:g,stores:x,opacity:N,selected:A,node:b}))}const D=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,r=R.get(t),i=R.get(o);if(!r||!i)continue;const a=!!n(e,u,!1),s=n(e,d,"internal")+"",c=O.get(t)||O.get(o)?Math.min(g,1.4*y):g,l=a?f.back:f[s]??f.internal;let h;if(a){const t=r.cx,e=r.cy+I/2,n=i.cx,o=i.cy+I/2,a=Math.max(48,.28*Math.abs(t-n))+I;h=`M${t},${e} C${t},${e+a} ${n},${o+a} ${n},${o}`}else{const t=r.cx+S/2,e=r.cy,n=i.cx-S/2,o=i.cy,a=(t+n)/2;h=`M${t},${e} C${a},${e} ${a},${o} ${n},${o}`}const m={type:"curved",pathD:h,style:{stroke:l,strokeWidth:a?b:x,fill:"none",opacity:c,...a?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}},datum:e};D.push(m)}const B=0===q.length?null:ee("g",{className:"lineage-dag-glyphs",children:q.map(t=>function(t,e){const{w:n,h:o,lod:r}=e,i="icon"===r?Math.min(n,o):Math.min(o-14,26),a="icon"===r?0:8+i+8,s=null!=e.renderIcon?e.renderIcon({semantic:t.semantic,partition:t.partition,size:i,color:e.partColors[t.partition]??e.partColors.unknown??"#5a5a6a",node:t.node}):function(t,e,n){const o=e.startsWith("topic")?"T":{source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t]??"PR";return ne("g",{children:[ee("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),ee("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:o})]})}(t.semantic,t.partition,i),c="full"===r,l="icon"!==r,u="full"===r&&e.showChips&&t.stores.length>0;return ne("g",{transform:`translate(${t.cx-n/2}, ${t.cy-o/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[ee("g",{transform:`translate(${"icon"===r?(n-i)/2:8}, ${(o-i)/2})`,children:s}),l&&ee("foreignObject",{x:a,y:c?o/2-12:o/2-9,width:Math.max(8,n-a-8),height:18,style:{pointerEvents:"none"},children:ee("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===r?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),c&&ee("text",{x:a,y:o/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:e.typeLabel?e.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),u&&t.stores.map((t,n)=>ee("rect",{x:a+15*n,y:o-10,width:12,height:5,rx:1.5,fill:e.chipColor,children:ee("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:S,h:I,lod:z,partColors:h,chipColor:M,showChips:w,renderIcon:e.renderIcon,typeLabel:e.typeLabel}))});return{sceneNodes:P,sceneEdges:D,overlays:B}};import{jsx as se,jsxs as ce}from"react/jsx-runtime";function le(t,e){return t.length>e?t.slice(0,Math.max(1,e-1))+"…":t}var ue={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function de(t,e,n,o,r,i,a,s){const c=e-o/2,l=n-r/2,u={fill:i,stroke:a,strokeWidth:s};switch(t){case"diamond":return se("polygon",{points:`${e},${l} ${e+o/2},${n} ${e},${n+r/2} ${c},${n}`,...u});case"circle":return se("circle",{cx:e,cy:n,r:Math.min(o,r)/2,...u});case"stadium":case"round":return se("rect",{x:c,y:l,width:o,height:r,rx:"stadium"===t?r/2:8,ry:"stadium"===t?r/2:8,...u});case"hexagon":{const t=Math.min(.18*o,16);return se("polygon",{points:`${c+t},${l} ${e+o/2-t},${l} ${e+o/2},${n} ${e+o/2-t},${n+r/2} ${c+t},${n+r/2} ${c},${n}`,...u})}case"cylinder":{const t=Math.min(.16*r,8),e=`M${c},${l+t} a${o/2},${t} 0 0 1 ${o},0`;return ce("g",{children:[se("path",{d:`M${c},${l+t} a${o/2},${t} 0 0 0 ${o},0 v${r-2*t} a${o/2},${t} 0 0 1 ${-o},0 z`,...u}),se("path",{d:e,fill:"none",stroke:a,strokeWidth:s})]})}case"subroutine":{const t=Math.min(8,.08*o);return ce("g",{children:[se("rect",{x:c,y:l,width:o,height:r,rx:3,...u}),se("line",{x1:c+t,y1:l,x2:c+t,y2:l+r,stroke:a,strokeWidth:s}),se("line",{x1:c+o-t,y1:l,x2:c+o-t,y2:l+r,stroke:a,strokeWidth:s})]})}default:return se("rect",{x:c,y:l,width:o,height:r,rx:4,...u})}}var he=t=>{const e=t.config||{},o=t.dimensions.plot,r=e.direction??"TD",i="LR"===r||"RL"===r,a="BT"===r||"RL"===r,s=e.layerAccessor??"layer",c=e.rowAccessor??"row",l=e.labelAccessor??"label",u=e.shapeAccessor??"shape",d=e.edgeLabelAccessor??"label",h=e.nodeFill??"var(--semiotic-surface, #20242d)",f=e.nodeStroke??"var(--semiotic-border, #5a6573)",m=e.textColor??"var(--semiotic-text, #e6e6e6)",p=e.edgeColor??"var(--semiotic-text-secondary, #9aa0a6)",y=e.accentColor??"var(--semiotic-warning, #d49a00)";if(0===t.nodes.length)return{sceneNodes:[],overlays:null};const g=new Map;let x=0;for(const e of t.nodes){const t=Math.round(Number(n(e,s,0)));x=Math.max(x,t);const o=g.get(t)||[];o.push(e),g.set(t,o)}const b=x+1;let w=1;for(const t of g.values())t.sort((t,e)=>Number(n(t,c,0))-Number(n(e,c,0))),w=Math.max(w,t.length);const M=i?o.width:o.height,v=i?o.height:o.width,k=M/b,$=v/(w+1),A=Math.max(44,Math.min(e.nodeWidth??150,i?k-36:.92*$)),S=Math.max(26,Math.min(e.nodeHeight??46,i?.7*$:.5*k)),I=(i?A:S)/2+6,z=Math.max(1,M-2*I),N=t=>(i?o.x:o.y)+I+(b>1?(a?b-1-t:t)/(b-1)*z:z/2),C=new Map,T=[],E=[];for(const[t,e]of g)e.forEach((r,a)=>{const s=N(t),c=(i?o.y:o.x)+(a+1)/(e.length+1)*v,d=i?s:c,p=i?c:s,g=n(r,u,"rect")+"",x=n(r,l,r.id)+"";C.set(r.id,{cx:d,cy:p,shape:g}),T.push({type:"rect",x:d-A/2,y:p-S/2,w:A,h:S,style:{fill:"transparent",stroke:"transparent"},datum:{id:r.id,name:x,type:ue[g]??"process",shape:g},id:r.id,label:x}),E.push(ce("g",{children:[de(g,d,p,A,S,h,"diamond"===g?y:f,1.5),se("text",{x:d,y:p,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:m,style:{pointerEvents:"none"},children:le(x,Math.max(4,Math.floor((A-12)/7)))})]},"n-"+r.id))});const W=[];return t.edges.forEach((t,e)=>{const o="string"==typeof t.target?t.target:t.target.id,r=C.get("string"==typeof t.source?t.source:t.source.id),a=C.get(o);if(!r||!a)return;const s=i?r.cx+A/2:r.cx,c=i?r.cy:r.cy+S/2,l=i?a.cx-A/2:a.cx,u=i?a.cy:a.cy-S/2,h=i?`M${s},${c} C${(s+l)/2},${c} ${(s+l)/2},${u} ${l},${u}`:`M${s},${c} C${s},${(c+u)/2} ${l},${(c+u)/2} ${l},${u}`,y=Math.atan2(u-c,l-s),g=l-9*Math.cos(y),x=u-9*Math.sin(y),b=4.5*-Math.sin(y),w=4.5*Math.cos(y),M=`${l},${u} ${g+b},${x+w} ${g-b},${x-w}`,v=n(t,d,void 0),k=(s+l)/2,$=(c+u)/2;W.push(ce("g",{children:[se("path",{d:h,fill:"none",stroke:p,strokeWidth:1.4}),se("polygon",{points:M,fill:p}),"string"==typeof v&&v.length>0&&ce("g",{children:[se("rect",{x:k-6.5*v.length/2-4,y:$-9,width:6.5*v.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:f,strokeWidth:.75}),se("text",{x:k,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:m,style:{pointerEvents:"none"},children:v})]})]},"e-"+e))}),{sceneNodes:T,overlays:ce("g",{className:"mermaid-dag",children:[W,E]})}};import{jsx as fe,jsxs as me}from"react/jsx-runtime";function pe(t){return fe("rect",{className:t.className,x:t.x,y:t.y,width:Math.max(0,t.width),height:Math.max(0,t.height),rx:t.radius??10,ry:t.radius??10,fill:t.fill??"none",stroke:t.stroke,strokeWidth:t.strokeWidth??1.5,strokeDasharray:t.strokeDasharray,opacity:t.opacity??.6,style:{pointerEvents:"none"}},t.keyId)}function ye(t,e=0){let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of t){const t=e.r??0;n>e.x-t&&(n=e.x-t),e.x+t>r&&(r=e.x+t),o>e.y-t&&(o=e.y-t),e.y+t>i&&(i=e.y+t)}return Number.isFinite(n)?{x:n-e,y:o-e,width:r-n+2*e,height:i-o+2*e}:null}function ge(t){const e=t.fontSize??12;return null!=t.maxWidth&&t.text.length*e*.56>t.maxWidth?null:fe("text",{className:t.className,x:t.x,y:t.y,textAnchor:t.anchor??"middle",dominantBaseline:t.baseline??"middle",fontSize:e,fontWeight:t.fontWeight,fill:t.color,style:{pointerEvents:"none"},children:t.text},t.keyId)}function xe(t){const e=t.spacing??8;return{def:fe("pattern",{id:t.id,width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${t.angle??45})`,children:fe("line",{x1:0,y1:0,x2:0,y2:e,stroke:t.color??"currentColor",strokeWidth:t.strokeWidth??1,opacity:t.opacity??.5})},t.id),fill:`url(#${t.id})`}}function be(t){const e=t.orient??"bottom",n="bottom"===e||"top"===e,o=t.offset??0,r=t.tickLength??6,i=t.gridLength??0,a=t.labelGap??4,s=t.fontSize??11,c=t.color??"var(--semiotic-text-secondary, #888)",l=t.gridColor??c,u=t.format??(t=>t+""),d="top"===e||"left"===e?-1:1,h=t.ticks.length-1,f=t.ticks.map((f,m)=>{const p=t.scale(f),y=o+d*r,g=o-d*i,x=y+d*a;let b;b=t.labelAnchor?t.labelAnchor:n?t.edgeAnchor&&0===m?"start":t.edgeAnchor&&m===h?"end":"middle":"left"===e?"end":"start";const w=n?"top"===e?"auto":"hanging":"middle",M=n?{x:p,y:x}:{x:x,y:p};return me("g",{children:[(r>0||i>0)&&fe("line",{...n?{x1:p,x2:p,y1:y,y2:g}:{x1:y,x2:g,y1:p,y2:p},stroke:i>0?l:c,strokeWidth:1,strokeDasharray:i>0?t.gridDasharray:void 0,opacity:i>0?.7:1}),fe("text",{x:M.x,y:M.y,textAnchor:b,dominantBaseline:w,fontSize:s,fontWeight:t.fontWeight,fill:c,children:u(f)})]},`tick-${f}-${m}`)});return fe("g",{className:t.className,style:{pointerEvents:"none"},children:f},t.keyId)}function we(t){const e=t.stroke??"var(--semiotic-text, #f4f4f8)",n=t.strokeWidth??1,o=t.markRadius??0,r=t.labelX-t.markX,i=t.labelY-t.markY,a=Math.hypot(r,i)||1,s=t.markX+r/a*o,c=t.markY+i/a*o;let l;return l="elbow"===t.connector?`M${s},${c} L${s},${t.labelY} L${t.labelX},${t.labelY}`:"curve"===t.connector?`M${s},${c} Q${(s+t.labelX)/2},${c} ${t.labelX},${t.labelY}`:`M${s},${c} L${t.labelX},${t.labelY}`,me("g",{className:t.className,style:{pointerEvents:"none"},children:[o>0&&fe("circle",{cx:t.markX,cy:t.markY,r:o,fill:"none",stroke:e,strokeWidth:n}),fe("path",{d:l,fill:"none",stroke:e,strokeWidth:n}),fe("text",{x:t.labelX,y:t.labelY,textAnchor:t.labelAnchor??"middle",dominantBaseline:t.labelBaseline??"hanging",fontSize:t.fontSize??11,fontWeight:t.fontWeight,fill:t.color??e,children:t.label})]},t.keyId)}import{jsx as Me,jsxs as ve}from"react/jsx-runtime";var ke=new l(12);function $e(t){if(null==t)return NaN;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=t+"",n=Number(e);if(!Number.isNaN(n)&&""!==e.trim())return n;const o=Date.parse(e);return Number.isNaN(o)?NaN:o}function Ae(t,e,n){return e>t?e:t>n?n:t}var Se=t=>{const e=t.config||{},o=t.dimensions.plot,i=e.columnAccessor??"column",a=e.rowAccessor??"row",l=e.sizeAccessor,d=e.colorAccessor,h=e.symbolAccessor,f=e.shadeAccessor,m=e.markerAccessor,p=e.iconAccessor,y=e.defaultSymbol??"circle",[g,x]=e.sizeRange??[2,8],b=e.shadeStrength??.72,w=e.shadeReverse??!1,M=e.rowMode??"banded",v=e.cellSizing??"proportional",k=e.proportionExponent??1,$=e.columnGap??16,A=e.rowGap??12,S=e.packPadding??1,I=e.iterations??12,z=!1!==e.showEnclosures,N=!1!==e.showColumnHeaders,C=!1!==e.showRowLabels,T=N?e.headerHeight??26:0,E=C?e.labelWidth??66:0,W=e.callouts&&e.callouts.length>0?e.footerHeight??30:0,L=o.x+E,F=o.y+T,j=Math.max(1,o.width-E),R=Math.max(1,o.height-T-W),O=[];for(const e of t.nodes){const t=e.data??e;O.push({id:e.id,col:n(e,i,"—")+"",row:n(e,a,"—")+"",sizeVal:l?Number(n(e,l,1)):1,colorKey:d?n(e,d,"")+"":"",symVal:h?n(e,h,"")+"":"",shadeVal:f?$e(n(e,f,null)):NaN,marker:!!m&&!!n(e,m,!1),iconVal:p?n(e,p,"")+"":"",datum:t,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===O.length)return{sceneNodes:[]};let P=1/0,q=-1/0;if(l)for(const t of O)Number.isFinite(t.sizeVal)&&(P>t.sizeVal&&(P=t.sizeVal),t.sizeVal>q&&(q=t.sizeVal));e.sizeDomain&&([P,q]=e.sizeDomain),Number.isFinite(P)&&Number.isFinite(q)||(P=0,q=1);const D=t=>{if(P>=q)return(g+x)/2;const e=Math.sqrt(Ae((t-P)/(q-P),0,1));return g+e*(x-g)};let B=1/0,Y=-1/0;if(f)for(const t of O)Number.isFinite(t.shadeVal)&&(B>t.shadeVal&&(B=t.shadeVal),t.shadeVal>Y&&(Y=t.shadeVal));e.shadeDomain&&([B,Y]=e.shadeDomain);const V=t=>{if(!f||!Number.isFinite(t)||B>=Y)return.5;const e=Ae((t-B)/(Y-B),0,1);return w?1-e:e},H=e.colorMap,X=new Map,_=(e,n)=>{let o=X.get(e);return o||(o=u(H&&H[e]||t.resolveColor(e),b),X.set(e,o)),o(n)},G=new Map;if(e.symbolMap)for(const[t,n]of Object.entries(e.symbolMap))G.set(t,n);let U=0;const K=e.iconMap,Q=t=>p&&K&&K[t]?K[t]:null,Z=t=>p?"circle":(t=>{if(!h)return y;let e=G.get(t);return e||(e=J[U%J.length],U++,G.set(t,e)),e})(t.symVal),et=e.maxAreaFraction??.4;let nt=0;const rt=Array(O.length),it=Array(O.length);for(let t=0;O.length>t;t++){const e=O[t],n=D(e.sizeVal);rt[t]=n,e.baseShape=Z(e),e.iconShape=Q(e.iconVal);const o=ot(e.baseShape,Math.PI*n*n);it[t]=o,nt+=Math.PI*o*o}const at=et*j*R,st=nt>at?Math.sqrt(at/nt):1;for(let t=0;O.length>t;t++){const e=O[t],n=rt[t]*st;e.size=Math.PI*n*n,e.packR=it[t]*st}const ct=new Map,lt=new Map;for(const t of O)ct.set(t.col,(ct.get(t.col)??0)+1),lt.set(t.row,(lt.get(t.row)??0)+1);const ut=e.columnOrder?.filter(t=>ct.has(t))??[...ct.keys()].sort((t,e)=>(ct.get(e)??0)-(ct.get(t)??0)),dt=e.rowOrder?.filter(t=>lt.has(t))??[...lt.keys()].sort((t,e)=>(lt.get(e)??0)-(lt.get(t)??0)),ht=c([Math.round(o.x),Math.round(o.y),Math.round(o.width),Math.round(o.height),T,E,W,M,v,k,$,A,S,I,g,x,P,q,et,ut.join(","),dt.join(","),O.length,ze(O)]),ft=ke.getOrCompute(ht,()=>function(t,e){const n=new Map;for(const e of t){let t=n.get(e.col);t||(t=[],n.set(e.col,t)),t.push(e)}const o=e.columnOrder.filter(t=>n.has(t)),i=Math.max(1,e.innerW-e.columnGap*Math.max(0,o.length-1)),a=e.proportionExponent,s=o.map(t=>Math.pow(n.get(t).length,a)),c=s.reduce((t,e)=>t+e,0)||1,l=t=>"uniform"===e.cellSizing?i/o.length:s[t]/c*i,u=new Map,d=[];let h=e.innerX;for(let t=0;o.length>t;t++)d.push({col:o[t],x:h,w:l(t)}),h+=l(t)+e.columnGap;let f=1;const m=new Map,p=[],y=(t,e,n,o)=>{let r=m.get(t);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(t,r)),r.minX>e-o&&(r.minX=e-o),e+o>r.maxX&&(r.maxX=e+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},g=(t,n,o,r,i,a)=>{const s=t.map(t=>({id:t.id,r:t.packR})),c=function(t,e,n,o,r,i,a,s){const c=e+o/2,l=n+r/2,u=new Map,d=t.length;if(0===d)return u;if(1===d)return u.set(t[0].id,{px:c,py:l}),u;const h=function(t){let e=t>>>0||1;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}(s),f=new Float64Array(d);let m=0;for(let e=0;d>e;e++)f[e]=t[e].r+i,f[e]>m&&(m=f[e]);const p=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),y=new Float64Array(d),g=new Float64Array(d),x=o/p,b=r/Math.ceil(d/p);for(let t=0;d>t;t++){const o=t%p,r=Math.floor(t/p);y[t]=e+(o+.3+.4*h())*x,g[t]=n+(r+.3+.4*h())*b}const w=Math.max(0,Math.min(a,14)),M=Math.max(1,2*m),v=new Map,k=Math.max(1,Math.ceil(o/M)+3),$=(t,e)=>(e+1)*k+(t+1);for(let t=0;w>t;t++){v.clear();for(let t=0;d>t;t++){const o=$(Math.floor((y[t]-e)/M),Math.floor((g[t]-n)/M)),r=v.get(o);r?r.push(t):v.set(o,[t])}for(let t=0;d>t;t++){const o=Math.floor((y[t]-e)/M),r=Math.floor((g[t]-n)/M);for(let e=-1;1>=e;e++)for(let n=-1;1>=n;n++){const i=v.get($(o+e,r+n));if(i)for(let e=0;i.length>e;e++){const n=i[e];if(t>=n)continue;let o=y[n]-y[t],r=g[n]-g[t];const a=f[t]+f[n],s=o*o+r*r;if(a*a>s)if(s>1e-9){const e=Math.sqrt(s),i=(a-e)/2;o/=e,r/=e,y[t]-=o*i,g[t]-=r*i,y[n]+=o*i,g[n]+=r*i}else{const e=2.39996323*t;y[t]+=Math.cos(e)*f[t],g[t]+=Math.sin(e)*f[t]}}}}for(let t=0;d>t;t++){const i=f[t],a=e+i,s=e+o-i,u=n+i,d=n+r-i;y[t]=s>a?Ae(y[t],a,s):c,g[t]=d>u?Ae(g[t],u,d):l}}for(let e=0;d>e;e++)u.set(t[e].id,{px:y[e],py:g[e]});return u}(s,n,o,r,i,e.packPadding,e.iterations,f++);let l=1/0,d=1/0,h=-1/0,m=-1/0;for(const t of s){const e=c.get(t.id);u.set(t.id,{px:e.px,py:e.py}),y(a,e.px,e.py,t.r),l>e.px-t.r&&(l=e.px-t.r),e.px+t.r>h&&(h=e.px+t.r),d>e.py-t.r&&(d=e.py-t.r),e.py+t.r>m&&(m=e.py+t.r)}return Number.isFinite(l)?{x:l-Ie,y:d-Ie,w:h-l+2*Ie,h:m-d+2*Ie}:null};if("banded"===e.rowMode){const i=new Map;for(const e of t)i.set(e.row,(i.get(e.row)??0)+1);const s=e.rowOrder.filter(t=>i.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(i.get(t),a)),h=l.reduce((t,e)=>t+e,0)||1,f=new Map;let p=e.innerY+e.innerH;for(let t=0;s.length>t;t++){const n="uniform"===e.cellSizing?c/s.length:l[t]/h*c,o=p-n;f.set(s[t],{y:o,h:n}),p=o-e.rowGap}o.forEach((t,e)=>{const o=r(n.get(t),t=>t.row);for(const t of s){const n=o.get(t),r=f.get(t);n&&r&&g(n,d[e].x,r.y,d[e].w,r.h,t)}});const y=[],x=new Map;for(const t of s){const e=f.get(t);x.set(t,e.y+e.h/2);const n=m.get(t);n&&Number.isFinite(n.minX)&&y.push({x:n.minX-Ie,y:n.minY-Ie,w:n.maxX-n.minX+2*Ie,h:n.maxY-n.minY+2*Ie})}return{positions:u,enclosures:y,colBands:d,rowLabelY:x}}const x=new Map;o.forEach((t,o)=>{const i=r(n.get(t),t=>t.row),s=e.rowOrder.filter(t=>i.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(i.get(t).length,a)),u=l.reduce((t,e)=>t+e,0)||1;let h=e.innerY+e.innerH;s.forEach((t,n)=>{const r="uniform"===e.cellSizing?c/s.length:l[n]/u*c,a=h-r,f=g(i.get(t),d[o].x,a,d[o].w,r,t);if(f){p.push(f);const e=x.get(t)??{sum:0,n:0};e.sum+=f.y+f.h/2,e.n+=1,x.set(t,e)}h=a-e.rowGap})});const b=new Map;for(const[t,e]of x)b.set(t,e.sum/e.n);return{positions:u,enclosures:p,colBands:d,rowLabelY:b}}(O,{columnOrder:ut,rowOrder:dt,innerX:L,innerY:F,innerW:j,innerH:R,rowMode:M,cellSizing:v,proportionExponent:k,columnGap:$,rowGap:A,packPadding:S,iterations:I})),mt=t.selection,pt=mt?.isActive?mt.predicate:null,yt=e.highlight??null,gt=e.dimOpacity??.16,xt=e.markStroke,bt=e.markStrokeWidth??0,wt=e.markerColor??"#ffffff",Mt=e.iconColor??"rgba(255,255,255,0.92)",vt=e.iconStrokeWidth??1,kt=e.iconScale??.72,$t=[],At=[],St=[];for(const t of O){const e=ft.positions.get(t.id);if(!e)continue;const n=s(t.datum,{highlight:yt,predicate:pt,dimOpacity:gt}),o={type:"symbol",cx:e.px,cy:e.py,size:t.size,symbolType:t.baseShape,style:{fill:_(t.colorKey,V(t.shadeVal)),opacity:n,...xt?{stroke:xt,strokeWidth:bt}:{}},datum:t.datum,id:t.id,label:t.id+""};if($t.push(o),t.iconShape){const o=Math.sqrt(t.size/Math.PI)*kt,r=ot(t.iconShape,100);St.push({x:e.px,y:e.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:t.iconShape,opacity:n})}t.marker&&n>gt+.001&&At.push({x:e.px,y:e.py,r:Math.max(1,.4*Math.sqrt(t.size/Math.PI))})}const It=[];if(e.callouts&&e.callouts.length>0){const t=e.calloutColor??"var(--semiotic-text, #f4f4f8)",n=o.y+o.height-(W>0?.45*W:9),r=[];for(let t=0;e.callouts.length>t;t++){const n=e.callouts[t],o=O.find(t=>t.datum[n.field]+""==n.value+"");if(!o)continue;const i=ft.positions.get(o.id);i&&r.push({c:n,ci:t,px:i.px,py:i.py,markR:Math.sqrt(o.size/Math.PI)})}const i=r.filter(t=>null==t.c.at).sort((t,e)=>t.px-e.px),a=new Map;i.forEach((t,e)=>{a.set(t.ci,L+(e+.5)/i.length*j)});for(const e of r){const r=e.c;let i=a.get(e.ci)??e.px,s=n;const c=r.connector??(a.has(e.ci)?"elbow":"straight");"object"==typeof r.at&&r.at?(i=r.at.x,s=r.at.y):"number"==typeof r.at&&(s=o.y+r.at*o.height),It.push({keyId:"callout-"+e.ci,markX:e.px,markY:e.py,labelX:i,labelY:s,label:r.label,connector:c,markRadius:Math.max(e.markR+3,7),stroke:t,color:t,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const zt=function(t,e){const n=e.columnLabel??(t=>t),o=e.rowLabel??(t=>t);return ve("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[e.showEnclosures&&t.enclosures.map((t,n)=>pe({keyId:"enc-"+n,x:t.x,y:t.y,width:t.w,height:t.h,radius:e.enclosureRadius,stroke:e.enclosureColor,strokeWidth:e.enclosureWidth,opacity:e.enclosureOpacity})),e.iconMarks.length>0&&Me("g",{className:"packed-cluster-matrix-icons",children:e.iconMarks.map((t,n)=>Me("path",{d:tt(t.shape,t.size),transform:`translate(${t.x},${t.y})`,fill:"none",stroke:e.iconColor,strokeWidth:e.iconStrokeWidth,opacity:t.opacity},"ic-"+n))}),e.markerDots.length>0&&Me("g",{className:"packed-cluster-matrix-markers",children:e.markerDots.map((t,n)=>Me("circle",{cx:t.x,cy:t.y,r:t.r,fill:e.markerColor},"mk-"+n))}),e.showColumnHeaders&&t.colBands.map((t,o)=>ge({keyId:"col-"+o,text:n(t.col),x:t.x+t.w/2,y:e.headerY,anchor:"middle",fontSize:e.headerFontSize,fontWeight:700,color:e.headerColor})),e.showRowLabels&&[...t.rowLabelY].map(([t,n])=>ge({keyId:"row-"+t,text:o(t),x:e.labelX,y:n,anchor:"end",fontSize:e.labelFontSize,fontWeight:600,color:e.labelColor})),e.callouts.map(t=>we(t))]})}(ft,{markerDots:At,markerColor:wt,iconMarks:St,iconColor:Mt,iconStrokeWidth:vt,callouts:It,plot:o,showEnclosures:z,showColumnHeaders:N,showRowLabels:C,enclosureColor:e.enclosureColor??"var(--semiotic-text, #f4f4f8)",enclosureRadius:e.enclosureRadius??9,enclosureOpacity:e.enclosureOpacity??.5,enclosureWidth:e.enclosureWidth??1.5,headerColor:e.headerColor??"var(--semiotic-text, #f4f4f8)",labelColor:e.labelColor??"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:e.headerFontSize??13,labelFontSize:e.labelFontSize??11,headerY:o.y+.62*T,labelX:o.x+E-10,columnLabel:e.columnLabel,rowLabel:e.rowLabel});return{sceneNodes:$t,overlays:zt}},Ie=4;function ze(t){let e=2166136261;const n=t=>{for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)};for(const o of t)n(o.id),n(o.col),n(o.row),e^=Math.round(8*o.packR),e=Math.imul(e,16777619);return(e>>>0).toString(36)}import*as Ne from"react";var Ce=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=e(n.categoryAccessor),a=e(n.stackBy),s=t=>{const e="function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor],o=Number(e);return Number.isFinite(o)&&o>0?o:0},c=n.gutter??2,l="string"==typeof n.categoryAccessor?n.categoryAccessor:"category",u="string"==typeof n.stackBy?n.stackBy:"stack",d="string"==typeof n.valueAccessor?n.valueAccessor:"value",h=(t,e,n)=>i(o=>{o("category",t),o("stack",e),o("value",n),"category"!==l&&o(l,t),"stack"!==u&&o(u,e),"value"!==d&&o(d,n)}),f=!1!==n.showCategoryLabels,m=Math.max(0,o.height-(n.labelPadding??(f?22:0))),p=[],y=new Map,g=[],x=new Set,b=new Map;for(const e of t.data){const t=r(e)+"",n=a(e)+"",o=s(e);y.has(t)||(p.push(t),y.set(t,0),b.set(t,new Map)),x.has(n)||(x.add(n),g.push(n)),y.set(t,(y.get(t)??0)+o);const i=b.get(t);i.set(n,(i.get(n)??0)+o)}const w=n.categoryOrder?Te(n.categoryOrder,p,t=>y.has(t)):p,M=n.stackOrder?Te(n.stackOrder,g,()=>!0):g,v=w.reduce((t,e)=>t+(y.get(e)??0),0);if(0>=v)return{nodes:[]};const k=Math.max(0,o.width-c*Math.max(0,w.length-1)),$=[],A=[];let S=o.x;for(const e of w){const n=y.get(e)??0,r=n/v*k;if(0>=r)continue;A.push({cat:e,x:S,w:r});const i=b.get(e);let a=o.y;for(const o of M){const s=i.get(o)??0;if(0>=s)continue;const c=s/n*m;$.push({type:"rect",x:S,y:a,w:r,h:c,style:{fill:t.resolveColor(o),stroke:"none"},datum:h(e,o,s),group:o}),a+=c}S+=r+c}return{nodes:$,overlays:f&&A.length>0?function(t,e,n){const o=t.map((t,o)=>ge({keyId:"marimekko-label-"+o,text:t.cat,x:t.x+t.w/2,y:e+12,anchor:"middle",baseline:"auto",maxWidth:t.w-4,fontSize:12,color:n}));return Ne.createElement(Ne.Fragment,null,...o)}(A,o.y+m+4,`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`):null}};function Te(t,e,n){const o=new Set,r=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),r.push(e));for(const t of e)o.has(t)||r.push(t);return r}import*as Ee from"react";var We=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height||0===t.data.length)return{nodes:[]};const r=n.rowHeight??28,a=n.rowGap??12,s=!1!==n.showLabels,c=s?n.labelWidth??120:0,l=!1!==n.showTicks,u=l?14:0,d=n.tickFormat??(t=>t.toLocaleString()),h=o.x+c,f=Math.max(0,o.width-c);if(0>=f)return{nodes:[]};const m=e(n.categoryAccessor),p=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},y=t=>p("function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor]),g=t=>p("function"==typeof n.targetAccessor?n.targetAccessor(t):t[n.targetAccessor]),x=t=>{const e="function"==typeof n.rangesAccessor?n.rangesAccessor(t):t[n.rangesAccessor];return Array.isArray(e)?e.map(p).sort((t,e)=>t-e):[]},b="string"==typeof n.categoryAccessor?n.categoryAccessor:"metric",w="string"==typeof n.valueAccessor?n.valueAccessor:"value",M="string"==typeof n.targetAccessor?n.targetAccessor:"target",v=n.actualColor??t.theme.semantic.primary??"#3b6cb1",k=t.theme.semantic.text??"currentColor",$=n.targetColor??`var(--semiotic-text, ${k})`,A=[`var(--semiotic-surface, ${t.theme.semantic.surface??"#e8eaed"})`,`var(--semiotic-grid, ${t.theme.semantic.grid??"#cdd1d6"})`,`var(--semiotic-border, ${t.theme.semantic.border??"#a3a8af"})`],S=`var(--semiotic-text, ${k})`,I=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=[],N=[];for(let e=0;t.data.length>e;e++){const n=t.data[e],s=x(n),c=y(n),l=g(n),d=Math.max(c,l,...s.length?s:[0]);if(0>=d)continue;const p=o.y+e*(r+a+u);if(p+r+u>o.y+o.height)break;N.push({yTop:p,label:m(n),actual:c,target:l,maxVal:d});const k=t=>h+t/d*f,S=m(n),I=t=>i(e=>{e("metric",S),"metric"!==b&&e(b,S),t(e)});let C=h;for(let t=0;s.length>t;t++){const e=k(s[t]),n=e-C;n>0&&z.push({type:"rect",x:C,y:p,w:n,h:r,style:{fill:A[Math.min(t,A.length-1)],stroke:"none"},datum:I(e=>{e("range",t),e("rangeValue",s[t]),e("kind","range")}),group:"range-"+t}),C=e}const T=Math.max(6,Math.floor(.45*r));z.push({type:"rect",x:h,y:p+(r-T)/2,w:k(c)-h,h:T,style:{fill:v,stroke:"none"},datum:I(t=>{t("value",c),t("kind","actual"),"value"!==w&&t(w,c)}),group:"actual"});const E=3,W=Math.floor(.8*r);z.push({type:"rect",x:k(l)-E/2,y:p+(r-W)/2,w:E,h:W,style:{fill:$,stroke:"none"},datum:I(t=>{t("target",l),t("kind","target"),"target"!==M&&t(M,l)}),group:"target"})}const C=[];for(let t=0;N.length>t;t++){const e=N[t];if(s&&C.push(ge({keyId:"bullet-label-"+t,text:e.label,x:o.x+c-8,y:e.yTop+r/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:S})),l){const n=5,o=e.yTop+r+2;for(let r=0;n>r;r++){const i=e.maxVal*r/(n-1),a=h+i/e.maxVal*f;C.push(Ee.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:a,x2:a,y1:o,y2:o+3,stroke:I,strokeWidth:1}),ge({keyId:`bullet-ticktext-${t}-${r}`,text:d(i),x:a,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:I}))}}}return{nodes:z,overlays:C.length>0?Ee.createElement(Ee.Fragment,null,...C):null}};import*as Le from"react";import{scaleLinear as Fe}from"d3-scale";var je=t=>{const e=t.config,{plot:n}=t.dimensions,o=e.fields??[];if(2>o.length||0>=n.width||0>=n.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const r={};for(const n of o){if(e.domains?.[n]){r[n]=e.domains[n];continue}let o=1/0,i=-1/0;for(const e of t.data){const t=Number(e[n]);Number.isFinite(t)&&(o>t&&(o=t),t>i&&(i=t))}r[n]=Number.isFinite(o)&&Number.isFinite(i)&&o!==i?[o,i]:[0,1]}const i=!1!==e.showAxes,a=i?e.axisLabelPadding??24:8,c=i?18:8,l=o.map(t=>Fe().domain(r[t]).range([n.y+n.height-c,n.y+a])),u=o.map((t,e)=>1===o.length?n.x+n.width/2:n.x+e/(o.length-1)*n.width),d=e.colorBy?"function"==typeof e.colorBy?e.colorBy:t=>(t[e.colorBy]??"")+"":null,h=e.opacity??.45,f=e.strokeWidth??1.25,m=t.theme.semantic.primary??"#3b6cb1",p=e.dimmedOpacity??.08,y=e.highlightFn,g=[],x=[];for(const n of t.data){const r=d?t.resolveColor(d(n)+""):m,i=!y||y(n),a=s(n,{predicate:y,baseOpacity:h,dimOpacity:p,brighten:.4}),c=i?x:g;for(let t=0;o.length-1>t;t++){const e=Number(n[o[t]]),s=Number(n[o[t+1]]);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const d={type:"connector",x1:u[t],y1:l[t](e),x2:u[t+1],y2:l[t+1](s),style:{stroke:r,strokeWidth:y&&i?f+.75:f,opacity:a,fill:"none"},datum:n};c.push(d)}if(e.showPoints)for(let t=0;o.length>t;t++){const e=Number(n[o[t]]);if(!Number.isFinite(e))continue;const i={type:"point",x:u[t],y:l[t](e),r:2.5,style:{fill:r,stroke:"none",opacity:Math.min(1,a+.3)},datum:n};c.push(i)}}let b=null;if(i){const i=`var(--semiotic-border, ${t.theme.semantic.border??"#aaa"})`,s=`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`,d=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,h=n.y+a,f=n.y+n.height-c,m=[];for(let t=0;o.length>t;t++){const c=o[t],p=u[t],y=e.tickFormat?.[c]??(t=>t.toLocaleString());m.push(Le.createElement("line",{key:"pc-axis-line-"+t,x1:p,x2:p,y1:h,y2:f,stroke:i,strokeWidth:1})),m.push(ge({keyId:"pc-axis-label-"+t,text:c,x:p,y:n.y+a-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:s}));const[g,x]=r[c],b=5;for(let e=0;b>e;e++){const n=g+(x-g)*e/(b-1),o=l[t](n);m.push(Le.createElement("line",{key:`pc-tick-${t}-${e}`,x1:p-3,x2:p+3,y1:o,y2:o,stroke:i,strokeWidth:1}),ge({keyId:`pc-ticktext-${t}-${e}`,text:y(n),x:p+6,y:o+3,anchor:"start",baseline:"auto",fontSize:10,color:d}))}}b=Le.createElement(Le.Fragment,null,...m)}return{nodes:g.concat(x),overlays:b}};import{jsx as Re,jsxs as Oe}from"react/jsx-runtime";var Pe=1.75,qe="#222222";function De(t,e){return t.topRadius+(e-t.height)/t.height*(t.topRadius-t.bottomRadius)}function Be(t,e){return function(t,e,n){return Math.PI*n/3*(t*t+t*e+e*e)}(De(t,e),t.bottomRadius,e)}function Ye(t,e){const n=(t.topRadius+t.bottomRadius)/2,o=Math.PI*n*n;let r=e/o,i=e-Be(t,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=e-Be(t,r),a++;return r}function Ve(t,e){const n=43758.5453*Math.sin(12.9898*t+78.233);return 2*(n-Math.floor(n)-.5)*e}function He(t,e){if(e>t||2*e>t)return[{x:0,y:0}];const n=[],o=t=>{let r=Math.floor(2*Math.PI*t/(2*e));1>r&&(r=1);const i=0*t,a=Math.hypot(1*t-t*Math.cos(2*Math.PI/r),i-t*Math.sin(2*Math.PI/r));2*e>a&&r>1&&r--;for(let e=0;r>e;e++)n.push({x:t*Math.cos(2*e*Math.PI/r),y:t*Math.sin(2*e*Math.PI/r)});const s=t-2*e;e>s?t>2*e&&n.push({x:0,y:0}):o(s)};return o(t-e),n}function Xe(t,e,n){const o=[];let r=n,i=0;for(;r>0&&60>i;){const n=e*(1+2*i),a=He(De(t,n),e),s=a.length-r,c=s>1?a.slice(Math.floor(s/2),Math.floor(s/2)+r):a,l=t.height-n;if(c.forEach((t,e)=>{o.push({x:t.x+Ve(97*i+e,.15),z:l+Ve(31*i+e,.05)})}),r-=c.length,i++,0===c.length)break}return{pearls:o,layers:i}}function _e(t,e,n,o){if(0>=o)return[];const r=function(t,e,n){let o=n,r=0;for(;o>0&&60>r;){const n=De(t,e+.875*(1+2*r));o-=Math.max(1,Math.floor(2*n/Pe)),r++}return r}(t,e,o),i=Math.max(e,n-r*Pe)+.875,a=[];let s=0;for(let e=0;r>e&&o>s;e++){const n=i+Pe*e,r=De(t,n),c=Math.max(1,Math.floor(2*r/Pe)),l=(2*r-c*Pe)/(c+1),u=-r+l,d=t.height-n-.875-.1;for(let t=0;c>t&&o>s;t++)a.push({cx:u+(l+Pe)*t+.875,cy:d+.875,rotation:Ve(53*e+t,10)}),s++}return a}function Ge(t,e){const n=Number(t);return Number.isFinite(n)?n:e}var Ue=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=e(n.categoryAccessor??"name"),i=e(n.teaVolumeAccessor??"teaVolume"),a=e(n.bobaVolumeAccessor??"bobaVolume"),s=e(n.iceVolumeAccessor??"iceVolume"),c=e(n.cupHeightAccessor??"cupHeight"),l=e(n.cupTopRadiusAccessor??"cupTopRadius"),u=e(n.cupBottomRadiusAccessor??"cupBottomRadius"),d=e(n.bobaRadiusAccessor??"bobaRadius"),m=n.cupWidthRatio??.82,p=t.scales.o,y=p.bandwidth(),g=Math.max(1,o.height-26-8),x=o.y+8,b=[],w=[];for(const e of t.data){const n=r(e)+"",o=p(n);if(null==o)continue;const M={height:Ge(c(e),15.5),topRadius:Ge(l(e),4.75),bottomRadius:Ge(u(e),3.75)},v=Ge(d(e),.6),k=Math.max(0,Ge(i(e),450)),$=Math.max(0,Ge(a(e),110)),A=Math.max(0,Ge(s(e),135)),S=Math.PI*v*v,I=Math.floor($/S),z=I*S,N=Math.floor(A/5.359375),C=N*Pe*Pe*Pe,T=k+z+C,E=Ye(M,T),W=Math.min(M.height,Math.max(0,E)),L=De(M,W),{pearls:F,layers:j}=Xe(M,v,I),R=W,O=_e(M,j*v*2,R,N),P=M.height-20.32,q=Math.min(0,P),D=Math.min(y*m/(2*(M.topRadius+1)),g/(M.height-q)),B=o+y/2,Y=t=>B+t*D,V=t=>x+(t-q)*D,H=Y(-(M.topRadius+1)),X=Y(M.topRadius+1),_=V(q),G=V(M.height),U=h({name:n,teaVolume:k,bobaVolume:Math.round(z),iceVolume:Math.round(C),totalVolume:Math.round(T),numBobas:I,numIce:N,kind:"boba cup"});b.push({type:"rect",x:H,y:_,w:Math.max(1,X-H),h:Math.max(1,G-_),style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:U,group:n,_transitionKey:"boba-"+f(n)});const K=M.height-R,Q=f(n),Z=t.resolveColor(n);w.push(Oe("g",{children:[k>0?Re("path",{d:`M${Y(-L)},${V(K)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(L)},${V(K)} z`,fill:"#D2B799"}):null,F.map((t,e)=>Re("circle",{cx:Y(t.x),cy:V(t.z),r:v*D,fill:"#222222",opacity:.5},"p-"+e)),O.map((t,e)=>Re("rect",{x:Y(t.cx)-.95*Pe*D/2,y:V(t.cy)-.95*Pe*D/2,width:.95*Pe*D,height:.95*Pe*D,rx:2,fill:"#a5f2f3",opacity:.85,transform:`rotate(${t.rotation} ${Y(t.cx)} ${V(t.cy)})`},"i-"+e)),Re("path",{d:`M${Y(-M.topRadius)},${V(0)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(M.topRadius)},${V(0)}`,fill:"none",stroke:qe,strokeWidth:2.5}),Re("line",{x1:Y(-(M.topRadius+1)),y1:V(0),x2:Y(M.topRadius+1),y2:V(0),stroke:qe,strokeWidth:3,strokeLinecap:"round"}),k>0?Re("path",{d:`M${Y(-.635)},${V(P)} L${Y(-.635)},${V(M.height-.4)} L${Y(.635)},${V(M.height-1.27-.4)} L${Y(.635)},${V(P)} z`,fill:"#4F91CB",stroke:qe,strokeWidth:1,opacity:.78}):null,Re("text",{x:B,y:G+16,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--semiotic-text, #333)",children:n}),Re("text",{x:B,y:G+30,textAnchor:"middle",fontSize:10,fill:Z,children:`${I} pearls · ${Math.round(T)} cm³`})]},"boba-"+Q))}return{nodes:b,overlays:Re("g",{className:"semiotic-boba",style:{pointerEvents:"none"},children:w})}};function Ke(t,e){const n=e.scales?.x??e.scales?.time;return n?null!=t.x?n(t.x):e.xAccessor&&null!=t[e.xAccessor]?n(t[e.xAccessor]):null:null}function Qe(t,e){const n=e.scales?.y??e.scales?.value;return n?null!=t.y?n(t.y):e.yAccessor&&null!=t[e.yAccessor]?n(t[e.yAccessor]):null:null}function Ze(t){return null==t?null:t+""}function Je(t,e,n){return e.stickyPositionCache?.set(t,n),n}var tn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function en(t){return!!t&&"object"==typeof t&&tn.has(function(t){return"string"==typeof t?.type?t.type:""}(t))}new Set(["label","callout","callout-circle","callout-rect"]);var nn=2e4;function on(t){return"primary"===t?.emphasis||!0===t?.defensive}function rn(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function an(t){let e;const n=t?.emphasis;e="primary"===n?100:"secondary"===n?10:50;const o=t?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(e+=15*Math.max(0,Math.min(1,o))),t?.lifecycle?.freshness){case"fresh":e+=8;break;case"aging":e+=4;break;case"stale":e+=1;break;case"expired":e-=200}return e}function sn(t){const{annotations:e,width:n,height:o}=t,r=Math.max(0,t.minVisible??1),i=rn(n,o,t),a=e.map((t,e)=>{return{annotation:t,index:e,note:(n=t,en(n))};var n}),s=a.filter(t=>t.note);if(0===s.length||i>=s.length)return{visible:e.slice(),deferred:[],budget:i};const c=s.filter(t=>on(t.annotation)),l=s.filter(t=>!on(t.annotation)).sort((t,e)=>an(e.annotation)-an(t.annotation)||t.index-e.index),u=Math.min(l.length,Math.max(Math.max(0,i-c.length),Math.max(0,r-c.length))),d=new Set([...c.map(t=>t.index),...l.slice(0,u).map(t=>t.index)]),h=[],f=[];for(const{annotation:t,index:e,note:n}of a)!n||d.has(e)?h.push(t):f.push(t);return{visible:h,deferred:f,budget:i}}var cn=32,ln=6,un=4,dn=8,hn=72;var fn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function mn(t){if(!pn(t))return t;const e=("string"==typeof t.mobileText?t.mobileText:void 0)??("string"==typeof t.shortText?t.shortText:void 0);return!e||"string"!=typeof t.label&&null!=t.label?t:{...t,label:e}}function pn(t){return en(t)}function yn(t,e){if(!t)return[];const n=Math.max(1,Math.floor(e/7)),o=t.split(/\s+/).filter(Boolean),r=[];let i="";for(const t of o)i&&i.length+t.length+1>n?(r.push(i),i=t):i=i?`${i} ${t}`:t;return i&&r.push(i),r}function gn(t,e,n,o,r){const i=t+n,a=e+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?a-r.height:a,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?a-r.height-4:a+4,width:r.width,height:r.height}}function xn(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}function bn(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function wn(t,e,n,o,r,i,a,s){const c=xn(t,a);let l=.4*Math.hypot(e.dx,e.dy)+80*function(t,e,n,o){const r=Math.max(0,o-t.x),i=Math.max(0,o-t.y);return(r+Math.max(0,t.x+t.width-(e-o)))*t.height+(i+Math.max(0,t.y+t.height-(n-o)))*t.width}(c,r,i,s);for(const t of n)l+=12*bn(c,t);for(const t of o)l+=4*bn(c,t);return l}function Mn(t,e,n){if("widget"===t.type&&"number"==typeof t.px&&"number"==typeof t.py)return{x:t.px,y:t.py};const o=t.pointId??t.nodeId;if(null!=o&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===o);if(t)return{x:t.x,y:t.y}}const r=t.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const t=r[0],e=r[1];if("number"==typeof t&&"number"==typeof e){const n=i([t,e]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof t.x||"number"!=typeof t.y?function(t,e,n){const o=t.anchor||t.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=t.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===t.pointId)return Je(e,n,{x:r.x,y:r.y})}const o=function(t){const e=t.data;if(!e||0===e.length)return null;const n=e[e.length-1],o=t.scales?.x??t.scales?.time,r=t.scales?.y??t.scales?.value;if(!o||!r)return null;const i=n[t.xAccessor||"x"],a=n[t.yAccessor||"y"];return null==i||null==a?null:{x:o(i),y:r(a)}}(n);return o?Je(e,n,o):null}if("semantic"===o){const o=function(t,e,n){const o=function(t){return Ze(t.provenance?.stableId??t.stableId)}(t);if(!o)return null;const r=n.pointNodes?.find(t=>Ze(t.pointId)===o);if(r)return Je(e,n,{x:r.x,y:r.y});const i=n.data?.find(t=>function(t){return Ze(t.stableId??t.id??t.provenance?.stableId)}(t)===o);if(!i)return null;const a=Ke(i,n),s=Qe(i,n);return null==a||null==s?null:Je(e,n,{x:a,y:s})}(t,e,n);if(o)return o}let r=null,i=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(r=e.x,i=e.y)}if(null!=r&&null!=i||(r=Ke(t,n),i=Qe(t,n)),null!=r&&null!=i)return Je(e,n,{x:r,y:i});if("sticky"===o){const t=n.stickyPositionCache?.get(e);if(t)return t}return null}(t,e,n):{x:t.x,y:t.y}}function vn(t){const{annotations:e,context:n,defaultOffset:o=cn,notePadding:r=ln,markPadding:i=un,edgePadding:a=dn,preserveManualOffsets:s=!0,routeLongConnectors:c=!0,connectorThreshold:l=hn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:p,audience:y}=t,g=n.width||0,x=n.height||0,b="object"==typeof m?m:{},w=b.breakpoint??480,M=!!m&&w>=g,v=M&&!1!==b.preferShortText?e.map(mn):e,k=M&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,$=d||M&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),A=M&&!f?b.responsive??{minWidth:w}:f,S=M&&!p?b.cohesion:p;if(0===v.length||0>=g||0>=x)return v.slice();const I=[],z=function(t,e){return(t.pointNodes||[]).map(t=>{const n=Math.max(1,t.r||1)+e;return{x:t.x-n,y:t.y-n,width:2*n,height:2*n}})}(n,i);let N=!1;const C=v.map((t,e)=>{if(!pn(t))return t;const i=Mn(t,e,n);if(!i)return t;const u=function(t){if("widget"===t.type)return{width:"number"==typeof t.width?t.width:32,height:"number"==typeof t.height?t.height:32};const e="number"==typeof t.wrap?t.wrap:120,n=[...yn("string"==typeof t.title?t.title:void 0,e),...yn("string"==typeof t.label?t.label:void 0,e)],o=n.reduce((t,e)=>Math.max(t,e.length),0);return{width:Math.max(24,Math.min(e,7*o)+10),height:Math.max(18,16*n.length+6)}}(t);if(s&&("number"==typeof(d=t).dx||"number"==typeof d.dy)){const e=function(t){return"text"===t.type||"widget"===t.type?{dx:0,dy:0}:{dx:30,dy:-30}}(t);return I.push(xn(gn(i.x,i.y,"number"==typeof t.dx?t.dx:e.dx,"number"==typeof t.dy?t.dy:e.dy,u),r)),t}var d;let h=null,f=1/0;for(const t of function(t){const e=1.6*t;return[{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t},{dx:t,dy:0},{dx:-t,dy:0},{dx:0,dy:-t},{dx:0,dy:t},{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e}]}(o)){const e=wn(gn(i.x,i.y,t.dx,t.dy,u),t,I,z,g,x,r,a);f>e&&(h=t,f=e)}if(!h)return t;const m=xn(gn(i.x,i.y,h.dx,h.dy,u),r);I.push(m);const p=Math.hypot(h.dx,h.dy),y=c&&p>=l&&"text"!==t.type&&"widget"!==t.type?{...t.connector||{end:"arrow"},type:"curve"}:t.connector;return N=!0,{...t,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),T=N?C:v.slice();let E=T;if(h){let t=!1;const e=T.map(e=>{const n=function(t){return"text"!==t.type||"string"!=typeof t.color||8>Math.hypot("number"==typeof t.dx?t.dx:0,"number"==typeof t.dy?t.dy:0)?t:{...t,_redundantConnector:!0}}(e);return n!==e&&(t=!0),n});E=t?e:T}{let t=!1;const e=E.map(e=>{if(!0!==e?.defensive)return e;const n=function(t){const e=t?.provenance;if(!e||"object"!=typeof e)return t;const n="string"==typeof e.source?fn[e.source]??e.source:null,o="number"==typeof e.confidence&&Number.isFinite(e.confidence)?Math.round(100*Math.max(0,Math.min(1,e.confidence)))+"%":null;if(!n&&!o)return t;if(null!=t.label&&"string"!=typeof t.label)return t;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof t.label?t.label:"";return i.includes(`(${r})`)?t:{...t,label:i?`${i} (${r})`:`(${r})`}}(e);return n!==e&&(t=!0),n});E=t?e:E}const W=new Set;if(k){const t="object"==typeof k?k:{},e=function(t){if(!t)return 1;const e=function(t){const e=t?.familiarity;if(!e)return 3;const n=Object.values(e).filter(t=>"number"==typeof t&&Number.isFinite(t));return 0===n.length?3:n.reduce((t,e)=>t+e,0)/n.length}(t);return e>2?4>e?1:.6:1.5}(y),n=1===e?t:{...t,maxAnnotations:Math.max(0,Math.round((t.maxAnnotations??rn(g,x,t))*e))},{deferred:o}=sn({annotations:E,width:g,height:x,...n});for(const t of o)W.add(t)}if(A&&("object"==typeof A&&"number"==typeof A.minWidth?A.minWidth:480)>=g)for(const t of E)pn(t)&&"secondary"===t.emphasis&&W.add(t);if(W.size>0)for(const t of E)!0===t?.defensive&&W.delete(t);let L;return L=0===W.size?E:$?E.map(t=>W.has(t)?{...t,_annotationDeferred:!0}:t):E.filter(t=>!W.has(t)),S?function(t,e){let n=!1;const o=t.map(t=>pn(t)?"blended"===t.cohesion||"layer"===t.cohesion?t:(n=!0,{...t,cohesion:e}):t);return n?o:t}(L,S):L}import*as kn from"react";function $n(t,e){if("function"==typeof t)return t;const n=t??e;return t=>Number(t[n])}function An(t,e={}){const n=$n(e.start,"start"),o=$n(e.end,"end"),r=!1===e.sort?t.slice():t.slice().sort((t,e)=>n(t)-n(e)||o(e)-o(t)),i=[];return{packed:r.map(t=>{const e=n(t);let r=i.findIndex(t=>e>=t);return-1===r&&(r=i.length),i[r]=o(t),{item:t,track:r}}),trackCount:Math.max(1,i.length)}}function Sn(t,e){const n=$n(e.start,"start"),o=$n(e.end,"end"),[r,i]=e.domain,a=e.step??1,s="half-open"===e.bounds,c=[];for(let e=r;i>=e;e+=a){let r=0;for(const i of t){const t=n(i),a=o(i);t>e||(s?e>=a:e>a)||r++}c.push({value:e,count:r})}return c}function In(t){return"function"==typeof t?t:e=>e[t]}var zn=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height||0===t.data.length||!e?.domain)return{nodes:[]};const o=In(e.laneAccessor),r=In(e.startAccessor),i=In(e.endAccessor),a=e.idAccessor?In(e.idAccessor):null,s=e.unit??0,c=e.barGap??1.5,l=Math.max(0,e.minBarWidth??2),u=e.minBarHeight??3.5,d=e.maxBarHeight??10,h=e.lanePadding??7,f=e.cornerRadius??2,m=e.bottomInset??0,p=e.color??((e,n)=>t.resolveColor(n)),[y,g]=e.domain,x=g-y||1,b=t=>n.x+(t-y)/x*n.width,w=t.scales?.o?.domain?.()??[],M=e.lanes??(w.length>0?w:[...new Set(t.data.map(o))]),v=Math.max(0,n.height-m)/Math.max(1,M.length),k=t=>b(r(t)),$=t=>Math.max(k(t)+l,b(i(t)+s)),A=[];M.forEach((e,r)=>{const i=n.y+r*v,s=t.data.filter(t=>o(t)===e);if(0===s.length)return;const{packed:l,trackCount:m}=An(s,{start:k,end:$}),y=new Map,g=new Map;for(const{item:t,track:e}of l){const n=g.get(e);n?n.push(t):g.set(e,[t])}for(const t of g.values()){t.sort((t,e)=>k(t)-k(e));for(let e=0;t.length-1>e;e++)y.set(t[e],k(t[e+1]))}const x=(v-2*h)/m,b=Math.min(d,Math.max(Math.min(u,x),x-c));for(const{item:t,track:n}of l){const o=k(t),r=y.get(t),s=$(t)-o;A.push({type:"rect",x:o,y:i+h+n*x,w:void 0!==r&&o+s>r-1?Math.max(1,r-1-o):s,h:b,cornerRadii:f>0?{tl:f,tr:f,br:f,bl:f}:void 0,style:{fill:p(t,e),stroke:"none"},datum:t,group:e,_transitionKey:a?a(t)+"":void 0})}});const S=`var(--semiotic-text, ${t.theme.semantic.text??"#1a1a1a"})`,I=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=`var(--semiotic-border, ${t.theme.semantic.border??"#94a3b8"})`,N=[];(e.periods??[]).forEach((t,e)=>{const o=b(t.start),r=Math.max(1,b(t.end+s)-o);N.push(kn.createElement("rect",{key:"period-"+e,x:o,y:n.y,width:r,height:n.height,fill:z,opacity:e%2==0?.06:.025,pointerEvents:"none"})),t.name&&N.push(ge({keyId:"period-label-"+e,text:t.name,x:o+4,y:n.y+12,anchor:"start",baseline:"hanging",fontSize:13,fontWeight:700,color:I}))});const C=!1!==e.showLaneLabels,T=e.laneLabelGap??12;if(M.forEach((t,e)=>{const o=n.y+e*v;N.push(kn.createElement("line",{key:"lane-sep-"+e,x1:n.x,x2:n.x+n.width,y1:o,y2:o,stroke:z,opacity:.45})),C&&N.push(ge({keyId:"lane-label-"+e,text:t,x:n.x-T,y:o+v/2,anchor:"end",baseline:"middle",fontSize:12,fontWeight:600,color:S}))}),!1!==e.showAxis){const t=e.axisTicks??Array.from({length:8},(t,e)=>Math.round(y+e/7*x));N.push(be({keyId:"interval-axis",scale:b,ticks:t,orient:"top",offset:n.y,tickLength:0,gridLength:n.height,gridDasharray:"3 5",edgeAnchor:!0,format:e.tickFormat,color:I}))}return{nodes:A,overlays:kn.createElement(kn.Fragment,null,...N)}};function Nn(t,e,n){const o=n?.orientation??"vertical",r=n?.bend??0,i=n?.minAlong??18,a=(t,e)=>(t+e)/2;if("vertical"===o){if(i>Math.abs(e.y-t.y)){const n=t.x>e.x?-1:1,o=a(t.x,e.x)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${o},${a(t.y,e.y)} ${e.x},${e.y}`}const n=a(t.y,e.y)+r;return`M${t.x},${t.y} C${t.x},${n} ${e.x},${n} ${e.x},${e.y}`}if(i>Math.abs(e.x-t.x)){const n=t.y>e.y?-1:1,o=a(t.y,e.y)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${a(t.x,e.x)},${o} ${e.x},${e.y}`}const s=a(t.x,e.x)+r;return`M${t.x},${t.y} C${s},${t.y} ${s},${e.y} ${e.x},${e.y}`}function Cn(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=(t.y+e.y)/2;return`M${t.x},${t.y} L${t.x},${n} L${e.x},${n} L${e.x},${e.y}`}const o=(t.x+e.x)/2;return`M${t.x},${t.y} L${o},${t.y} L${o},${e.y} L${e.x},${e.y}`}function Tn(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=e.cy>=t.cy;return{from:{x:t.cx,y:t.cy+(n?t.height/2:-t.height/2)},to:{x:e.cx,y:e.cy+(n?-e.height/2:e.height/2)}}}const o=e.cx>=t.cx;return{from:{x:t.cx+(o?t.width/2:-t.width/2),y:t.cy},to:{x:e.cx+(o?-e.width/2:e.width/2),y:e.cy}}}function En(t,e){const n=e?.spread??5;return e?.modulo&&e.modulo>0?(t%e.modulo-(e.modulo-1)/2)*n:(t-((e?.count??1)-1)/2)*n}function Wn(t,e){const n=1-e,o=n*n*n,r=3*n*n*e,i=3*n*e*e,a=e*e*e;return{x:o*t.p0.x+r*t.p1.x+i*t.p2.x+a*t.p3.x,y:o*t.p0.y+r*t.p1.y+i*t.p2.y+a*t.p3.y}}function Ln(t,e){const n=1-e,o=3*n*n,r=6*n*e,i=3*e*e;return{x:o*(t.p1.x-t.p0.x)+r*(t.p2.x-t.p1.x)+i*(t.p3.x-t.p2.x),y:o*(t.p1.y-t.p0.y)+r*(t.p2.y-t.p1.y)+i*(t.p3.y-t.p2.y)}}function Fn(t){return`M${t.p0.x},${t.p0.y} C${t.p1.x},${t.p1.y} ${t.p2.x},${t.p2.y} ${t.p3.x},${t.p3.y}`}function jn(t,e){const n=e?.axis??"x",o=e?.padding??0,r=e?.strength??.5,i="x"===n?"y":"x",a="x"===n?"width":"height",s="x"===n?"height":"width",c=new Map;for(const e of t)c.set(e.id,0);for(let e=0;t.length>e;e++)for(let l=e+1;t.length>l;l++){const u=t[e],d=t[l];if(Math.abs(u[i]-d[i])>(u[s]+d[s])/2+o)continue;const h=d[n]-u[n]||(d.id>u.id?-.5:.5),f=(u[a]+d[a])/2+o-Math.abs(h);if(0>=f)continue;const m=f*r*Math.sign(h);c.set(u.id,(c.get(u.id)??0)-m),c.set(d.id,(c.get(d.id)??0)+m)}return c}var Rn={width:60,height:34};function On(t,e){if("function"==typeof t)return t;const o=t??e;return t=>n(t,o,void 0)}function Pn(t,e,n,r){const i=r.fixedAxis??"y",a=t=>On(r.sourceAccessor,"source")(t)+"",s=t=>On(r.targetAccessor,"target")(t)+"",c=r.size??(()=>Rn),l=r.iterations??180,u=r.attraction??.012,d=r.anchorStrength??.003,h=r.collisionStrength??.12,f=r.collisionPadding??15,m=r.edgePadding??42,p=r.fixedPadding??16,y=r.damping??.72,g=r.spread??1,[x,b]=r.fixedDomain,w=b-x||1,M=("y"===i?n.y:n.x)+p,v=("y"===i?n.y+n.height:n.x+n.width)-p,k=("y"===i?n.x:n.y)+m,$=("y"===i?n.x+n.width:n.y+n.height)-m,A=Math.max(1,$-k),S=t.map(t=>{const e=o(t)??t,n=(i=t,On(r.idAccessor,"id")(i)+"");var i;const{width:a,height:s}=c(e),l=(t=>Number(On(r.fixedAccessor,"fixed")(t)))(t),u=k+function(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}(n)*A;return{data:e,id:n,width:a,height:s,fixedValue:l,fixed:(d=l,M+(d-x)/w*(v-M)),free:u,anchor:u};var d}),I=new Map(S.map(t=>[t.id,t])),z=t=>"y"===i?t.width:t.height;for(let t=0;l>t;t++){const t=new Map;for(const e of S)t.set(e.id,0);for(const n of e){const e=I.get(a(n)),o=I.get(s(n));if(!e||!o)continue;const r=(o.free-e.free)*u;t.set(e.id,(t.get(e.id)??0)+r),t.set(o.id,(t.get(o.id)??0)-r)}for(const e of S)t.set(e.id,(t.get(e.id)??0)+(e.anchor-e.free)*d);const n=jn(S.map(t=>({id:t.id,x:"y"===i?t.free:t.fixed,y:"y"===i?t.fixed:t.free,width:t.width,height:t.height})),{axis:"y"===i?"x":"y",padding:f,strength:h});for(const e of S)t.set(e.id,(t.get(e.id)??0)+(n.get(e.id)??0));for(const e of S){e.free+=(t.get(e.id)??0)*y;const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,e.free))}}if(1!==g){const t=(k+$)/2;for(const e of S){const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,t+(e.free-t)*g))}}const N=S.map(t=>({data:t.data,id:t.id,x:"y"===i?t.free:t.fixed,y:"y"===i?t.fixed:t.free,width:t.width,height:t.height,fixedValue:t.fixedValue}));return{positioned:N,byId:new Map(N.map(t=>[t.id,t]))}}var qn=t=>{const{plot:e}=t.dimensions;if(0>=e.width||0>=e.height||0===t.nodes.length||!t.config?.fixedDomain)return{sceneNodes:[]};const r=t.config.fixedAxis??"y",{positioned:i,byId:a}=Pn(t.nodes,t.edges,e,t.config),s=i.map(e=>({type:"rect",x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,style:{fill:t.resolveColor(e.id),stroke:"none"},datum:e.data,id:e.id,label:e.id})),c=[];t.edges.forEach((e,i)=>{const s=a.get((l=e,("function"==typeof t.config.sourceAccessor?t.config.sourceAccessor(l):n(l,t.config.sourceAccessor??"source",void 0))+""));var l;const u=a.get((e=>("function"==typeof t.config.targetAccessor?t.config.targetAccessor(e):n(e,t.config.targetAccessor??"target",void 0))+"")(e));if(!s||!u)return;const{from:d,to:h}=Tn({cx:s.x,cy:s.y,width:s.width,height:s.height},{cx:u.x,cy:u.y,width:u.width,height:u.height},{orientation:"y"===r?"vertical":"horizontal"});c.push({type:"curved",pathD:Nn(d,h,{orientation:"y"===r?"vertical":"horizontal",bend:En(i,{modulo:5,spread:5})}),style:{stroke:"var(--semiotic-border, #888)",fill:"none",strokeWidth:1.4},datum:o(e)??e})});const l=i.map(t=>({x:t.x,y:t.y,text:t.id}));return{sceneNodes:s,sceneEdges:c,labels:l}},Dn={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Bn=8;function Yn(t){return null==t?void 0:t+""}function Vn(t){const e=Yn(t.id);return{type:"point",x:t.x,y:t.y,r:t.r??8,style:{...Dn},datum:t.datum,pointId:e,_transitionKey:e}}function Hn(t){return Vn(t)}function Xn(t){const[[e,n],[o,r]]=t.bounds;return{type:"geoarea",pathData:t.pathData,centroid:t.centroid,bounds:t.bounds,screenArea:t.screenArea??Math.abs((o-e)*(r-n)),style:{...Dn},datum:t.datum,group:t.group,interactive:!0}}function _n(t){return{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Dn},datum:t.datum,group:t.group,_transitionKey:Yn(t.id)}}function Gn(t){const e=Yn(t.id);return"width"in t&&"height"in t?{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Dn},datum:t.datum,id:e,label:t.label}:{type:"circle",cx:t.x,cy:t.y,r:t.r??8,style:{...Dn},datum:t.datum,id:e,label:t.label}}function Un(t,e,n={}){const{coord:o,step:r=1,equals:i=Object.is,truthyOnly:a=!1}=n,s=[],c=e=>o?o(t[e],e):e,l=(t,e,n)=>{t.endIndex=e,t.count=e-t.startIndex+1,t.end=o?null==n||c(n)-c(e)>r?c(e)+r:c(n):e+1,s.push(t)};let u=null;for(let n=0;t.length>n;n++){const s=e(t[n],n);if(a&&!s){u&&(l(u,u.endIndex,n),u=null);continue}const d=!o||0>=n||c(n)-c(n-1)<=r;u&&d&&i(u.value,s)?u.endIndex=n:(u&&l(u,u.endIndex,n),u={value:s,start:c(n),end:c(n),count:1,startIndex:n,endIndex:n})}return u&&l(u,u.endIndex,null),s}var Kn=Un;function Qn(t,e,n=0){return e>0?((t-n)%e+e)%e+n:t}function Zn(t,e,n){if(0>=n)return e-t;let o=(e-t)%n;return o>n/2?o-=n:-n/2>o&&(o+=n),o}function Jn(t,e,n){return e>n?t>=e||n>=t:t>=e&&n>=t}function to(t,e,n,o){return n>o?[...t.filter(t=>e(t)>=n),...t.filter(t=>e(t)<=o)]:t.filter(t=>Jn(e(t),n,o))}var eo=2*Math.PI;function no(t,e,n){const o=n?.center?.x??0,r=n?.center?.y??0;return{x:o+Math.sin(t)*e,y:r-Math.cos(t)*e}}function oo(t,e,n){return(Math.atan2(t-(n?.center?.x??0),-(e-(n?.center?.y??0)))+eo)%eo}function ro(t,e){const[n,o]=t,r=o-n||1,i=e?.startAngle??0,a=e?.endAngle??eo;return t=>i+(t-n)/r*(a-i)}function io(t,e){const[n,o]=t,[r,i]=e,a=o-n||1;return t=>r+(t-n)/a*(i-r)}function ao(t,e,n,o,r){const i=r?.center,a=(t,e)=>{const{x:n,y:o}=no(t,e,{center:i});return`${so(n)},${so(o)}`},s=Math.max(0,n),c=Math.max(s,o),l=Math.abs(e-t),u=t>e?0:1;if(l>=eo-1e-6){const t=i?.x??0,e=i?.y??0,n=`${so(t)},${so(e-c)}`,o=`${so(t)},${so(e+c)}`;let r=`M${n} A${so(c)},${so(c)} 0 1 1 ${o} A${so(c)},${so(c)} 0 1 1 ${n} Z`;if(s>0){const n=`${so(t)},${so(e-s)}`,o=`${so(t)},${so(e+s)}`;r+=` M${n} A${so(s)},${so(s)} 0 1 0 ${o} A${so(s)},${so(s)} 0 1 0 ${n} Z`}return r}const d=l>Math.PI?1:0,h=a(t,c),f=a(e,c);if(0>=s){const t=i?.x??0,e=i?.y??0;return`M${so(t)},${so(e)} L${h} A${so(c)},${so(c)} 0 ${d} ${u} ${f} Z`}const m=a(e,s),p=a(t,s);return`M${h} A${so(c)},${so(c)} 0 ${d} ${u} ${f} L${m} A${so(s)},${so(s)} 0 ${d} ${1===u?0:1} ${p} Z`}function so(t){return Math.round(1e3*t)/1e3}function co(t,e){return{x:t.x+e.x,y:t.y+e.y}}function lo(t,e){return{x:t.x-e.x,y:t.y-e.y}}function uo(t,e){return{x:t.x*e,y:t.y*e}}function ho(t){return Math.hypot(t.x,t.y)}function fo(t){const e=ho(t)||1;return{x:t.x/e,y:t.y/e}}var mo=[40,40],po=[.5,.5];function yo(t,e){const[n,o]=t.viewBox??mo,[r,i]=t.anchor??po,a=o>0?o:1,s=Math.max(0,e)/a,c=(n>0?n:a)*s,l=a*s;return{width:c,height:l,scale:s,offsetX:-r*c,offsetY:-i*l}}function go(t,e){const n=yo(t,e),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[t,e]of o){const n=Math.sqrt(t*t+e*e);n>r&&(r=n)}return r}function xo(t,e,n,o){if("none"!==t)return"color"===t||null==t?e??o:"accent"===t?n:t}function bo(t,e,n=0,o="horizontal"){const[r,i]=t.viewBox??mo,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,e));return s>a?a>0||1>s?"vertical"===o?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}import{jsx as wo,jsxs as Mo}from"react/jsx-runtime";var vo="var(--semiotic-text, currentColor)";function ko(t,e){const n=ot(t,100);return n>0?e/n*100*(e/n):Math.PI*e*e}function $o(t){const e=[],n=t.colorMap?Object.entries(t.colorMap):t.keys?t.keys.map(e=>[e,t.color?t.color(e):void 0]):[];if(n.length>0){const o=t.colorType??"fill",r=n.map(([t,e])=>({label:t,color:e}));e.push({type:o,label:t.colorLabel??"",items:r,styleFn:"line"===o?t=>({stroke:t.color??vo,strokeWidth:2,fill:"none"}):t=>({fill:t.color??vo,stroke:t.color??vo})})}if(t.symbolMap&&Object.keys(t.symbolMap).length>0){const n=t.symbolColor??vo,o=Object.entries(t.symbolMap).map(([t,e])=>({label:t,shape:e,color:n}));e.push({label:t.symbolLabel??"",items:o,styleFn:()=>({}),type:t=>{const e=t.shape;return wo("path",{d:tt(e,ko(e,7)),transform:"translate(8,8)",fill:t.color??n})}})}if(t.sizeStops&&t.sizeStops.length>0&&t.sizeRadius){const n=t.sizeRadius,o=t.sizeFormat??(t=>t+""),r=t.sizeColor??vo,i=t.sizeStops.map(t=>({label:o(t),r:Math.max(.5,n(t)),color:r}));e.push({label:t.sizeLabel??"",items:i,styleFn:()=>({}),type:t=>wo("circle",{cx:8,cy:8,r:t.r,fill:t.color??r})})}return e}function Ao(t){const e=t.orientation??"vertical",n=t.swatchSize??14,o=t.gap??8,r=t.labelGap??6,i=t.fontSize??12,a=t.color??"var(--semiotic-text-secondary, #888)",s=n+o;let c=0;const l=[];return t.entries.forEach((t,u)=>{l.push(Mo("g",{transform:`translate(${"vertical"===e?0:c},${"vertical"===e?c:0})`,children:[So(t,n,t.color??t.line??a,a),wo("text",{x:n+r,y:n/2,dominantBaseline:"middle",fontSize:i,fill:a,children:t.label})]},"legend-"+u)),c+="vertical"===e?s:n+r+t.label.length*i*.58+o+8}),wo("g",{className:t.className,transform:`translate(${t.x},${t.y})`,style:{pointerEvents:"none"},children:l},t.keyId)}function So(t,e,n,o){if(t.shape){const o=ko(t.shape,e/2-1);return wo("path",{d:tt(t.shape,o),transform:`translate(${e/2},${e/2})`,fill:n})}if(t.hatch){const n=t.color??o;return Mo("g",{children:[wo("svg",{width:e,height:e,style:{overflow:"hidden"},children:[-e,-e/2,0,e/2].map((t,o)=>wo("line",{x1:t,y1:e,x2:t+e,y2:0,stroke:n,strokeWidth:1,opacity:.7},o))}),wo("rect",{width:e,height:e,fill:"none",stroke:n,strokeWidth:1,opacity:.5,rx:2})]})}return wo("rect",t.line?{y:e/2-1.5,width:e,height:3,rx:1.5,fill:t.line}:{width:e,height:e,rx:2,fill:n})}var Io=new Set(["rows"]);function zo(t){const e=t,n=[Eo(e,["datum","data"]),Eo(e,["datum"]),Eo(e,["data","data"]),Eo(e,["data"]),Eo(e,["node","datum","data"]),Eo(e,["node","datum"]),t];for(const t of n){if(!Wo(t))continue;const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||"function"==typeof o||(e[n]=o);if(Object.keys(e).length>0)return e}return null}function No(t,e={}){const n=zo(t);if(!n)return[];const o=new Set(Io);if(e.excludeKeys)for(const t of e.excludeKeys)o.add(t);const r=[];for(const[t,i]of Object.entries(n))if((e.includeInternal||!t.startsWith("_"))&&!o.has(t)&&(e.includeEmpty||null!=i&&""!==i)&&"function"!=typeof i&&(r.push({key:t,label:To(t,e.labels),value:i,formatted:e.valueFormat?e.valueFormat(i,t,n):Co(i)}),r.length>=(e.maxEntries??8)))break;return r}function Co(t){if(null==t)return"";if(t instanceof Date)return t.toISOString();if("number"==typeof t)return Number.isInteger(t)?t+"":t.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof t)return t?"true":"false";if(Array.isArray(t))return t.length+" items";if("object"==typeof t)try{return JSON.stringify(t)}catch{return t+""}return t+""}function To(t,e){return"function"==typeof e?e(t):e&&e[t]?e[t]:t}function Eo(t,e){let n=t;for(const t of e){if(!Wo(n))return;n=n[t]}return n}function Wo(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Lo(t,e){const n=new Map;for(const e of t)n.set(e.id,new Set);for(const t of e)n.has(t.source)||n.set(t.source,new Set),n.has(t.target)||n.set(t.target,new Set),n.get(t.source).add(t.target),n.get(t.target).add(t.source);return n}function Fo(t,e){const n={};for(const e of t)n[e.id]=0;for(const t of e)n[t.source]=(n[t.source]||0)+1,n[t.target]=(n[t.target]||0)+1;return n}function jo(t,e){const n={[e]:0},o=[e];let r=0;for(;o.length>r;){const e=o[r];r+=1;for(const r of t.get(e)||[])void 0===n[r]&&(n[r]=n[e]+1,o.push(r))}return n}function Ro(t,e,n,o){if(n===o)return n?[n]:[];const r=Lo(t,e),i={[n]:null},a=[n];let s=0;for(;a.length>s;){const t=a[s];if(s+=1,t===o)break;for(const e of r.get(t)||[])void 0===i[e]&&(i[e]=t,a.push(e))}if(void 0===i[o])return[];const c=[];let l=o;for(;null!=l;)c.unshift(l),l=i[l];return c}function Oo(t,e,n,o=1){const r=Lo(t,e);if(!r.has(n))return new Set;const i=jo(r,n),a=new Set;for(const t in i)i[t]>o||a.add(t);return a}function Po(t,e){const n=Lo(t,e),o={};for(const e of t)o[e.id]=0;for(const e of t.map(t=>t.id)){const r=[],i={},a={},s={};for(const e of t)i[e.id]=[],a[e.id]=0,s[e.id]=-1;a[e]=1,s[e]=0;const c=[e];let l=0;for(;c.length>l;){const t=c[l];l+=1,r.push(t);for(const e of n.get(t)||[])0>s[e]&&(s[e]=s[t]+1,c.push(e)),s[e]===s[t]+1&&(a[e]+=a[t],i[e].push(t))}const u={};for(const e of t)u[e.id]=0;for(;r.length;){const t=r.pop();for(const e of i[t])u[e]+=a[e]/a[t]*(1+u[t]);t!==e&&(o[t]+=u[t])}}for(const t in o)o[t]/=2;return o}function qo(t,e){const n=Lo(t,e),o={};for(const e of t){const t=jo(n,e.id);let r=0,i=0;for(const e in t)r+=t[e],i+=1;o[e.id]=r>0?(i-1)/r:0}return o}function Do(t,e){const n=Lo(t,e),o={};for(const e of t){const t=[...n.get(e.id)||[]],r=t.length;if(2>r){o[e.id]=0;continue}let i=0;for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1)n.get(t[e])?.has(t[o])&&(i+=1);o[e.id]=2*i/(r*(r-1))}return o}function Bo(t){let e=0;for(const n in t)t[n]>e&&(e=t[n]);const n={};for(const o in t)n[o]=e>0?t[o]/e:0;return n}function Yo(t,e,n,o={}){const r=Lo(t,e),i={};for(const e of t)i[e.id]=jo(r,e.id);let a=o.minHops??4,s=o.startThreshold??.08;const c=o.maxThreshold??.2,l=new Set;let u=0;for(;0===l.size&&40>u;){for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1){const r=t[e].id,c=t[o].id,u=n[r],d=n[c];if(!u||!d)continue;const h=u.x-d.x,f=u.y-d.y;(void 0===i[r][c]?1/0:i[r][c])>=a&&s>Math.sqrt(h*h+f*f)&&(l.add(r),l.add(c))}0===l.size&&(s+=.02,s>c&&(s=o.startThreshold??.08,a=Math.max(2,a-1))),u+=1}return{problemIds:l,threshold:s,minHops:a}}function Vo(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function Ho(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const t=Error("Force layout aborted");return t.name="AbortError",t}var Xo=class{constructor(t=function(){const t="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):function(t){if("undefined"!=typeof __filename){const e=__filename.replace(/\\/g,"/"),n=e.startsWith("/")?e:"/"+e;return new URL("./"+t,"file:"+n)}throw Error("Cannot resolve module worker asset: "+t)}("forceLayoutWorker.js");return new Worker(t,{type:"module",name:"semiotic-force-layout"})}()){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.worker=t,this.worker.onmessage=t=>{const e=t.data,n=e.requestId,o=null!=n?this.pending.get(n):this.pending.values().next().value;if(o){if(null!=n?this.pending.delete(n):this.pending.clear(),o.cleanup(),e.error){const t=Error(e.error.message);return t.name=e.error.name??"Error",e.error.stack&&(t.stack=e.error.stack),void o.reject(t)}o.resolve({positions:e.positions??{}})}},this.worker.onerror=t=>{this.rejectAll(Error(t.message||"Force layout worker failed")),this.terminate()}}get isDead(){return this.dead}request(t,e){if(this.dead)return Promise.reject(Error("Force layout worker session is closed"));if(e?.aborted)return Promise.reject(Ho());const n=this.nextRequestId;this.nextRequestId+=1;const o={requestId:n,request:t};return new Promise((t,r)=>{const i=()=>{this.pending.delete(n),e?.removeEventListener("abort",i),r(Ho())},a=()=>e?.removeEventListener("abort",i);this.pending.set(n,{cleanup:a,reject:r,resolve:t}),e?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(o)}catch(t){this.pending.delete(n),a(),r(t instanceof Error?t:Error(t+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error("Force layout worker terminated")),this.worker.terminate())}rejectAll(t){for(const e of this.pending.values())e.cleanup(),e.reject(t);this.pending.clear()}},_o=null;async function Go(t,e,n={}){const{execution:o="auto",signal:r,workerThreshold:i,nodeRadius:a,...s}=n,c=s.iterations??260,l=Vo()&&function(t,e,n,o,r=4e4){return"sync"!==t&&("worker"===t||o*(e+n)>=r)}(o,t.length,e.length,c,i);if(!l)return E(t,e,{...s,nodeRadius:a});const u={kind:"normalized",nodes:t.map(t=>({...t})),edges:e.map(t=>({...t})),options:s,nodeRadii:"function"==typeof a?Object.fromEntries(t.map(t=>[t.id,a(t)])):null==a?void 0:Object.fromEntries(t.map(t=>[t.id,a]))};try{return(await function(t,e){return Vo()?e?.aborted?Promise.reject(Ho()):(_o&&!_o.isDead||(_o=new Xo),_o).request(t,e):Promise.reject(Error("Web Workers are unavailable"))}(u,r)).positions}catch(n){if("AbortError"===n?.name)throw n;return E(t,e,{...s,nodeRadius:a})}}function Uo(t,e){if("region-enter"!==e.type)return t;const n=e.region.id,o=t[n]??{id:n,label:e.region.label??n,count:0,bodyIds:[]};if(o.bodyIds.includes(e.bodyId))return t;const r=[...o.bodyIds,e.bodyId];return{...t,[n]:{...o,count:r.length,bodyIds:r}}}function Ko(t,e){return(e??Object.keys(t)).map(e=>t[e]).filter(t=>null!=t).map(t=>({label:t.label??t.id,value:t.count}))}function Qo(t,e){const n=e instanceof Set?e:new Set(e);return t.map(t=>{const e=t.bodyIds??[],o=e.filter(t=>!n.has(t)),r=e.length-o.length,i=t.completion?.mode??"allMembersAbsorbed",a=t.completion?.valueByBodyId,s=t=>{const e=a?.[t];return Number.isFinite(e)&&Number(e)>=0?Number(e):1},c=e.reduce((t,e)=>t+s(e),0),l=e.reduce((t,e)=>t+(n.has(e)?s(e):0),0),u=t.completion?.threshold,d="threshold"===i?Number.isFinite(u)&&Number(u)>=0?Number(u):c:void 0;return{id:t.id,label:t.label??t.id,mode:i,complete:e.length>0&&("anyAbsorbed"===i?r>0:"threshold"===i?l>=(d??c):0===o.length),absorbed:r,total:e.length,absorbedValue:l,totalValue:c,threshold:d,missing:o}})}function Zo(t,e,n){return Math.max(e,Math.min(n,t))}function Jo(t,e,n={}){const o=n.random??Math.random,r=t.stages.find(t=>t.id===e)??t.stages[t.stages.length-1],i=Zo(n.along??.5,.05,.95),a=n.jitterX??0,s=n.padY??20,c=r.x0+(r.x1-r.x0)*i+(2*o()-1)*a,l=Math.min(1,r.width/2),u=Zo(c,r.x0+l,r.x1-l),d=t.boundaryY(u,"top")+s,h=t.boundaryY(u,"bottom")-s;return{x:u,y:h>d?d+o()*Math.max(1,h-d):t.midY}}function tr(t){return"bowtie"===t.shape?[{id:"incoming",role:"incoming",points:[[t.left,t.topY],[t.centerLeft,t.pinchTop],[t.centerLeft,t.pinchBottom],[t.left,t.bottomY]]},{id:"center",role:"center",points:[[t.centerLeft,t.pinchTop],[t.centerRight,t.pinchTop],[t.centerRight,t.pinchBottom],[t.centerLeft,t.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[t.centerRight,t.pinchTop],[t.right,t.topY],[t.right,t.bottomY],[t.centerRight,t.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[t.left,t.topY],[t.right,"funnel"===t.shape?t.pinchTop:t.topY],[t.right,"funnel"===t.shape?t.pinchBottom:t.bottomY],[t.left,t.bottomY]]}]}function er(t,e,n){return Math.max(e,Math.min(n,t))}function nr(t,e,n,o,r,i={}){return{id:t,friction:i.friction,restitution:i.restitution,bodyFilter:i.bodyFilter,shape:{type:"segment",x1:e,y1:n,x2:o,y2:r,thickness:i.thickness??8}}}function or(t){const e=t.shape??"lane",n=Math.max(1,Math.round(t.width)),o=Math.max(1,Math.round(t.height)),r=t.padX??46,i=t.padY??72,a=r,s=n-r,c=i,l=o-Math.max(24,Math.round(.45*i)),u=(c+l)/2,d=Math.max(1,l-c),h=er(t.pinchRatio??.18,.06,.5),f=Number(t.pinchHeightOffset??0),m=Number.isFinite(f)?f:0,p=er(d*h+m,.06*d,.5*d),y=p/2,g=u-y,x=u+y,b=t.idPrefix??"process",w=t.friction??.58,M=t.restitution??.18,v=t.wallThickness??8,k=t.stages;if(!k.length)throw Error("processStageLayout requires at least one stage");const $=er(t.centerStageIndex??Math.floor(k.length/2),0,k.length-1),A=function(t){const e=t.reduce((t,e)=>t+(e.share??1),0);return e>0?e:t.length}(k),S=s-a;let I=a;const z=k.map((t,e)=>{const n=I,o=e===k.length-1?s:I+(t.share??1)/A*S;return I=o,{id:t.id,label:t.label,description:t.description,kind:t.kind??"stage",index:e,x0:n,x1:o,x:(n+o)/2,width:o-n,y:u,height:d}}),N=z[$],C=N.x0,T=N.x1,E=(t,n)=>{if("lane"===e)return"top"===n?c:l;if("funnel"===e){const e=er((t-a)/Math.max(1,s-a),0,1);return"top"===n?c+(g-c)*e:l+(x-l)*e}if(C>=t){const e=er((t-a)/Math.max(1,C-a),0,1);return"top"===n?c+(g-c)*e:l+(x-l)*e}if(T>=t)return"top"===n?g:x;const o=er((t-T)/Math.max(1,s-T),0,1);return"top"===n?g+(c-g)*o:x+(l-x)*o},W=z.map(t=>{const e=Math.min(E(t.x0,"top"),E(t.x1,"top")),n=Math.max(E(t.x0,"bottom"),E(t.x1,"bottom"));return{...t,y:(e+n)/2,height:Math.max(1,n-e)}}),L={thickness:v,friction:w,restitution:M},F=[];"lane"===e?F.push(nr(b+"-top",a,c,s,c,L),nr(b+"-bottom",a,l,s,l,L),nr(b+"-left",a,c,a,l,{...L,thickness:Math.max(6,v-2)}),nr(b+"-right",s,c,s,l,{...L,thickness:Math.max(6,v)})):"funnel"===e?F.push(nr(b+"-top",a,c,s,g,L),nr(b+"-bottom",a,l,s,x,L),nr(b+"-left",a,c,a,l,{...L,thickness:Math.max(6,v-2)}),nr(b+"-right",s,g,s,x,{...L,thickness:Math.max(6,v)})):F.push(nr(b+"-left-top",a,c,C,g,L),nr(b+"-left-bottom",a,l,C,x,L),nr(b+"-center-top",C,g,T,g,L),nr(b+"-center-bottom",C,x,T,x,L),nr(b+"-right-top",T,g,s,c,L),nr(b+"-right-bottom",T,x,s,l,L),nr(b+"-left",a,c,a,l,{...L,thickness:Math.max(6,v-2)}),nr(b+"-right",s,c,s,l,{...L,thickness:Math.max(6,v)}));const j=t.membraneDampingScale??.5,R=a,O=Math.max(1,("bowtie"===e?C:s)-R),P=(t.membranes??[]).map(t=>{const e=R+er(t.offset,0,1)*O,n=t.width??18+18*t.cost,o=d-16,r=u+.25*(t.wobble??0);return{...t,x:e,y:r,width:n,height:o}}),q=!1===t.includeMembraneRegions?[]:P.map(t=>ar({id:t.id,label:t.label??t.id,description:t.description??(t.label??t.id)+" is a permeable region. It taxes energy and damps velocity while bodies overlap it.",x:t.x,y:t.y,width:t.width,height:t.height,cost:t.cost,dampingScale:t.dampingScale??j,bodyStyle:t.bodyStyle,metadata:t.metadata,semanticItem:t.semanticItem,color:t.color}));return{shape:e,width:n,height:o,padX:r,padY:i,left:a,right:s,topY:c,bottomY:l,midY:u,centerLeft:C,centerRight:T,pinchHeight:p,pinchTop:g,pinchBottom:x,stages:W,membranes:P,colliders:F,regionEffects:q,boundaryY:E}}function rr(t){return{id:t.id,label:t.label,description:t.description,kind:t.kind,shape:(e=t.x,n=t.y,o=t.width,r=t.height,{type:"aabb",x:e,y:n,width:o,height:r}),bodyFilter:t.bodyFilter,collider:t.collider,colliderThickness:t.colliderThickness,friction:t.friction,restitution:t.restitution,semanticItem:t.semanticItem,metadata:t.metadata,bodyStyle:t.bodyStyle,attributes:t.attributes,onEnter:t.onEnter,onExit:t.onExit};var e,n,o,r}function ir(t,e={}){const n=e.idPrefix??"stage",o=Math.max(0,e.insetX??0),r=Math.max(0,e.insetY??1);return t.stages.map(t=>{const i="function"==typeof e.metadata?e.metadata(t):e.metadata??{};return{...rr({id:n?`${n}:${t.id}`:t.id,label:t.label??t.id,description:t.description,kind:"region",x:t.x,y:t.y,width:Math.max(1,t.width-2*o),height:Math.max(1,t.height-2*r),bodyFilter:e.bodyFilter,semanticItem:e.semanticItem,attributes:{primitive:"processStage",stageId:t.id,stageIndex:t.index},metadata:{...i,primitive:"processStage",stageId:t.id,stageIndex:t.index}})}})}function ar(t){const e=t.dampingScale??.5,n=t.energyScale??1,o=er(t.cost,0,2);return{...rr({...t,kind:t.kind??"membrane",attributes:{primitive:"membrane",membraneCost:o,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:o*e,energyDelta:-o*n}}function sr(t){return{...rr({...t,kind:t.kind??"charge-gate",attributes:{primitive:"chargeGate",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),charge:t.charge??!0,energyDelta:t.energyDelta,impulseOnEnter:t.impulseOnEnter}}function cr(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:12,y:0};return{...rr({...t,kind:t.kind??"force-field",attributes:{primitive:"routeSurface",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.015}}function lr(t){const e=t.pressure??t.occupancy??0,n=t.baseDamping??.08,o=t.dampingPerUnit??.12,r=t.energyPerUnit??0;return{...rr({...t,kind:t.kind??"membrane",attributes:{primitive:"pressureField",pressure:e,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:n+e*o,energyDelta:r?-e*r:void 0,force:t.force}}function ur(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force;return{...rr({...t,kind:t.kind??"force-field",attributes:{primitive:"capacitatedSensor",capacity:t.capacity,unitsPerSecond:t.unitsPerSecond??t.capacity,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping,charge:t.charge??t.capacity}}function dr(t){return{...rr({...t,kind:t.kind??"force-field",attributes:{primitive:"portal",targetStage:t.targetStage,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,impulseOnEnter:t.impulseOnEnter,damping:t.damping??.08}}function hr(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:24,y:0};return{...rr({...t,kind:t.kind??"sink",attributes:{primitive:"absorb",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.02,charge:t.charge??"absorbed"}}function fr(t){return{...rr({...t,kind:t.kind??"force-field",attributes:{primitive:"forceField",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,damping:t.damping,energyDelta:t.energyDelta}}function mr(t){const e=t.x??t.anchor?.x??0,n=t.y??t.anchor?.y??0;return{id:t.id,label:t.label,description:t.description,group:t.group,bodyIds:t.bodyIds,datum:t.datum,state:t.state,x:e,y:n,width:t.width,height:t.height,anchor:t.anchor??{x:e,y:n},completion:t.completion,tether:t.tether,semanticItem:t.semanticItem}}function pr(t){const e=t.idPrefix??"lane",n={thickness:t.thickness??8,friction:t.friction??.5,restitution:t.restitution??.16},o=[nr(e+"-top",t.left,t.top,t.right,t.top,n),nr(e+"-bottom",t.left,t.bottom,t.right,t.bottom,n)];return t.openEnds||o.push(nr(e+"-left",t.left,t.top,t.left,t.bottom,n),nr(e+"-right",t.right,t.top,t.right,t.bottom,n)),o}var yr=[.1,.5,.9],gr=1e6;function xr(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function br(t,e,n,o,r){return"function"==typeof o?o(t,e,n):function(t,e){let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}(t,o??r)}function wr(t){const e=Number(t.toFixed(12));return Object.is(e,-0)?0:e}function Mr(t,e,n,o){const r=t.flatMap((t,r)=>{const i=xr(br(t,r,e,n,"time")),a=xr(br(t,r,e,o,"value"));return null==i||null==a?[]:[{time:wr(i),value:a,index:r}]});r.sort((t,e)=>t.time-e.time||t.index-e.index);const i=[];for(const t of r){const e=i[i.length-1];e?.time===t.time?e.value=t.value:i.push({time:t.time,value:t.value})}return i}function vr(t,e,n,o){if(!t.length)return null;const r=t[0],i=t[t.length-1];if(r.time>e)return"clamp"===o?r.value:null;if(e>i.time)return"clamp"===o?i.value:null;const a=function(t,e){let n=0,o=t.length;for(;o>n;){const r=n+o>>>1;e>t[r].time?n=r+1:o=r}return n}(t,e),s=t[a];if(s?.time===e)return s.value;const c=t[Math.max(0,a-1)];return"step"!==n&&s&&s.time!==c.time?c.value+(e-c.time)/(s.time-c.time)*(s.value-c.value):c.value}function kr(t,e){if(1===t.length)return t[0];const n=(t.length-1)*e,o=Math.floor(n),r=Math.ceil(n);return o===r?t[o]:t[o]+(t[r]-t[o])*(n-o)}function $r(t){const e=t.interpolation??"step",n=t.outsideDomain??"omit",o=function(t){const e=(t??yr).map(t=>{const e=xr(t);if(null==e||0>e||e>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+t);return wr(e)});return Array.from(new Set(e)).sort((t,e)=>t-e)}(t.quantiles),r=function(t){if(Array.isArray(t)){if(t.length>gr)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(t.map(xr).filter(t=>null!=t).map(wr))).sort((t,e)=>t-e)}const e=t,n=xr(e.start),o=xr(e.end),r=xr(e.step);if(null==n||null==o||null==r||0>=r||n>o)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const i=Math.floor((o-n)/r)+1;if(i>gr)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const a=[],s=1e-10*Math.max(1,Math.abs(o),Math.abs(n));for(let t=0;i>t;t+=1){const e=n+t*r;if(e>o+s)break;a.push(wr(Math.min(e,o)))}if(a.length&&s>=Math.abs(a[a.length-1]-o)||a.push(wr(o)),a.length>gr)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((t,e)=>t-e)}(t.sampleAt),i=t.runs.map(e=>Mr(e.samples,e.id,t.timeAccessor,t.valueAccessor));return{points:r.map(t=>{const r=i.map(o=>vr(o,t,e,n)).filter(t=>null!=t).sort((t,e)=>t-e),a={};for(const t of o)a[t]=r.length?kr(r,t):null;return{time:t,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?kr(r,.5):null,quantiles:a}}),quantiles:o,interpolation:e,outsideDomain:n,runCount:t.runs.length}}function Ar(t,e){return t.quantiles.length?"lower"===e?t.quantiles[0]:t.quantiles[t.quantiles.length-1]:"lower"===e?"min":"max"}function Sr(t,e){if("min"===e||"median"===e||"max"===e)return t[e];const n=xr(e);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+e);const o=wr(n);if(!Object.prototype.hasOwnProperty.call(t.quantiles,o))throw Error(`comparePhysicsTrace could not find quantile ${o} in the reference envelope`);return t.quantiles[o]??null}function Ir(t,e,n){return e>t?"below":t>n?"above":"inside"}function zr(t,e){const n=Math.max(0,e.time-t.time);if(0>=n||null==t.value||null==t.lower||null==t.upper||null==e.value||null==e.lower||null==e.upper)return{below:0,inside:0,above:0,observed:0};const o=t.value-t.lower,r=e.value-e.lower,i=t.value-t.upper,a=e.value-e.upper,s=[0,1];for(const[t,e]of[[o,r],[i,a]])(0>t&&e>0||t>0&&0>e)&&s.push(-t/(e-t));s.sort((t,e)=>t-e);let c=0,l=0,u=0;for(let o=0;s.length-1>o;o+=1){const r=s[o],i=s[o+1];if(r>=i)continue;const a=(r+i)/2,d=(i-r)*n,h=Ir(t.value+(e.value-t.value)*a,t.lower+(e.lower-t.lower)*a,t.upper+(e.upper-t.upper)*a);"below"===h?c+=d:"above"===h?u+=d:l+=d}return{below:c,inside:l,above:u,observed:n}}function Nr(t,e,n={}){const o=n.interpolation??e.interpolation,r=n.outsideDomain??e.outsideDomain,i=Mr(t,n.traceId??"trace",n.timeAccessor,n.valueAccessor),a=n.lower??Ar(e,"lower"),s=n.upper??Ar(e,"upper"),c=e.points.map(t=>{const e=vr(i,t.time,o,r),n=Sr(t,a),c=Sr(t,s);if(null!=n&&null!=c&&n>c)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+t.time);return{time:t.time,value:e,lower:n,upper:c,status:null==e||null==n||null==c?"unobserved":Ir(e,n,c)}});let l=0,u=0,d=0,h=0,f=null,m=0,p=null;for(const t of c){if("below"===t.status?l+=1:"inside"===t.status?u+=1:"above"===t.status&&(d+=1),null==t.value||null==t.lower||null==t.upper)continue;const e=Math.max(0,t.value-t.upper),n=Math.max(0,t.lower-t.value);e>h&&(h=e,f=t.time),n>m&&(m=n,p=t.time)}let y=0,g=0,x=0,b=0;for(let t=0;c.length-1>t;t+=1){const e=c[t],n=c[t+1],r=Math.max(0,n.time-e.time);if(r>0){if("linear"===o){const t=zr(e,n);y+=t.below,g+=t.inside,x+=t.above,b+=t.observed;continue}"unobserved"!==e.status&&(b+=r,"below"===e.status?y+=r:"above"===e.status?x+=r:g+=r)}}const w=c[0]?.time,M=c[c.length-1]?.time,v=null==w||null==M?0:Math.max(0,M-w);return{points:c,sampleCount:c.length,observedSamples:l+u+d,belowSamples:l,insideSamples:u,aboveSamples:d,totalDuration:v,observedDuration:b,unobservedDuration:Math.max(0,v-b),belowDuration:y,insideDuration:g,aboveDuration:x,peakExcess:h,peakExcessAt:f,peakDeficit:m,peakDeficitAt:p}}function Cr(t){return{id:t,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Tr(t){const e=Array.from(new Set(t.bodyIds??[]));return{stages:t.stages.map(t=>({...t})),bodyIds:e,entities:Object.fromEntries(e.map(t=>[t,Cr(t)]))}}function Er(t,e,n={}){if("region-enter"!==e.type)return t;const o=function(t,e){const n=e.stageId?.(t);if(n)return n;const o=t.region.metadata;if(o&&"object"==typeof o){const t=o.stageId;if("string"==typeof t)return t}return t.region.id}(e,n),r=t.stages.findIndex(t=>t.id===o);if(0>r)return t;const i=n.entityId?.(e)??e.bodyId;if(!i)return t;const a=t.entities[i]??Cr(i),s=a.currentStageId?t.stages.findIndex(t=>t.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(o),l=Number(e.observation.timestamp),u=Number.isFinite(l)?l:0,d={...a,currentStageId:o,furthestStageId:r>a.furthestStageIndex?o:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,r),visitedStageIds:c?[...a.visitedStageIds,o]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[o]:(a.visitsByStage[o]??0)+1},firstEnteredAt:c?{...a.firstEnteredAt,[o]:u}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[o]:u},regressionCount:s>=0&&s>r?a.regressionCount+1:a.regressionCount};return{...t,bodyIds:t.bodyIds.includes(i)?t.bodyIds:[...t.bodyIds,i],entities:{...t.entities,[i]:d}}}function Wr(t){const e=t.bodyIds.map(e=>t.entities[e]??Cr(e)),n=e.length;let o=n;return t.stages.map((t,r)=>{const i=e.filter(t=>t.furthestStageIndex>=r).length,a=e.filter(e=>e.visitedStageIds.includes(t.id)).length,s=e.reduce((e,n)=>e+(n.visitsByStage[t.id]??0),0),c={id:t.id,label:t.label??t.id,reached:i,entered:a,total:n,conversion:n>0?i/n:0,fromPrevious:o>0?i/o:0,dropoff:Math.max(0,o-i),visits:s,repeatVisits:Math.max(0,s-a)};return o=i,c})}function Lr(t,e){if("function"==typeof e){const n=e(t);return Number.isFinite(n)&&n>0?Number(n):1}const n=t.datum;if(e&&n&&"object"==typeof n){const t=Number(n[e]);if(Number.isFinite(t)&&t>0)return t}const o=Number(n?.work??n?.reviewWork??n?.value);return Number.isFinite(o)&&o>0?o:1}function Fr(t,e){if("function"==typeof e){const n=e(t);if(null!=n&&(n+"").length>0)return n+""}else if(e){const n=Rr(t.datum,e),o=Rr(t,e),r=n??o;if(null!=r&&(r+"").length>0)return r+""}return t.id}function jr(t,e){if(0===t.length)return 0;if(1===t.length)return t[0];const n=Math.max(0,Math.min(1,e))*(t.length-1),o=Math.floor(n);return t[o]+(t[Math.ceil(n)]-t[o])*(n-o)}function Rr(t,e){if(!e)return;let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}function Or(t,e){if(!e)return!0;if("function"==typeof e)return e(t);const n=Rr(t,e.property);return!("equals"in e&&!Object.is(n,e.equals)||"notEquals"in e&&Object.is(n,e.notEquals)||e.oneOf&&!e.oneOf.some(t=>Object.is(n,t))||e.notOneOf&&e.notOneOf.some(t=>Object.is(n,t)))}function Pr(t){const e=t.regionId,n=Math.max(0,t.unitsPerSecond),o=t.queueLayout??"lane",r=t.queueSlotSpacing??14,i=t.queueStiffness??.35,a=Number.isFinite(t.maxQueue)?Math.max(0,Math.floor(Number(t.maxQueue))):1/0,s=Math.max(.25,t.metricWindowSeconds??30),c=Math.max(1/60,t.snapshotIntervalSeconds??.25),l=t.releaseImpulse??{x:90,y:0},u=new Map,d=new Map,h=new Map,f=new Map,m=new Map,p=new Map,y=new Map,g=[];let x=0,b=new Map,w=new Map,M=0,v=0,k=0,$=null,A=0,S=0,I=0,z=0,N=0,C=0,T=0,E=0,W=0,L=0,F=0,j=0,R=-1,O=!1;function P(t,n){const o=n(t);return!!o&&o.activeRegionIds.includes(e)}function q(){j+=1}function D(t){return{bodyId:t.bodyId,jobId:t.jobId,visitId:t.visitId,visit:t.visit,regionId:e,work:t.total,queuedAt:t.queuedAt}}function B(n,o,r,i){const a={bodyId:n.id,jobId:o.jobId,visitId:o.visitId,visit:o.visit,remaining:o.work,total:o.work,queuedAt:o.queuedAt,sequence:i};return u.set(o.jobId,a),y.delete(n.id),p.set(n.id,o.jobId),S+=1,I+=o.work,q(),function(n,o,r){const i=D(o);t.onQueued?.(n,i),r.controls.recordObservation({type:"physics-capacity-queued",bodyId:n.id,datum:n.datum,x:n.x,y:n.y,regionId:e,work:o.total,jobId:o.jobId,visitId:o.visitId,visit:o.visit,queuedAt:o.queuedAt,queueDepth:u.size})}(n,a,r),a}function Y(t){if(u.size>=a||0===d.size)return;const e=Array.from(d.values()).sort((t,e)=>t.sequence-e.sequence);for(const n of e){if(u.size>=a)break;const e=m.get(n.jobId);e&&h.has(n.jobId)?(d.delete(n.jobId),y.delete(n.bodyId),B(e,n,t,n.sequence)):d.delete(n.jobId)}}function V(){let t=0;for(const e of u.values())t+=e.remaining;return t}function H(){W=Math.max(W,u.size),L=Math.max(L,V())}function X(){const t=k-s,e=Math.max(0,Math.min(s,k-($??k)));let o=0,r=0,i=0,a=0,c=0;for(const e of g){if(t>e.end)continue;o+=e.arrivals,r+=e.arrivalWork,i+=e.completions,a+=e.completedWork;const n=e.end-e.start;c+=n>0&&t>e.start?e.processedWork*Math.min(1,Math.max(0,e.end-t)/n):e.processedWork}const l=e>0?r/e:0;return{seconds:e,arrivals:o,arrivalWork:r,completions:i,completedWork:a,processedWork:c,arrivalsPerSecond:e>0?o/e:0,throughputPerSecond:e>0?i/e:0,utilization:e>0&&n>0?Math.max(0,Math.min(1,c/(n*e))):0,pressure:n>0?l/n:0}}return{id:t.id??"capacity-queue:"+e,continuous:!1!==t.continuous,tick:o=>{const r=o.controls.readBodies(),i=new Map,S=new Map;for(const e of r){if(i.set(e.id,e),!P(e.id,o.getRegionState))continue;if(!Or(e,t.bodyFilter))continue;const n=Fr(e,t.jobKey),r=S.get(n)??[];r.push(e),S.set(n,r)}const I=Number.isFinite(o.dt)?Math.max(0,o.dt):0;if(!O){const t=Number.isFinite(o.elapsed)?Math.max(0,o.elapsed):I;k=Math.max(0,t-I),O=!0}const W=k,L=W+I;k=L,$=null==$?W:Math.min($,W);const j={start:W,end:L,arrivals:0,arrivalWork:0,completions:0,completedWork:0,processedWork:0},V=new Map;for(const[t,e]of S){const n=h.get(t)?.bodyId,o=e.find(t=>t.id===n)??e[0];V.set(t,o),m.set(t,o)}for(const[n,r]of h){if(V.has(n))continue;const a=u.get(n),s=i.get(r.bodyId)??m.get(n);if(a){u.delete(n),p.delete(a.bodyId),T+=1,E+=a.remaining,q();const i={...D(a),abandonedAt:k,remainingWork:a.remaining,queueSeconds:Math.max(0,k-a.queuedAt)};s&&t.onAbandoned?.(s,i),o.controls.recordObservation({type:"physics-capacity-abandoned",bodyId:r.bodyId,datum:s?.datum,x:s?.x,y:s?.y,regionId:e,work:a.total,remainingWork:a.remaining,jobId:n,visitId:a.visitId,visit:a.visit,queuedAt:a.queuedAt,abandonedAt:k,queueSeconds:i.queueSeconds,queueDepth:u.size})}d.delete(n),y.delete(r.bodyId),h.delete(n),m.delete(n)}for(const[n,r]of V){if(h.has(n))continue;const i=(f.get(n)??0)+1;f.set(n,i);const s=Lr(r,t.unitAccessor),c={bodyId:r.id,jobId:n,visitId:`${e}:${n}:${i}`,visit:i,regionId:e,work:s,queuedAt:k};h.set(n,c),A+=1,j.arrivals+=1,j.arrivalWork+=s;const l=x++;if(a>u.size)B(r,c,o,l);else{const a={...c,blockedAt:k,sequence:l};d.set(n,a),y.set(r.id,n),C+=1,q(),t.onBlocked?.(r,a),o.controls.recordObservation({type:"physics-capacity-blocked",bodyId:r.id,datum:r.datum,x:r.x,y:r.y,regionId:e,work:s,jobId:n,visitId:c.visitId,visit:i,queuedAt:k,blockedAt:k,queueDepth:u.size,blockedDepth:d.size})}}Y(o),H();const X=Array.from(u.values()).sort((t,e)=>t.sequence-e.sequence);let _=n*I;for(const n of X){if(0>=_)break;const r=Math.min(n.remaining,_);if(n.remaining-=r,_-=r,z+=r,j.processedWork+=r,n.remaining>1e-6)continue;u.delete(n.jobId),p.delete(n.bodyId),v+=1,N+=n.total,j.completions+=1,j.completedWork+=n.total;const a=Math.max(0,k-n.queuedAt);F+=a,q();const s=i.get(n.bodyId);if(!s)continue;o.controls.applyImpulse(n.bodyId,l.x??0,l.y??0);const c={...D(n),completedAt:k,queueSeconds:a};t.onProcessed?.(s,c),o.controls.recordObservation({type:"physics-capacity-processed",bodyId:n.bodyId,datum:s.datum,x:s.x,y:s.y,regionId:e,work:n.total,jobId:n.jobId,visitId:n.visitId,visit:n.visit,queuedAt:n.queuedAt,completedAt:k,queueSeconds:a,queueDepth:u.size})}Y(o),H(),function(){const t=Array.from(u.values()).sort((t,e)=>t.sequence-e.sequence);b=new Map(t.map((t,e)=>[t.bodyId,e]));const e=Array.from(d.values()).sort((t,e)=>t.sequence-e.sequence);w=new Map(e.map((t,e)=>[t.bodyId,e])),M=t.length}(),function(t){(t.end>t.start||t.arrivals>0||t.completions>0||t.processedWork>0)&&g.push(t);const e=k-s;for(;g.length>0&&e>g[0].end;)g.shift()}(j);const G=Math.floor(k/c);G!==R&&(R=G,q())},getSnapshot:()=>{const t=V(),o=function(){let t=0;for(const e of d.values())t+=e.work;return t}(),r=u.size,i=Array.from(u.values()).map(t=>Math.max(0,k-t.queuedAt)).sort((t,e)=>t-e),a=i.reduce((t,e)=>t+e,0);return{regionId:e,queueDepth:r,processedCount:v,unitsPerSecond:n,remainingWork:t,meanRemainingWork:r>0?t/r:0,waitingWork:t+o,blockedDepth:d.size,blockedWork:o,arrivalCount:A,admittedCount:S,admittedWork:I,processedWork:z,completedWork:N,blockedCount:C,abandonedCount:T,abandonedWork:E,peakQueueDepth:W,peakRemainingWork:L,queueAge:{count:i.length,meanSeconds:i.length>0?a/i.length:0,p50Seconds:jr(i,.5),p95Seconds:jr(i,.95),oldestSeconds:i.at(-1)??0},meanCompletedQueueSeconds:v>0?F/v:0,window:X(),simulatedAt:k,metricRevision:j}},bodyForce:t=>{if("none"===o)return null;const n=p.get(t.body.id),a=y.get(t.body.id),s=n?u.get(n):void 0,c=a?d.get(a):void 0;if(!s&&!c)return null;const l=s?b.get(t.body.id):w.get(t.body.id);if(null==l)return null;let h;const f=t.regions;if(f)for(let t=0;f.length>t;t+=1)if(f[t].id===e){const e=f[t].shape;e&&"aabb"===e.type&&(h=e);break}return h?{x:((c?h.x-.44*h.width:h.x-.22*h.width-l*(.15*r))-t.body.x)*i,y:(h.y-(l-((c?d.size:M)-1)/2)*r/Math.max(1,Math.sqrt(c?d.size:M))-t.body.y)*i*.85}:{x:8*-Math.sign(t.body.vx||1),y:0}}}}function qr(t,e){if(!e)return;let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}function Dr(t,e){if(!e)return!0;if("function"==typeof e)return e(t);const n=qr(t,e.property);return!("equals"in e&&!Object.is(n,e.equals)||"notEquals"in e&&Object.is(n,e.notEquals)||e.oneOf&&!e.oneOf.some(t=>Object.is(n,t))||e.notOneOf&&e.notOneOf.some(t=>Object.is(n,t)))}function Br(t){const e=t.resources.map(t=>({...t,bodyId:t.bodyId??t.id})),n=new Map(e.map(t=>[t.bodyId,t])),o=new Map,r=new Map,i=t.assignmentForce??.45,a=t.returnForce??.35,s=t.caseAttraction??.08,c=t.assignmentOffset??{x:0,y:0};let l=new Map,u=0,d=0;return{id:t.id??"service-resource-pool",continuous:!0,assign:t=>{const n=o.get(t);if(n)return n;const i=e.find(t=>!r.has(t.id));if(!i)return null;const a={resourceId:i.id,resourceBodyId:i.bodyId,caseBodyId:t,assignedAt:u};return o.set(t,a),r.set(i.id,a),d+=1,a},release:t=>{const e=o.get(t);return!!e&&(o.delete(t),r.delete(e.resourceId),d+=1,!0)},getAssignment:t=>o.get(t),tick:t=>{u=Math.max(u,t.elapsed),l=new Map(t.controls.readBodies().map(t=>[t.id,t]));for(const[t,e]of o)l.has(t)&&l.has(e.resourceBodyId)||(o.delete(t),r.delete(e.resourceId),d+=1)},getSnapshot:()=>({total:e.length,available:e.length-r.size,assigned:r.size,assignments:Array.from(o.values()),simulatedAt:u,metricRevision:d}),bodyForce:t=>{const e=n.get(t.body.id);if(e){const n=r.get(e.id),o=n?l.get(n.caseBodyId):void 0,s=n?i:a;return{x:((o?o.x+(c.x??0):e.home.x)-t.body.x)*s,y:((o?o.y+(c.y??0):e.home.y)-t.body.y)*s}}const u=o.get(t.body.id);if(!u||0>=s)return null;const d=l.get(u.resourceBodyId);return d?{x:(d.x-t.body.x)*s,y:(d.y-t.body.y)*s}:null}}}function Yr(t,e){const n="function"==typeof e.deadlineAccessor?e.deadlineAccessor(t):qr(t.datum,e.deadlineAccessor)??qr(t,e.deadlineAccessor);return Number.isFinite(Number(n))?Math.max(0,Number(n)):0}function Vr(t){const e=new Map;let n=0,o=0;function r(n){e.set(n.bodyId,n),o+=1,t.onStateChange?.({...n})}function i(t){const o=e.get(t);return!(!o||null!=o.completedAt||(r({...o,completedAt:n,state:"unhappy"===o.state?"resolved-unhappy":"resolved"}),0))}return{id:t.id??"service-level",continuous:!0,protect:t=>{const o=e.get(t);return!(!o||null!=o.completedAt||"unhappy"===o.state||(r({...o,state:"protected",protectedAt:n}),0))},complete:i,getCase:t=>e.get(t),tick:o=>{n=Math.max(n,o.elapsed);for(const a of o.controls.readBodies()){if(!Dr(a,t.bodyFilter))continue;if(!e.has(a.id)){const e=Yr(a,t);r({bodyId:a.id,openedAt:n,deadlineAt:n+e,state:"waiting"})}const s=e.get(a.id);s&&null==s.completedAt&&(t.completionRegionId&&o.getRegionState(a.id)?.activeRegionIds.includes(t.completionRegionId)?i(a.id):"waiting"!==s.state||s.deadlineAt>n||r({...s,state:"unhappy"}))}},getSnapshot:()=>{const t=Array.from(e.values()),r=e=>t.filter(t=>t.state===e).length;return{total:t.length,waiting:r("waiting"),protected:r("protected"),unhappy:r("unhappy"),resolved:r("resolved"),resolvedUnhappy:r("resolved-unhappy"),simulatedAt:n,metricRevision:o}}}}function Hr(t){const e=new Set;let n=0,o=0,r=0,i=!1;return{id:t.id??"dependency-gate:"+t.regionId,continuous:!0,tick:a=>{n=Math.max(n,a.elapsed);const s=i;var c;c=n,i=t.isOpen?t.isOpen(c):null!=t.opensAt&&c>=t.opensAt;const l=a.controls.readBodies(),u=new Map(l.map(t=>[t.id,t]));for(const n of l){const o=a.getRegionState(n.id)?.activeRegionIds.includes(t.regionId);o&&Dr(n,t.bodyFilter)&&(i||e.has(n.id)||(e.add(n.id),r+=1,t.onHeld?.(n)))}if(i&&!s){for(const n of e){const e=u.get(n);e&&(a.controls.applyImpulse(n,t.releaseImpulse?.x??86,t.releaseImpulse?.y??0),o+=1,t.onReleased?.(e))}e.clear(),r+=1}for(const t of e)u.has(t)||(e.delete(t),r+=1)},getSnapshot:()=>({regionId:t.regionId,isOpen:i,blocked:e.size,released:o,simulatedAt:n,metricRevision:r}),bodyForce:n=>{if(i||!e.has(n.body.id))return null;const o=n.regions?.find(e=>e.id===t.regionId),r=o?.shape;if(!r||"aabb"!==r.type)return{x:.8*-n.body.vx,y:.8*-n.body.vy};const a=t.holdForce??.4;return{x:(r.x-n.body.x)*a-.45*n.body.vx,y:(r.y-n.body.y)*a-.45*n.body.vy}}}}function Xr(t,e){return t||e?{x:(t?.x??0)+(e?.x??0),y:(t?.y??0)+(e?.y??0)}:null}function _r(t){if(!t?.length)return null;const e=t.slice(),n=e.some(t=>!1!==t.continuous);return{controllers:e,continuous:n,onTick:(t,n,o)=>{const r={result:t,controls:n,dt:o.dt,elapsed:o.elapsed,getRegionState:o.getRegionState};for(const t of e)t.tick(r)},bodyForce:t=>{let n=null;for(const o of e)o.bodyForce&&(n=Xr(n,o.bodyForce(t)));return n}}}function Gr(t){const e=new Set,n=t.impulse??{x:-60,y:0};return{id:t.id??"portal:"+t.fromRegionId,continuous:!0===t.continuous,tick:o=>{const r=o.controls.readBodies();for(const i of r){const r=o.getRegionState(i.id),a=r?.activeRegionIds.includes(t.fromRegionId);a?e.has(i.id)||(e.add(i.id),o.controls.applyImpulse(i.id,n.x??0,n.y??0),t.onPortal?.(i)):e.delete(i.id)}}}}import{Fragment as Ur,jsx as Kr,jsxs as Qr}from"react/jsx-runtime";var Zr={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function Jr(t,e,n){return Math.max(e,Math.min(n,t))}function ti(t){return 6.2*t.length}function ei(t,e){const n=t.trim();if(e>=n.length)return n;if(1>=e)return n.slice(0,1);const o=n.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return o.length>1&&e>=o.length?o:e>3?n.slice(0,Math.max(1,e-2))+"..":n.slice(0,e).toUpperCase()}function ni(t,e,n="auto"){const o=Math.max(1,Math.floor(e/6.2)),r="compact"===n?ei(t,o):"full"===n?t:ti(t)>e?ei(t,o):t;return{text:r,textLength:ti(r)>e?Math.max(4,e):void 0}}function oi(t,e={}){const{showFlowSpine:n=!0,showStageCounts:o=!0,showCapacityBadges:r=!0,showGroupSockets:i=!0,stageLabelMode:a="auto",outlineStages:s=!1,testId:c="process-flow-chrome"}=e,{width:l,height:u,left:d,right:h,topY:f,bottomY:m,midY:p,stages:y,groups:g=[]}=t,x=m-f;return Qr("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":s?"true":void 0,width:l,height:u,viewBox:`0 0 ${l} ${u}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",s?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[Kr("defs",{children:Qr("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[Kr("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),Kr("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),Kr("rect",{x:0,y:0,width:l,height:u,fill:"url(#semiotic-process-floor)"}),Kr("rect",{x:d-6,y:f-8,width:h-d+12,height:x+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),n?Kr("line",{x1:d+8,x2:h-8,y1:p,y2:p,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,y.map((t,e)=>{const n=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),i=Zr[n],c=Math.max(12,t.width-8),l=Jr(c-8,22,88),d=ni(t.label,Math.max(8,l-10),a),h="none"!==a&&c-8>=22,g=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),b=ni(g,Math.max(16,c-10),"auto"),w=r&&!1!==t.showBadge&&c>=32,M=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",v=ni(M,Math.max(16,c-8),"auto"),k=Math.max(30,f-15),$=k-13;return Qr("g",{"data-stage":t.id,"data-role":n,children:[Kr("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:x-12,rx:10,fill:s?"none":i.fill,stroke:i.stroke,strokeWidth:s?1.85:"flow"===n?1:1.6}),y.length-1>e?Kr("polygon",{points:`${t.x1-2},${p-7} ${t.x1+8},${p} ${t.x1-2},${p+7}`,fill:i.accent,opacity:.85}):null,h?Qr(Ur,{children:[Kr("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-l/2,y:$,width:l,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:i.stroke}),Qr("text",{x:t.x,y:k,textAnchor:"middle",fill:i.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[Kr("title",{children:t.label}),d.text]})]}):null,w?Qr("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[Kr("title",{children:g}),b.text]}):null,o&&null!=t.count?Qr("text",{x:t.x,y:Math.min(u-8,m+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:v.textLength,lengthAdjust:v.textLength?"spacingAndGlyphs":void 0,children:[Kr("title",{children:M}),v.text]}):null]},t.id)}),i?g.map((t,e)=>{const n=t.total??0,o=t.absorbed??0,r=t.complete??(n>0&&o>=n),i=!r&&n>0&&o/n>=.75,a=r?"rgba(52, 211, 153, 0.35)":i?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",s=r?"#34d399":i?"#fbbf24":"var(--semiotic-border, #64748b)",c=n>0?`${o}/${n}${r?" shipped":i?" almost":""}`:"feature "+(e+1),l=Jr(Math.max(54,ti(t.label)+18,ti(c)+16),54,104),u=ni(t.label,l-12,"auto"),d=ni(c,l-12,"auto");return Qr("g",{"data-group":t.id,children:[Kr("rect",{x:t.x-l/2,y:t.y-22,width:l,height:44,rx:10,fill:a,stroke:s,strokeWidth:1.5}),Qr("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[Kr("title",{children:t.label}),u.text]}),Qr("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:s,fontSize:9,fontWeight:700,textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[Kr("title",{children:c}),d.text]})]},t.id)}):null]})}function ri(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function ii(t,e,n,o){const r="function"==typeof t?t(e,n):t;return Number.isFinite(r)?Number(r):o}function ai(t,e,n){return ri(t[e])??n}function si(t,e){return"number"==typeof t?t:t?.[e]??0}function ci(t){const{band:e,idPrefix:n,plot:o,projection:r}=t,{includeBoundaryWalls:i=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=e,c=function(t){const e=t.bandwidth??t.scale.bandwidth?.()??0,n=new Set;for(const o of t.values){const r=t.scale(o);Number.isFinite(r)&&(n.add(Number(r)),n.add(Number(r)+e))}return Array.from(n).sort((t,e)=>t-e)}(e);if(2>c.length)return[];const l=i?c.length-1:c.length-2,u=[];for(let t=i?0:1;l>=t;t+=1){if(!a&&t>0&&c.length-1>t)continue;const e=c[t];u.push({id:`${n}-wall-${t}`,shape:"x"===r?{type:"aabb",x:e,y:o.y+o.height/2,width:s,height:o.height}:{type:"aabb",x:o.x+o.width/2,y:e,width:o.width,height:s}})}return u}function li(t){const{plot:e,idPrefix:n="physics-scale",bounds:o={},xBins:r,xBands:i,yBands:a}=t,s=[];if(!1!==o&&s.push(...function(t,e={}){const{idPrefix:n="plot",includeFloor:o=!0,includeCeiling:r=!1,includeLeftWall:i=!0,includeRightWall:a=!0,wallThickness:s=20,floorThickness:c=s}=e,l=[],u=t.x+t.width/2,d=t.y+t.height/2;return o&&l.push({id:n+"-floor",shape:{type:"aabb",x:u,y:t.y+t.height+c/2,width:t.width+2*s,height:c}}),r&&l.push({id:n+"-ceiling",shape:{type:"aabb",x:u,y:t.y-c/2,width:t.width+2*s,height:c}}),i&&l.push({id:n+"-left-wall",shape:{type:"aabb",x:t.x-s/2,y:d,width:s,height:t.height+2*c}}),a&&l.push({id:n+"-right-wall",shape:{type:"aabb",x:t.x+t.width+s/2,y:d,width:s,height:t.height+2*c}}),l}(e,{idPrefix:n,...o})),r){const{idPrefix:t,yTop:o,yBottom:i,...a}=r;s.push(...function(t){const{idPrefix:e="bin",count:n,domainStart:o,domainStep:r,xScale:i,yTop:a,yBottom:s,wallThickness:c=4,includeBoundaryWalls:l=!0,includeInteriorWalls:u=!0,closedBefore:d,lidY:h=a,lidThickness:f=Math.max(2,c)}=t,m=[],p=a+(s-a)/2,y=Math.abs(s-a),g=l?n:n-1;if(u||l)for(let t=l?0:1;g>=t;t+=1){if(!u&&t>0&&n>t)continue;const a=i(o+t*r);m.push({id:`${e}-wall-${t}`,shape:{type:"aabb",x:a,y:p,width:c,height:y}})}if(null!=d)for(let t=0;n>t;t+=1){const n=o+t*r,a=n+r;if(a>=d)continue;const s=i(n),l=i(a);m.push({id:`${e}-lid-${t}`,shape:{type:"segment",x1:Math.min(s,l)+c/2,y1:h,x2:Math.max(s,l)-c/2,y2:h,thickness:f}})}return m}({...a,idPrefix:t??n+"-xbin",yTop:o??e.y,yBottom:i??e.y+e.height}))}return i&&s.push(...ci({band:i,idPrefix:i.idPrefix??n+"-xband",plot:e,projection:"x"})),a&&s.push(...ci({band:a,idPrefix:a.idPrefix??n+"-yband",plot:e,projection:"y"})),s}function ui(t){const{plot:e,rows:n,columns:o=n+1,pegRadius:r=3,idPrefix:i="galton-peg",yStart:a=e.y+.18*e.height,yEnd:s=e.y+.58*e.height,stagger:c=!0,restitution:l=.2,friction:u=.04}=t,d=Math.max(0,Math.floor(n)),h=Math.max(1,Math.floor(o));if(0===d)return[];const f=d>1?(s-a)/(d-1):0,m=e.width/h,p=[];for(let t=0;d>t;t+=1){const n=c&&t%2==1?m/2:0;for(let o=0;h>o;o+=1){const s=e.x+m*(o+.5)+n;e.x+r>s||s>e.x+e.width-r||p.push({id:`${i}-${t}-${o}`,shape:{type:"aabb",x:s,y:a+t*f,width:2*r,height:2*r},restitution:l,friction:u})}}return p}function di(t,e={}){const{idPrefix:n="physics-token",radius:o=5,shape:r,mass:i,vx:a,vy:s,spawnAt:c,seed:l=1,jitter:u,datum:d}=e,h=T(l),f=si(u,"x"),m=si(u,"y");return t.map((t,l)=>{const u=ii(e.x,t,l,ai(t,"x",0)),p=ii(e.y,t,l,ai(t,"y",0)),y=ii(o,t,l,5),g="function"==typeof r?r(t,l):r??{type:"circle",radius:y};return{id:`${n}-${t.index??l}`,x:u+(h()-.5)*f,y:p+(h()-.5)*m,vx:ii(a,t,l,0),vy:ii(s,t,l,0),mass:ii(i,t,l,1),spawnAt:ii(c,t,l,void 0),shape:g,datum:d?d(t,l):t.datum??t}}).map(t=>{if(Number.isFinite(t.spawnAt))return t;const{spawnAt:e,...n}=t;return n})}function hi(t,e={}){const{idPrefix:n="sediment",collider:o=!0,colliderThickness:r=1,restitution:i=.05,friction:a=.2,...s}=e,c=function(t,e={}){const{baselineY:n=0,binWidth:o=24,gap:r=2,maxHeight:i=80,value:a="count",x:s}=e,c=Math.max(1,...t.map(t=>t[a]));return t.map((t,e)=>{const l=Math.max(0,t[a]/c*i),u=s?.(t,e)??e*(o+r);return{binId:t.id,label:t.label,index:e,count:t.count,total:t.total,x:u,y:n-l,width:o,height:l,meanX:t.x.mean,meanY:t.y.mean}})}(t,s),l=o?c.filter(t=>t.height>0).map(t=>({id:`${n}-${t.binId}`,shape:{type:"aabb",x:t.x+t.width/2,y:t.y+r/2,width:t.width,height:r},restitution:i,friction:a})):[];return{columns:c,colliders:l}}function fi(t,e={}){const{timeAccessor:n="arrivalTime",timeScale:o=1,startAt:r=0,rebase:i=!0,sort:a=!0}=e,s=t.map((t,e)=>({spawn:t,time:function(t,e,n){return ri("function"==typeof n?n(t,e):t[n]??t.datum?.[n])}(t,e,n)??t.spawnAt??e})),c=s.length?Math.min(...s.map(t=>t.time)):0;return{initialSpawns:s.map(({spawn:t,time:e})=>({...t,spawnAt:r+(i?e-c:e)})).sort((t,e)=>a?(t.spawnAt??0)-(e.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:o}}}function mi(t,e,n="group"){const o=Fo(t,e),r=t=>"function"==typeof n?n(t):t[n]??0;return t.slice().sort((t,e)=>{const n=r(t),i=r(e);return i>n?-1:n>i?1:(o[e.id]||0)-(o[t.id]||0)}).map(t=>t.id)}function pi(t,e={}){const n=e.baseline??.62,o=e.inset??.06,r={},i=t.length;return t.forEach((t,e)=>{r[t]={x:i>1?o+e/(i-1)*(1-2*o):.5,y:n}}),r}function yi(t,e,n=.55){return`M${t.x},${t.y} Q${(t.x+e.x)/2},${t.y-Math.abs(e.x-t.x)*n} ${e.x},${e.y}`}function gi(t,e={}){const n=e.radius??.42,o=e.center?.x??.5,r=e.center?.y??.5,i=e.startAngle??0,a={},s=t.length;return t.forEach((t,e)=>{const c=i+e/s*Math.PI*2-Math.PI/2;a[t]={x:o+Math.cos(c)*n,y:r+Math.sin(c)*n}}),a}function xi(t,e,n={}){const o=(n.order??mi(t,e,n.groupAccessor??"group")).slice(),r=new Map(o.map((t,e)=>[t,e])),i=new Map;for(const t of e){if(!r.has(t.source)||!r.has(t.target)||t.source===t.target)continue;const e=t.target>t.source?`${t.source}\0${t.target}`:`${t.target}\0${t.source}`;i.set(e,(i.get(e)||0)+(t.value??1))}const a=[];let s=0;for(const[t,e]of i){const[n,o]=t.split("\0"),i=r.get(n),c=r.get(o);e>s&&(s=e),a.push({row:i,col:c,source:n,target:o,value:e}),a.push({row:c,col:i,source:o,target:n,value:e})}return{order:o,cells:a,size:o.length,maxValue:s}}function bi(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function wi(t){if("string"!=typeof t)return;const e=t.trim();return e.length?e:void 0}function Mi(t,e){const n=bi(t.note)?t.note:void 0;return e?wi(t.mobileText)||wi(t.shortText)||wi(t.label)||wi(n?.mobileText)||wi(n?.shortText)||wi(n?.label)||wi(n?.title):wi(t.label)||wi(t.mobileText)||wi(t.shortText)||wi(n?.label)||wi(n?.title)}function vi(t,e,n){const o=function(t,e,n){if(!n)return;const o="function"==typeof n?n(t,e):t[n];return"number"==typeof o&&Number.isFinite(o)?o:void 0}(t,e,n.priorityAccessor);if(void 0!==o)return o;let r=1e3-e;const i=((t.emphasis??"")+"").toLowerCase();"primary"!==i&&"critical"!==i||(r+=1e4),"secondary"===i&&(r-=1e3),"high"===t.priority&&(r+=5e3),"low"===t.priority&&(r-=1500),"number"==typeof t.priority&&(r+=100*t.priority);const a=bi(t.provenance)?t.provenance:void 0;"number"==typeof a?.confidence&&(r+=100*a.confidence);const s=bi(t.lifecycle)?t.lifecycle:void 0,c=((s?.freshness??"")+"").toLowerCase();return"expired"!==c&&"stale"!==c||(r-=3e3),r}function ki(t,e){if(!e)return t;const n=Mi(t,!0);return n&&"string"==typeof t.label?{...t,label:n}:t}function $i(t,e={}){const n=Array.isArray(t)?t.filter(bi):[],o=e.active??(null==e.width||(e.breakpoint??480)>=e.width),r=e.strategy??"hybrid",i=!1!==e.preferShortText,a=!1!==e.preservePrimary,s=Math.max(0,e.maxPlotAnnotations??e.maxAnnotations??("callout-list"===r?1:2)),c=Math.max(0,e.minPlotAnnotations??e.minVisible??1);if(!o||"plot"===r)return{active:o,strategy:r,budget:n.length,visible:i?n.map(t=>ki(t,i)):n,deferred:[],calloutList:[],hidden:[]};const l=[],u=n.map((t,n)=>({annotation:t,index:n,priority:vi(t,n,e)})).filter(t=>!!en(t.annotation)||(l.push(t.annotation),!1)).sort((t,e)=>e.priority-t.priority),d=a?u.filter(t=>"primary"===((t.annotation.emphasis??"")+"").toLowerCase()):[],h=new Set(d.map(t=>t.index)),f=u.filter(t=>!h.has(t.index)),m=[...d,...f].slice(0,Math.max(s,c)),p=new Set(m.map(t=>t.index)),y=u.filter(t=>!p.has(t.index)),g=[...l,...m.sort((t,e)=>t.index-e.index).map(t=>ki(t.annotation,i))],x=y.sort((t,e)=>t.index-e.index).map(t=>t.annotation),b=Math.max(0,e.maxCalloutItems??6),w=y.filter(t=>!e.calloutFilter||e.calloutFilter(t.annotation,t.index)).map(t=>function(t,e,n,o){const r=Mi(t,o);if(!r)return null;const i=wi(t.id)||wi(t.key)||wi(t.pointId)||"annotation-"+(e+1),a=bi(t.provenance)?wi(t.provenance.source)||wi(t.provenance.authorKind):void 0;return{id:i,label:r,shortLabel:wi(t.shortText),pointId:t.pointId,emphasis:"string"==typeof t.emphasis?t.emphasis:void 0,source:a,priority:n,annotation:t}}(t.annotation,t.index,t.priority,i)).filter(t=>!!t).slice(0,b),M=new Set(w.map(t=>t.annotation)),v=x.filter(t=>!M.has(t));return{active:o,strategy:r,budget:s,visible:g,deferred:x,calloutList:w,hidden:v}}function Ai(t){return"dense"===t.density?.75:"compact"===t.density?.9:1}function Si(t,e){const n=!1!==e.keepAxes,o=!1===e.directLabel?12:28;return"ordinal"===t?{top:12,right:o,bottom:n?44:12,left:n?48:12}:"geo"===t||"network"===t?{top:12,right:12,bottom:12,left:12}:{top:12,right:o,bottom:n?42:14,left:n?44:14}}function Ii(t,e,n,o={}){const r={...n},i={mode:!1===e.mode?void 0:"mobile",...r,margin:Si(t,e),...o},a=Object.fromEntries(Object.entries(r).filter(([,t])=>void 0!==t)),s=Object.fromEntries(Object.entries(i).filter(([,t])=>void 0!==t)),c=function(t,e){const n=e.targetSize??44,o=[],r=e.standardControls,i=t=>!0===r||"all"===r||r===t||Array.isArray(r)&&r.includes(t);return i("brush")&&o.push("range-inputs","clear-brush"),i("zoom")&&o.push("zoom-buttons","reset-view"),i("legend")&&o.push("legend-chips","show-all-series"),{strategy:`${t}-${e.transformProfile??"overview"}-mobile-recipe`,supportsResponsiveLayout:!0,breakpoints:[320,360,390,430,e.breakpoint??480,768],maxAnnotations:e.maxAnnotations??2,minimumHitTarget:n,summary:e.summary??!0,interaction:{primary:"tap",hoverFallback:"tap-to-lock",targetSize:n,...o.length>0&&{alternatives:o}},labels:{strategy:!1===e.directLabel?"compact":"direct",minFontSize:12}}}(t,e),l=function(t){return{tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:t.targetSize??44,snap:t.snap??"nearestDatum",brushHandleSize:t.targetSize??44,standardControls:t.standardControls??!1}}(e);return{family:t,props:a,responsiveRules:[{id:t+"-mobile",description:`Apply Semiotic's mobile ${t} recipe at phone width.`,when:{maxWidth:e.breakpoint??480},transform:{...s,mobileInteraction:l,mobileSemantics:c}}],mobileInteraction:l,mobileSemantics:c}}function zi(t={}){const e=Ai(t);return Ii("line",t,{showLegend:t.showLegend??!1,directLabel:t.directLabel??!0,lineWidth:"inspect"===t.transformProfile?3:Math.max(1.5,2.5*e),showPoints:"inspect"===t.transformProfile,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Ni(t={}){const e=Ai(t);return Ii("area",t,{showLegend:t.showLegend??!1,showPoints:!1,areaOpacity:"compare"===t.transformProfile?.55:.42,lineWidth:Math.max(1.25,2*e),autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Ci(t={}){return Ii("ordinal",t,{showLegend:t.showLegend??!1,showCategoryTicks:t.keepAxes??!0,sort:"compare"===t.transformProfile?"desc":void 0},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Ti(t={}){const e=Ai(t);return Ii("scatter",t,{showLegend:t.showLegend??!1,pointRadius:Math.max(4,Math.round((t.targetSize??44)/8*e)),hoverRadius:Math.ceil((t.targetSize??44)/2),pointOpacity:"dense"===t.density?.42:.68,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??1,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Ei(t={}){const e=Ai(t);return Ii("network",t,{showLegend:t.showLegend??!1,nodeSizeRange:[Math.max(4,Math.round(6*e)),Math.max(12,Math.round((t.targetSize??44)/2*e))],showLabels:"inspect"===t.transformProfile,edgeOpacity:"dense"===t.density?.28:.44})}function Wi(t={}){return Ii("geo",t,{showLegend:t.showLegend??!1})}function Li(t={}){return Ii("small-multiple",t,{mobileColumns:t.mobileColumns??1,tabletColumns:t.tabletColumns??2,chartHeight:t.chartHeight??180,sharedExtent:!0})}function Fi(t,e={}){switch(t){case"line":return zi(e);case"area":return Ni(e);case"ordinal":return Ci(e);case"scatter":return Ti(e);case"network":return Ei(e);case"geo":return Wi(e);case"small-multiple":return Li(e)}}function ji(t={}){const e=t.controls??["range-inputs","chip-filter","clear"];return{mobileInteraction:{enabled:!0,targetSize:t.targetSize??44,tapToSelect:!0,tapToLockTooltip:!0,standardControls:"brush"},mobileSemantics:{interaction:{primary:"filter",alternatives:e,summary:t.summary??"Expose brushable ranges through touch-sized controls in addition to drag gestures."}},controls:e}}import*as Ri from"react";import{Fragment as Oi,jsx as Pi,jsxs as qi}from"react/jsx-runtime";function Di({def:t,color:e,accent:n,paintOverride:o}){return Pi(Oi,{children:t.parts.map((t,r)=>{const i=o?"none"===t.fill?void 0:o:xo(t.fill,e,n),a=o?t.stroke&&"none"!==t.stroke?o:void 0:xo(t.stroke??"none",e,n);return i||a?Pi("path",{d:t.d,fill:i??"none",stroke:a,strokeWidth:a?t.strokeWidth??1:void 0,strokeLinecap:t.strokeLinecap,strokeLinejoin:t.strokeLinejoin,opacity:t.opacity},r):null})})}function Bi({def:t,size:e=24,color:n="currentColor",accent:o="#ffffff",fraction:r=1,fractionStart:i=0,fractionDirection:a="horizontal",ghostColor:s,x:c=0,y:l=0,opacity:u,className:d}){const h=Ri.useId();if(!t?.parts?.length)return null;const[,f]=t.viewBox??mo,m=e/(f>0?f:1);if(0>=m)return null;const p=bo(t,r,i,a),y=p?"glyph-clip"+h.replace(/[^A-Za-z0-9_-]/g,"_"):void 0;return qi("g",{className:d,transform:`translate(${c} ${l}) scale(${m})`,opacity:u,"aria-hidden":"true",children:[p&&y&&Pi("clipPath",{id:y,children:Pi("rect",{x:p.x,y:p.y,width:p.width,height:p.height})}),p&&s?Pi(Di,{def:t,color:n,accent:o,paintOverride:s}):null,p&&y?Pi("g",{clipPath:`url(#${y})`,children:Pi(Di,{def:t,color:n,accent:o})}):Pi(Di,{def:t,color:n,accent:o})]})}export{nn as DEFAULT_AREA_PER_ANNOTATION,po as DEFAULT_GLYPH_ANCHOR,mo as DEFAULT_GLYPH_VIEWBOX,Bn as DEFAULT_HIT_RADIUS,Rt as DEFAULT_ISOMETRIC_SPRITE_SIZES,Bi as Glyph,l as LayoutCache,J as SYMBOL_SEQUENCE,eo as TAU,hr as absorbRegion,Sn as activeCountOverDomain,co as addPoints,xi as adjacencyMatrix,Uo as aggregateRegionCounts,b as allocateCells,ro as angleScale,rn as annotationBudget,sn as annotationDensity,vn as annotationLayout,pi as arcLayout,yi as arcPath,fi as arrivalReplay,qn as axisFixedForceLayout,Pn as axisFixedForcePositions,ge as bandLabel,Po as betweenness,jo as bfsDistances,Ue as bobaLayout,mr as bodyGroupSpec,ye as boundsOf,Tn as boxEdgeAnchors,Lo as buildAdjacency,No as buildTooltipEntries,We as bulletLayout,It as calendarLayout,ur as capacitatedRegion,sr as chargeGateRegion,gi as circularLayout,m as clamp,qo as closeness,Do as clustering,li as collidersFromScales,Nr as comparePhysicsTrace,_r as composePhysicsControllers,Pr as createCapacityQueueController,Hr as createDependencyGateController,Gr as createPortalController,Tr as createProcessJourneyLedger,Vr as createServiceLevelController,Br as createServiceResourcePoolController,Fn as cubicPath,Wn as cubicPoint,Ln as cubicTangent,Nn as curvedEdgePath,Jn as cyclicRangeContains,te as dagreLayout,Fo as degree,q as diagnoseTokenEncoding,s as dimFor,Oo as egoNetwork,zo as extractTooltipDatum,En as fanOutBend,Jt as flextreeLayout,fr as forceFieldRegion,E as forceLayout,Go as forceLayoutAsync,Co as formatTooltipValue,ui as galtonPegs,O as generateTokens,Xn as geoAreaHitTarget,Hn as geoHitTarget,go as glyphExtent,bo as glyphFractionClipRect,yo as glyphPlacement,r as groupBy,Qo as groupCompletionRows,xe as hatchFill,Vn as hitTargetPoint,_n as hitTargetRect,zn as intervalLanesLayout,_t as isometricLandmarkLayout,lt as isotypeBoltGlyph,ut as isotypeBusGlyph,ct as isotypeChipGlyph,at as isotypeGhost,rt as isotypeInk,ft as isotypeNetworkGlyphs,it as isotypePaper,ht as isotypePersonGlyph,dt as isotypePersonPath,st as isotypeServerGlyph,P as layoutTokenGrid,$o as legendGroupsFrom,Ao as legendSwatches,ae as lineageDagLayout,be as linearAxis,u as makeShade,Ce as marimekkoLayout,we as markCallout,a as matchesHighlight,y as mean,ar as membraneRegion,he as mermaidDagLayout,$i as mobileAnnotationStrategy,Ni as mobileAreaChartRecipe,ji as mobileBrushAlternatives,Fi as mobileChartFamilyRecipe,Wi as mobileGeoChartRecipe,zi as mobileLineChartRecipe,Ei as mobileNetworkChartRecipe,Ci as mobileOrdinalChartRecipe,Ti as mobileScatterplotRecipe,Li as mobileSmallMultipleRecipe,T as mulberry32,Gn as networkHitTarget,p as nonNegativeFinite,fo as normalizePoint,Bo as normalizeScores,F as normalizeTokenEncoding,mi as orderByGroupDegree,Cn as orthogonalEdgePath,An as packIntervals,Se as packedClusterMatrix,je as parallelCoordinatesLayout,$r as physicsReferenceEnvelope,ho as pointMagnitude,no as polarToXY,dr as portalRegion,lr as pressureFieldRegion,oi as processChrome,Wr as processJourneyRows,pr as processLaneWalls,or as processStageLayout,ir as processStageRegions,tr as processVolumePolygons,Yo as proximityProblem,io as radiusScale,n as readField,jn as rectCollide,Ko as regionCountsToProjectionRows,ao as ringArcPath,pe as roundedEnclosure,cr as routeSurfaceRegion,Kn as runLengthEncode,Un as runs,uo as scalePoint,hi as sedimentBake,to as selectCyclicRange,Xt as selectIsometricLandmarks,d as shade,Zn as shortestArcDelta,Ro as shortestPath,c as signatureKey,di as spawnFromTokens,Jo as stageTargetInVolume,lo as subtractPoints,Y as suggestTokenEncoding,ot as symbolExtent,tt as symbolPathString,et as symbolRadius,$t as tokenLayer,B as tokenTaskIntentToCapabilityIntents,v as unitize,k as unitizeRange,o as unwrapDatum,Er as updateProcessJourney,Lt as useCustomLayoutSelection,x as waffleLayout,g as withAlpha,Qn as wrapValue,oo as xyToAngle};
@@ -0,0 +1,4 @@
1
+ /** Optional Rough.js rendering adapter. Import from `semiotic/rough`. */
2
+ export { createRoughRenderMode, stableRoughSeed } from "./components/rough/createRoughRenderMode";
3
+ export type { RoughRenderMode, RoughRenderModeOptions } from "./components/rough/createRoughRenderMode";
4
+ export type { SceneRenderBackend, SceneRenderMode } from "./components/stream/types";
@@ -0,0 +1,8 @@
1
+ export { renderToStaticSVG, renderXYToStaticSVG, renderOrdinalToStaticSVG, renderNetworkToStaticSVG, renderGeoToStaticSVG, renderChart, renderChartWithEvidence, renderDashboard, } from "./components/server/renderToStaticSVG";
2
+ export { generateFrameSVGs, generatePhysicsFrameSVGs, generateFrameSequence } from "./components/server/animatedGif";
3
+ export type { RenderEvidence } from "./components/server/renderEvidence";
4
+ export type { DashboardChart, DashboardLayout, RenderDashboardOptions, } from "./components/server/renderToStaticSVG";
5
+ export type { LegendLayout } from "./components/types/legendTypes";
6
+ export type { AnimatedGifOptions, PhysicsGifFrameProps, PhysicsGifOptions, } from "./components/server/animatedGif";
7
+ export { resolveTheme, themeStyles } from "./components/server/themeResolver";
8
+ export type { ThemeInput } from "./components/server/themeResolver";