semiotic 3.10.0 → 3.10.2

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 (403) hide show
  1. package/README.md +73 -72
  2. package/ai/artifact-surface-inventory.json +4 -1
  3. package/ai/componentMetadata.cjs +3 -1
  4. package/ai/dist/mcp-server.js +47 -46
  5. package/ai/examples.md +95 -0
  6. package/ai/reference.md +80 -1
  7. package/ai/schema.json +7304 -1990
  8. package/ai/surface-manifest.json +26 -4
  9. package/ai/task-packets/compare-category-totals.json +7 -53
  10. package/ai/task-packets/compare-category-totals.md +4 -4
  11. package/ai/task-packets/correct-published-chart.json +7 -53
  12. package/ai/task-packets/correct-published-chart.md +4 -4
  13. package/ai/task-packets/index.json +9 -9
  14. package/ai/task-packets/update-live-chart.json +8 -54
  15. package/ai/task-packets/update-live-chart.md +4 -4
  16. package/dist/c-27DCB5T6.min.js +18 -0
  17. package/dist/c-2MONF2P6.min.js +1 -0
  18. package/dist/c-2TW5H5PD.min.js +1 -0
  19. package/dist/c-3AGX252H.min.js +1 -0
  20. package/dist/c-3B6JZEZT.min.js +1 -0
  21. package/dist/c-3BYZXCX3.min.js +4 -0
  22. package/dist/c-3DIPZJDO.min.js +1 -0
  23. package/dist/c-3FOUMWLR.min.js +1 -0
  24. package/dist/c-3NA6I656.min.js +2 -0
  25. package/dist/c-3OFVBWQY.min.js +1 -0
  26. package/dist/{c-QA3HMQJP.min.js → c-3PFVJFBK.min.js} +1 -1
  27. package/dist/c-3PPO7ZJF.min.js +4 -0
  28. package/dist/c-3YEW2PK6.min.js +1 -0
  29. package/dist/c-4JKDJUYD.min.js +1 -0
  30. package/dist/c-4LKK5YWB.min.js +1 -0
  31. package/dist/c-4MD53L2J.min.js +33 -0
  32. package/dist/c-4V3CD337.min.js +1 -0
  33. package/dist/c-4XLHPQTP.min.js +1 -0
  34. package/dist/c-5NYONM6V.min.js +5 -0
  35. package/dist/c-6IVBV5NO.min.js +1 -0
  36. package/dist/c-6ZU3QVLB.min.js +100 -0
  37. package/dist/c-72CBVNYX.min.js +209 -0
  38. package/dist/c-7APWCEPL.min.js +1 -0
  39. package/dist/c-7ASK4WBF.min.js +1 -0
  40. package/dist/{c-ORLEBW72.min.js → c-7FKPPCGN.min.js} +1 -1
  41. package/dist/c-7LY46QUI.min.js +41 -0
  42. package/dist/c-ABMGCCLT.min.js +1 -0
  43. package/dist/c-AINGQGUN.min.js +1 -0
  44. package/dist/c-AKLBQMQF.min.js +391 -0
  45. package/dist/c-AXJ2QI3F.min.js +1 -0
  46. package/dist/c-BQYD7T4E.min.js +1 -0
  47. package/dist/{c-V4XMSLC3.min.js → c-BYJJ7EMG.min.js} +1 -1
  48. package/dist/{c-JO2UGTCP.min.js → c-C4KIXUWU.min.js} +1 -1
  49. package/dist/c-C4SXYFXL.min.js +1 -0
  50. package/dist/c-CLDCKFBE.min.js +1 -0
  51. package/dist/c-CLJCJSFU.min.js +1 -0
  52. package/dist/c-CLLCX3PT.min.js +2 -0
  53. package/dist/c-ECHBKW7U.min.js +1 -0
  54. package/dist/c-EPJWM2UT.min.js +1 -0
  55. package/dist/c-F2GGJB2S.min.js +31 -0
  56. package/dist/c-FD2BXSRG.min.js +1 -0
  57. package/dist/c-FDUQDCBC.min.js +51 -0
  58. package/dist/c-FOTTQHOO.min.js +1 -0
  59. package/dist/c-FU7A5KSY.min.js +1 -0
  60. package/dist/c-G53AVC42.min.js +113 -0
  61. package/dist/c-GHN6IR4Y.min.js +1 -0
  62. package/dist/c-GSCO3FWL.min.js +1 -0
  63. package/dist/c-GYLOSK7M.min.js +1 -0
  64. package/dist/c-HK4OSLZA.min.js +1 -0
  65. package/dist/c-HLGTD5SJ.min.js +1 -0
  66. package/dist/c-HQ27AHMC.min.js +1 -0
  67. package/dist/{c-D6HAAPTX.min.js → c-IBRLFKWA.min.js} +1 -1
  68. package/dist/c-IHWZ2C6D.min.js +26 -0
  69. package/dist/c-IIV73MUW.min.js +1 -0
  70. package/dist/c-IPYGNVN6.min.js +116 -0
  71. package/dist/c-JJKRER47.min.js +1 -0
  72. package/dist/c-JO6AYCU4.min.js +1 -0
  73. package/dist/c-JWHPG6S2.min.js +1 -0
  74. package/dist/c-JXVYIXTV.min.js +1 -0
  75. package/dist/c-K2ZIYDI3.min.js +1 -0
  76. package/dist/c-K37JAIWA.min.js +4 -0
  77. package/dist/c-KGROWFT2.min.js +9 -0
  78. package/dist/c-MOP2NGLH.min.js +1 -0
  79. package/dist/c-MTX2AO5S.min.js +1 -0
  80. package/dist/c-N5WT7TXG.min.js +1 -0
  81. package/dist/c-NATWERHZ.min.js +1 -0
  82. package/dist/{c-42PLDTX7.min.js → c-O53GOO7H.min.js} +1 -1
  83. package/dist/c-OVQB75PE.min.js +1 -0
  84. package/dist/c-P3SKRNZN.min.js +1 -0
  85. package/dist/c-P5NXQWIM.min.js +1 -0
  86. package/dist/c-P7BQMVQQ.min.js +1 -0
  87. package/dist/{c-GNTXRXRN.min.js → c-PDQHLOKU.min.js} +1 -1
  88. package/dist/c-PKY4JFY5.min.js +1 -0
  89. package/dist/c-PQOZPM4G.min.js +1 -0
  90. package/dist/c-PZ3NEGNG.min.js +1 -0
  91. package/dist/c-QXLDCATV.min.js +1 -0
  92. package/dist/c-R2HUSWKB.min.js +1 -0
  93. package/dist/{c-HYW2XA4Q.min.js → c-RHDOOQ4X.min.js} +1 -1
  94. package/dist/c-RZPP5ERV.min.js +1 -0
  95. package/dist/c-SG2Y7EBY.min.js +46 -0
  96. package/dist/{c-WUWXGQYA.min.js → c-SJIB5RNI.min.js} +1 -1
  97. package/dist/c-SQNEVNWT.min.js +1 -0
  98. package/dist/c-STHZWF3D.min.js +1 -0
  99. package/dist/c-TIDKVMMZ.min.js +1 -0
  100. package/dist/c-TIMGODBG.min.js +1 -0
  101. package/dist/c-TR7OHUAO.min.js +2 -0
  102. package/dist/c-TTKWXGAI.min.js +61 -0
  103. package/dist/c-TVKZC4BY.min.js +1 -0
  104. package/dist/c-U5XVLSHN.min.js +1 -0
  105. package/dist/c-U6NLVFN4.min.js +1 -0
  106. package/dist/{c-VJTDST2R.min.js → c-UBHICVSC.min.js} +1 -1
  107. package/dist/c-UOPPO26M.min.js +1 -0
  108. package/dist/c-UUDAON4Z.min.js +1 -0
  109. package/dist/c-V32TPPY2.min.js +1 -0
  110. package/dist/c-V5KFJWQQ.min.js +1 -0
  111. package/dist/{c-P65V6HLO.min.js → c-VN557BQE.min.js} +1 -1
  112. package/dist/c-VXIYF7V2.min.js +1 -0
  113. package/dist/c-Y342FJ6K.min.js +1 -0
  114. package/dist/c-YM6CT4LJ.min.js +1 -0
  115. package/dist/{c-MVR3RWF3.min.js → c-YMFUIO54.min.js} +1 -1
  116. package/dist/c-YQVOKPKR.min.js +1 -0
  117. package/dist/c-YRJ3BJQZ.min.js +1 -0
  118. package/dist/c-YT5KPVNP.min.js +1 -0
  119. package/dist/components/ai/audienceProfile.d.ts +18 -1
  120. package/dist/components/ai/describeChart.d.ts +5 -1
  121. package/dist/components/ai/intentManifest.d.ts +16 -0
  122. package/dist/components/ai/intentRegistry.d.ts +12 -0
  123. package/dist/components/ai/intents.d.ts +6 -6
  124. package/dist/components/ai/streamSchema.d.ts +19 -0
  125. package/dist/components/ai/streamingTypes.d.ts +57 -11
  126. package/dist/components/ai/suggestCharts.d.ts +1 -1
  127. package/dist/components/ai/suggestStreamCharts.d.ts +43 -8
  128. package/dist/components/ai/suggestStreamDashboard.d.ts +35 -0
  129. package/dist/components/ai/variantDiscovery.d.ts +1 -1
  130. package/dist/components/charts/ordinal/BarChart.streamCapability.d.ts +2 -0
  131. package/dist/components/charts/ordinal/DonutChart.streamCapability.d.ts +2 -0
  132. package/dist/components/charts/ordinal/GroupedBarChart.streamCapability.d.ts +2 -0
  133. package/dist/components/charts/ordinal/PieChart.streamCapability.d.ts +2 -0
  134. package/dist/components/charts/ordinal/StackedBarChart.streamCapability.d.ts +2 -0
  135. package/dist/components/charts/realtime/RealtimeAccumulator.d.ts +14 -0
  136. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +6 -5
  137. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -1
  138. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -161
  139. package/dist/components/charts/realtime/RealtimeLineChart.types.d.ts +175 -0
  140. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +6 -5
  141. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +6 -5
  142. package/dist/components/charts/realtime/aggregate.d.ts +11 -1
  143. package/dist/components/charts/realtime/resolveWindowSize.d.ts +1 -1
  144. package/dist/components/charts/shared/DirectLabelLayer.d.ts +25 -0
  145. package/dist/components/charts/shared/chartDataProps.d.ts +3 -0
  146. package/dist/components/charts/shared/chartSpecAtlasSchemas.d.ts +5 -0
  147. package/dist/components/charts/shared/chartSpecCore.d.ts +4 -0
  148. package/dist/components/charts/shared/chartSpecsAtlas.d.ts +2 -0
  149. package/dist/components/charts/shared/directLabels.d.ts +12 -0
  150. package/dist/components/charts/shared/hooks.d.ts +3 -1
  151. package/dist/components/charts/shared/knownChartComponents.d.ts +5 -2
  152. package/dist/components/charts/shared/lineSeriesSsr.d.ts +0 -12
  153. package/dist/components/charts/shared/useChartSetup.d.ts +2 -0
  154. package/dist/components/charts/value/BigNumber.streamCapability.d.ts +2 -0
  155. package/dist/components/charts/value/GaugeChart.streamCapability.d.ts +2 -0
  156. package/dist/components/charts/xy/BubbleChart.d.ts +4 -1
  157. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -1
  158. package/dist/components/charts/xy/LineChart.d.ts +4 -1
  159. package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
  160. package/dist/components/realtime/HyperLogLog.d.ts +19 -0
  161. package/dist/components/realtime/ReorderBuffer.d.ts +2 -2
  162. package/dist/components/realtime/TDigest.d.ts +22 -0
  163. package/dist/components/realtime/WindowAccumulator.d.ts +22 -5
  164. package/dist/components/realtime/applyChangelog.d.ts +38 -0
  165. package/dist/components/realtime/minHeap.d.ts +3 -0
  166. package/dist/components/recipes/atlas/DependencyForestChart.d.ts +20 -0
  167. package/dist/components/recipes/atlas/DependencyMatrix.d.ts +7 -0
  168. package/dist/components/recipes/atlas/FlowCircuitChart.d.ts +20 -0
  169. package/dist/components/recipes/atlas/MotifBraidChart.d.ts +17 -0
  170. package/dist/components/recipes/atlas/atlasChartOptions.d.ts +11 -0
  171. package/dist/components/recipes/atlas/braid.d.ts +62 -0
  172. package/dist/components/recipes/atlas/capsules.d.ts +18 -0
  173. package/dist/components/recipes/atlas/compare.d.ts +4 -0
  174. package/dist/components/recipes/atlas/completeness.d.ts +2 -0
  175. package/dist/components/recipes/atlas/dependencyForest.d.ts +32 -0
  176. package/dist/components/recipes/atlas/dependencyForestChartProps.d.ts +58 -0
  177. package/dist/components/recipes/atlas/dependencyForestLayout.d.ts +17 -0
  178. package/dist/components/recipes/atlas/dependencyQueries.d.ts +20 -0
  179. package/dist/components/recipes/atlas/dependencyTypes.d.ts +21 -0
  180. package/dist/components/recipes/atlas/directedGraph.d.ts +9 -0
  181. package/dist/components/recipes/atlas/entityCounts.d.ts +3 -0
  182. package/dist/components/recipes/atlas/flowCircuit.d.ts +32 -0
  183. package/dist/components/recipes/atlas/flowCircuitChartProps.d.ts +72 -0
  184. package/dist/components/recipes/atlas/flowCircuitChrome.d.ts +18 -0
  185. package/dist/components/recipes/atlas/flowCircuitGeometry.d.ts +11 -0
  186. package/dist/components/recipes/atlas/flowCircuitLayout.d.ts +20 -0
  187. package/dist/components/recipes/atlas/flowCircuitSemantics.d.ts +26 -0
  188. package/dist/components/recipes/atlas/flowCircuitTape.d.ts +22 -0
  189. package/dist/components/recipes/atlas/flowCircuitTypes.d.ts +144 -0
  190. package/dist/components/recipes/atlas/forests.d.ts +11 -0
  191. package/dist/components/recipes/atlas/ids.d.ts +6 -0
  192. package/dist/components/recipes/atlas/index.d.ts +26 -0
  193. package/dist/components/recipes/atlas/ledger.d.ts +7 -0
  194. package/dist/components/recipes/atlas/motifBraidChartProps.d.ts +51 -0
  195. package/dist/components/recipes/atlas/motifBraidGeometry.d.ts +5 -0
  196. package/dist/components/recipes/atlas/motifBraidLayout.d.ts +11 -0
  197. package/dist/components/recipes/atlas/motifs.d.ts +3 -0
  198. package/dist/components/recipes/atlas/prefixForest.d.ts +9 -0
  199. package/dist/components/recipes/atlas/prepare.d.ts +14 -0
  200. package/dist/components/recipes/atlas/prepareAsync.d.ts +7 -0
  201. package/dist/components/recipes/atlas/profile.d.ts +19 -0
  202. package/dist/components/recipes/atlas/publish.d.ts +10 -0
  203. package/dist/components/recipes/atlas/queries.d.ts +34 -0
  204. package/dist/components/recipes/atlas/requiredPaths.d.ts +9 -0
  205. package/dist/components/recipes/atlas/rootedForest.d.ts +4 -0
  206. package/dist/components/recipes/atlas/sections.d.ts +3 -0
  207. package/dist/components/recipes/atlas/support.d.ts +7 -0
  208. package/dist/components/recipes/atlas/types.d.ts +278 -0
  209. package/dist/components/recipes/atlas/validate.d.ts +12 -0
  210. package/dist/components/recipes/layout1d.d.ts +2 -20
  211. package/dist/components/recipes/minGapPlacement.d.ts +20 -0
  212. package/dist/components/semiotic-ai-core.d.ts +8 -3
  213. package/dist/components/semiotic-ai-stream.d.ts +10 -0
  214. package/dist/components/semiotic-ai.d.ts +4 -6
  215. package/dist/components/semiotic-atlas-core.d.ts +20 -0
  216. package/dist/components/semiotic-atlas.d.ts +8 -0
  217. package/dist/components/semiotic-realtime-core.d.ts +6 -2
  218. package/dist/components/semiotic-recipes-core.d.ts +9 -0
  219. package/dist/components/semiotic-stream-types.d.ts +14 -0
  220. package/dist/components/semiotic-xy.d.ts +1 -0
  221. package/dist/components/semiotic.d.ts +3 -11
  222. package/dist/components/server/encodeSvgFramesToGif.d.ts +2 -0
  223. package/dist/components/server/rasterizeSVG.d.ts +2 -0
  224. package/dist/components/server/registerServerXYPlugins.d.ts +2 -0
  225. package/dist/components/server/renderEvidence.d.ts +4 -0
  226. package/dist/components/server/serverChartConfigs.d.ts +8 -0
  227. package/dist/components/server/serverChartConfigsAtlas.d.ts +4 -0
  228. package/dist/components/server/serverChartConfigsRealtime.d.ts +6 -0
  229. package/dist/components/server/serverRealtimeCategoryColors.d.ts +3 -0
  230. package/dist/components/server/staticAnnotations.d.ts +9 -0
  231. package/dist/components/stream/NetworkPipelineStore.d.ts +1 -0
  232. package/dist/components/stream/SceneGraph.d.ts +3 -3
  233. package/dist/components/stream/StalenessBadge.d.ts +5 -2
  234. package/dist/components/stream/canvasSetup.d.ts +1 -2
  235. package/dist/components/stream/fontLoading.d.ts +4 -0
  236. package/dist/components/stream/networkCustomLayout.d.ts +8 -0
  237. package/dist/components/stream/networkCustomLayoutCache.d.ts +12 -0
  238. package/dist/components/stream/networkPipelineConfig.d.ts +0 -7
  239. package/dist/components/stream/physics/physicsSemanticUI.d.ts +2 -0
  240. package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +3 -1
  241. package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +2 -0
  242. package/dist/components/stream/pipelinePathJoin.d.ts +27 -0
  243. package/dist/components/stream/pipelineTransitionTypes.d.ts +43 -0
  244. package/dist/components/stream/pipelineTransitions.d.ts +5 -35
  245. package/dist/components/stream/seriesGeometry.d.ts +2 -1
  246. package/dist/components/stream/shallowEqual.d.ts +2 -0
  247. package/dist/components/stream/streamEncodingTypes.d.ts +9 -0
  248. package/dist/components/stream/types.d.ts +25 -2
  249. package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +4 -2
  250. package/dist/components/text/axisLabelAssessment.d.ts +15 -0
  251. package/dist/components/text/browserAxisLabelAssessment.d.ts +1 -0
  252. package/dist/components/text/browserLabelMeasurement.d.ts +3 -0
  253. package/dist/components/text/labelMeasurement.d.ts +19 -0
  254. package/dist/components/text/labelPlacement.d.ts +71 -0
  255. package/dist/components/text/useAxisLabelAssessment.d.ts +6 -0
  256. package/dist/components/text/useLabelMeasurer.d.ts +3 -0
  257. package/dist/controls.module.min.js +71 -1
  258. package/dist/geo.min.js +231 -1
  259. package/dist/geo.module.min.js +31 -1
  260. package/dist/network.module.min.js +1 -1
  261. package/dist/ordinal.module.min.js +1 -1
  262. package/dist/physics-matter.module.min.js +1 -1
  263. package/dist/physics-rapier.module.min.js +1 -1
  264. package/dist/physics.module.min.js +1 -1
  265. package/dist/rough.min.js +2 -1
  266. package/dist/rough.module.min.js +2 -1
  267. package/dist/semiotic-access.module.min.js +1 -1
  268. package/dist/semiotic-ai-artifact-policy-constants.module.min.js +1 -1
  269. package/dist/semiotic-ai-core.d.ts +8 -3
  270. package/dist/semiotic-ai-core.min.js +4 -1
  271. package/dist/semiotic-ai-core.module.min.js +4 -1
  272. package/dist/semiotic-ai-hash-primitives.module.min.js +1 -1
  273. package/dist/semiotic-ai.d.ts +4 -6
  274. package/dist/semiotic-ai.module.min.js +14 -1
  275. package/dist/semiotic-artifact-react.min.js +269 -1
  276. package/dist/semiotic-artifact-react.module.min.js +137 -1
  277. package/dist/semiotic-artifact.min.js +3 -1
  278. package/dist/semiotic-artifact.module.min.js +3 -1
  279. package/dist/semiotic-atlas-core.d.ts +20 -0
  280. package/dist/semiotic-atlas-core.min.js +2 -0
  281. package/dist/semiotic-atlas-core.module.min.js +1 -0
  282. package/dist/semiotic-atlas-selection.module.min.js +2 -0
  283. package/dist/semiotic-atlas.d.ts +8 -0
  284. package/dist/semiotic-atlas.min.js +2 -0
  285. package/dist/semiotic-atlas.module.min.js +12 -0
  286. package/dist/semiotic-client-cjs-shared.min.js +1529 -1
  287. package/dist/semiotic-client-glyph.module.min.js +3 -1
  288. package/dist/semiotic-client-responsive.module.min.js +1 -1
  289. package/dist/semiotic-client-shared.module.min.js +1 -1
  290. package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -1
  291. package/dist/semiotic-data.min.js +1 -1
  292. package/dist/semiotic-data.module.min.js +1 -1
  293. package/dist/semiotic-evidence.min.js +3 -1
  294. package/dist/semiotic-evidence.module.min.js +3 -1
  295. package/dist/semiotic-experimental-auxiliary.module.min.js +8 -1
  296. package/dist/semiotic-experimental-node-auxiliary.module.min.js +8 -1
  297. package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
  298. package/dist/semiotic-experimental-vacp.min.js +1 -1
  299. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  300. package/dist/semiotic-line.module.min.js +1 -1
  301. package/dist/semiotic-realtime-core.d.ts +6 -2
  302. package/dist/semiotic-realtime-core.module.min.js +1 -1
  303. package/dist/semiotic-realtime-react.module.min.js +1 -1
  304. package/dist/semiotic-recipes-core-cjs-base.min.js +160 -1
  305. package/dist/semiotic-recipes-core.d.ts +9 -0
  306. package/dist/semiotic-recipes-core.module.min.js +72 -1
  307. package/dist/semiotic-recipes-geo-cjs.min.js +1 -1
  308. package/dist/semiotic-recipes-react.min.js +3 -1
  309. package/dist/semiotic-server-edge-node.module.min.js +391 -1
  310. package/dist/semiotic-server-edge.min.js +651 -1
  311. package/dist/semiotic-server-edge.module.min.js +372 -1
  312. package/dist/semiotic-server-node.min.js +651 -1
  313. package/dist/semiotic-server-node.module.min.js +1 -1
  314. package/dist/semiotic-text.min.js +1 -1
  315. package/dist/semiotic-text.module.min.js +1 -1
  316. package/dist/semiotic-themes-core.min.js +1 -1
  317. package/dist/semiotic-themes-core.module.min.js +1 -1
  318. package/dist/semiotic-themes.min.js +1 -1
  319. package/dist/semiotic-themes.module.min.js +1 -1
  320. package/dist/semiotic-utils-core.min.js +11 -1
  321. package/dist/semiotic-utils-core.module.min.js +8 -1
  322. package/dist/semiotic-value.module.min.js +15 -1
  323. package/dist/semiotic-xy.d.ts +1 -0
  324. package/dist/semiotic.d.ts +3 -11
  325. package/dist/semiotic.module.min.js +10 -1
  326. package/dist/server.min.js +651 -1
  327. package/dist/server.module.min.js +1 -1
  328. package/dist/xy.module.min.js +1 -1
  329. package/package.json +19 -3
  330. package/dist/c-2N7IU2NY.min.js +0 -1
  331. package/dist/c-2WK7YJLL.min.js +0 -1
  332. package/dist/c-33QOXEUG.min.js +0 -1
  333. package/dist/c-447VIMRO.min.js +0 -1
  334. package/dist/c-4FN7Q6VQ.min.js +0 -1
  335. package/dist/c-553QUDKA.min.js +0 -1
  336. package/dist/c-55BAJ333.min.js +0 -1
  337. package/dist/c-7242NXSG.min.js +0 -1
  338. package/dist/c-7EGHJU2F.min.js +0 -1
  339. package/dist/c-7HP7MB2I.min.js +0 -1
  340. package/dist/c-7NBU5ZKS.min.js +0 -1
  341. package/dist/c-AFBSWT77.min.js +0 -1
  342. package/dist/c-AJ7EC32V.min.js +0 -1
  343. package/dist/c-AQADQNY7.min.js +0 -1
  344. package/dist/c-ATM475SA.min.js +0 -1
  345. package/dist/c-AVO3Q7T7.min.js +0 -1
  346. package/dist/c-AZKPVBOC.min.js +0 -1
  347. package/dist/c-BNFJMDHN.min.js +0 -1
  348. package/dist/c-BNG5ECK5.min.js +0 -1
  349. package/dist/c-BOHCQILI.min.js +0 -1
  350. package/dist/c-CCTGN5CK.min.js +0 -1
  351. package/dist/c-CPSPZH6A.min.js +0 -1
  352. package/dist/c-CPV4N35K.min.js +0 -1
  353. package/dist/c-DE5Q3U2X.min.js +0 -1
  354. package/dist/c-DK662R77.min.js +0 -1
  355. package/dist/c-DY2676CR.min.js +0 -1
  356. package/dist/c-E32M6XW5.min.js +0 -1
  357. package/dist/c-E4JDJH4I.min.js +0 -1
  358. package/dist/c-E7I2L7CU.min.js +0 -1
  359. package/dist/c-EBOQ7ER7.min.js +0 -1
  360. package/dist/c-ELDWAO2V.min.js +0 -1
  361. package/dist/c-EUBTECGM.min.js +0 -1
  362. package/dist/c-GSZRZRD6.min.js +0 -1
  363. package/dist/c-GWX7JGMF.min.js +0 -1
  364. package/dist/c-GXV3C3MO.min.js +0 -1
  365. package/dist/c-HHTK2R75.min.js +0 -1
  366. package/dist/c-HLLFJYTY.min.js +0 -1
  367. package/dist/c-HPOYKCCG.min.js +0 -1
  368. package/dist/c-HXDKPIKR.min.js +0 -1
  369. package/dist/c-I4QJ6YLM.min.js +0 -1
  370. package/dist/c-IDJV3CZK.min.js +0 -1
  371. package/dist/c-ITKX3RC5.min.js +0 -1
  372. package/dist/c-JG2JCQLP.min.js +0 -1
  373. package/dist/c-JLGRHXGZ.min.js +0 -1
  374. package/dist/c-JUKIWTBJ.min.js +0 -1
  375. package/dist/c-KCRJGUHP.min.js +0 -1
  376. package/dist/c-LMGSSD2E.min.js +0 -1
  377. package/dist/c-LYQMZMZQ.min.js +0 -1
  378. package/dist/c-LYVKDBQJ.min.js +0 -1
  379. package/dist/c-MXCP7GNZ.min.js +0 -1
  380. package/dist/c-NG7BLZTR.min.js +0 -1
  381. package/dist/c-NYZ2QNAM.min.js +0 -1
  382. package/dist/c-OO5QLMJC.min.js +0 -1
  383. package/dist/c-OOVX2JPQ.min.js +0 -1
  384. package/dist/c-PP6VY3QU.min.js +0 -1
  385. package/dist/c-PRIKOLTE.min.js +0 -1
  386. package/dist/c-PSNI6KAZ.min.js +0 -1
  387. package/dist/c-PYNW54D2.min.js +0 -1
  388. package/dist/c-QAVFOEUY.min.js +0 -1
  389. package/dist/c-ROEHCIGV.min.js +0 -1
  390. package/dist/c-S3AZX5PP.min.js +0 -1
  391. package/dist/c-T2V7O2LO.min.js +0 -1
  392. package/dist/c-TIXX5CAU.min.js +0 -1
  393. package/dist/c-TKG2NP7G.min.js +0 -1
  394. package/dist/c-VXLOLYTO.min.js +0 -1
  395. package/dist/c-W4ZUKSEQ.min.js +0 -1
  396. package/dist/c-WH2O53VI.min.js +0 -1
  397. package/dist/c-WNGH47HF.min.js +0 -1
  398. package/dist/c-XDQKXPX4.min.js +0 -1
  399. package/dist/c-XSB27XPS.min.js +0 -1
  400. package/dist/c-YDECTEUW.min.js +0 -1
  401. package/dist/c-YF3YKVQI.min.js +0 -1
  402. package/dist/c-YLZIV3VS.min.js +0 -1
  403. package/dist/c-ZYPXQF7B.min.js +0 -1
@@ -1 +1 @@
1
- function e(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function t(e,t={}){let r="number"==typeof t.maxDepth&&Number.isFinite(t.maxDepth)?Math.max(1,Math.floor(t.maxDepth)):10,n="number"==typeof t.maxArrayLength&&Number.isFinite(t.maxArrayLength)?Math.max(1,Math.floor(t.maxArrayLength)):1e3,a=new WeakSet,i=(e,t)=>{if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:e+"";if("bigint"==typeof e)return""+e;if("function"==typeof e||"symbol"==typeof e||typeof e>"u")return;if(e instanceof Date)return e.toISOString();if(t>=r)return"[depth limit]";if("object"!=typeof e)return e+"";if("$$typeof"in e)return;if(a.has(e))return"[circular]";if(a.add(e),Array.isArray(e)){let r=e.slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Set){let r=Array.from(e).slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Map){let r=Object.create(null),o=0;for(let[a,l]of e){if(o++>=n)break;let e=i(l,t+1);void 0!==e&&(r[a+""]=e)}return a.delete(e),r}let o=Object.create(null);for(let r of Object.keys(e).sort()){let n=i(e[r],t+1);void 0!==n&&(o[r]=n)}return a.delete(e),o};return i(e,0)}function r(r){let n=t(r);return e(n)?n:{}}function n(t){if(Array.isArray(t))return t.map(n);if(!e(t))return t;let r=Object.create(null);for(let e of Object.keys(t).sort())r[e]=n(t[e]);return r}function a(e){return JSON.stringify(n(t(e)))}function i(e){return function(e){let t=BigInt("14695981039346656037"),r=BigInt("1099511628211"),n=BigInt("0xffffffffffffffff");for(let a=0;e.length>a;a++)t^=BigInt(e.charCodeAt(a)),t=t*r&n;return t.toString(16).padStart(16,"0")}(a(e))}function o(e){if(!e?.length)return;let t=Array.from(new Set(e.filter(e=>"string"==typeof e&&e.length))).sort();return t.length?t:void 0}function l(e,t){return t.some(t=>e===t||e.startsWith(t+"/"))}function s(e,t){let r=o(t.refs),n=!1!==t.includeSummary;if(!r)return{snapshot:{version:e.version,createdAt:e.createdAt,state:e.state,...n&&e.summary?{summary:e.summary}:{}}};let a={};for(let[t,n]of Object.entries(e.state))l(t,r)&&(a[t]=n);let i={};if(n&&e.summary)for(let[t,n]of Object.entries(e.summary))l(t,r)&&(i[t]=n);return{snapshot:{version:e.version,createdAt:e.createdAt,state:a,...Object.keys(i).length?{summary:i}:{}},refs:r}}function c(e,t){let r={},n=[];for(let[n,i]of Object.entries(t.state))(!Object.prototype.hasOwnProperty.call(e.state,n)||a(e.state[n])!==a(i))&&(r[n]=i);for(let r of Object.keys(e.state))Object.prototype.hasOwnProperty.call(t.state,r)||n.push(r);let i={},o=[],l=e.summary??{},s=t.summary??{};for(let[e,t]of Object.entries(s))(!Object.prototype.hasOwnProperty.call(l,e)||a(l[e])!==a(t))&&(i[e]=t);for(let e of Object.keys(l))Object.prototype.hasOwnProperty.call(s,e)||o.push(e);return{changed:r,removed:n.sort(),...Object.keys(i).length?{summaryChanged:i}:{},...o.length?{summaryRemoved:o.sort()}:{}}}function u(e){return null==e?"NULL":"number"==typeof e?"DOUBLE":"string"==typeof e?"VARCHAR":"boolean"==typeof e?"BOOLEAN":e instanceof Date?"TIMESTAMP":Array.isArray(e)?"ARRAY":"OBJECT"}function d(e,t){if(!t.descriptor.name.trim())throw Error("VACP action names must be non-empty.");if(e.some(e=>e.descriptor.name===t.descriptor.name))throw Error(`Duplicate VACP action "${t.descriptor.name}".`);e.push(t)}function f(t,r){if(!e(t))throw Error(r+" expects an object parameter payload.");return t}function h(e,t){return"number"==typeof e&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function m(e,t,r){if("string"!=typeof e.selectionRef)throw Error("params.selectionRef must be a VACP selection ref.");let n=t.find(t=>t.ref===e.selectionRef);if(!n)throw Error(`Unknown selection ref "${e.selectionRef}".`);if(r&&!n.modes.has(r))throw Error(`Selection "${n.name}" does not accept ${r} state.`);return n}function p(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function g(n,a,o){let l=[],s=n.dataHandles.map(e=>e.ref);s.length&&d(l,{descriptor:{name:vt,title:"Describe Semiotic data",description:"Return columns, types, row count, and optional bounded summaries for a chart DataHandle.",targetRef:o.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:s},detail:{type:"string",enum:["columns","full"]},sampleRows:{type:"number",minimum:1}},required:["handleRef"]}},execute(t){let r=f(t,vt);if("string"!=typeof r.handleRef)throw Error("params.handleRef must be a DataHandle ref.");let i=n.dataHandles.find(e=>e.ref===r.handleRef);if(!i)throw Error(`Unknown DataHandle "${r.handleRef}".`);let o=void 0===r.detail||"columns"===r.detail?"columns":"full"===r.detail?"full":(()=>{throw Error('params.detail must be "columns" or "full".')})(),l="number"==typeof r.sampleRows&&Number.isFinite(r.sampleRows)?Math.max(1,Math.floor(r.sampleRows)):"full"===o?1e3:Math.min(i.rows.length,1e3),s=h(a.dataAccess?.maxSchemaRows,5e3);return function(t){let r=t.rows.slice(0,Math.max(0,t.sampleRows)),n=function(t){let r=new Map;for(let n of t)if(e(n))for(let[e,t]of Object.entries(n)){let n=r.get(e)??new Set;n.add(u(t)),r.set(e,n)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let r=Array.from(t).filter(e=>"NULL"!==e);return{name:e,type:0===r.length?"NULL":1===new Set(r).size?r[0]:"MIXED"}})}(t.rows),a=n.map(e=>e.name);if("columns"===t.detail)return{handleRef:t.handleRef,detail:t.detail,table:null,rowCount:t.rows.length,columns:n};let i=function(t,r){let n=Object.create(null);for(let a of r){let r=[];for(let n of t){if(!e(n))continue;let t=n[a];"number"==typeof t&&Number.isFinite(t)&&r.push(t)}if(!r.length)continue;let i=r[0],o=r[0],l=0;for(let e of r)i=Math.min(i,e),o=Math.max(o,e),l+=e;n[a]={min:i,max:o,avg:l/r.length}}return Object.keys(n).length?n:void 0}(r,a),o=function(t,r){let n=Object.create(null);for(let a of r){let r=[];for(let n of t){if(!e(n))continue;let t=n[a];t instanceof Date&&Number.isFinite(t.getTime())&&r.push(t.getTime())}if(!r.length)continue;let i=Math.min(...r),o=Math.max(...r);n[a]={minIso:new Date(i).toISOString(),maxIso:new Date(o).toISOString(),minEpochMs:i,maxEpochMs:o}}return Object.keys(n).length?n:void 0}(r,a),l=function(t,r){let n=Object.create(null);for(let a of r){let r=new Map;for(let n of t){if(!e(n))continue;let t=n[a];if("string"!=typeof t&&"boolean"!=typeof t)continue;let i=t+"";r.set(i,(r.get(i)??0)+1)}r.size&&(n[a]=Array.from(r).sort(([e,t],[r,n])=>n-t||e.localeCompare(r)).slice(0,10).map(([e,t])=>({value:e,n:t})))}return Object.keys(n).length?n:void 0}(r,a);return{handleRef:t.handleRef,detail:t.detail,table:null,rowCount:t.rows.length,columns:n,...i?{numeric:i}:{},...o?{temporal:o}:{},...l?{categoricalTopValues:l}:{},sampledRows:r.length}}({handleRef:i.ref,rows:i.rows,detail:o,sampleRows:Math.min(l,s)})}}),s.length&&a.dataAccess?.sample&&d(l,{descriptor:{name:gt,title:"Inspect bounded Semiotic rows",description:"Return a bounded JSON sample from a chart DataHandle. This action is opt-in.",targetRef:o.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:s},offset:{type:"number",minimum:0},limit:{type:"number",minimum:1}},required:["handleRef"]}},execute(e){let r=f(e,gt);if("string"!=typeof r.handleRef)throw Error("params.handleRef must be a DataHandle ref.");let i=n.dataHandles.find(e=>e.ref===r.handleRef);if(!i)throw Error(`Unknown DataHandle "${r.handleRef}".`);let o="number"==typeof r.offset&&Number.isFinite(r.offset)?Math.max(0,Math.floor(r.offset)):0,l=h(a.dataAccess?.maxSampleRows,50),s="number"==typeof r.limit&&Number.isFinite(r.limit)?Math.max(1,Math.floor(r.limit)):Math.min(20,l),c=Math.min(s,l),u=i.rows.slice(o,o+c);return{handleRef:i.ref,offset:o,limit:c,rowCount:i.rows.length,rows:t(u,{maxArrayLength:l}),truncated:i.rows.length>o+u.length}}});let c=n.selections.map(e=>e.ref),g=n.selections.filter(e=>e.modes.has("point"));g.length&&a.selectionActions?.setPointSelection&&d(l,{descriptor:{name:ft,title:"Set point selection",description:"Set a named LinkedCharts point-selection clause with allowlisted fields.",targetRef:o.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:g.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=f(t,ft),i=m(r,n.selections,"point"),o=function(t,r){if(!e(t)||!Object.keys(t).length)throw Error("params.fields must be a non-empty object.");let n=Object.create(null);for(let[e,a]of Object.entries(t)){if(!r.includes(e))throw Error(`Field "${e}" is not allowed for this selection.`);if(!Array.isArray(a)||!a.length)throw Error(`Point selection field "${e}" requires values[].`);for(let t of a)if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&("number"!=typeof t||!Number.isFinite(t)))throw Error(`Point selection field "${e}" only accepts JSON primitive values.`);n[e]=[...a]}return n}(r.fields,i.fields);return await(a.selectionActions?.setPointSelection?.(i.name,i.clientId,o)),{selectionRef:i.ref,fields:o}}});let y=n.selections.filter(e=>e.modes.has("interval"));y.length&&a.selectionActions?.setIntervalSelection&&d(l,{descriptor:{name:ht,title:"Set interval selection",description:"Set a named LinkedCharts interval-selection clause in data units.",targetRef:o.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:y.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=f(t,ht),i=m(r,n.selections,"interval"),o=function(t,r){if(!e(t)||!Object.keys(t).length)throw Error("params.fields must be a non-empty object.");let n=Object.create(null);for(let[e,a]of Object.entries(t)){if(!r.includes(e))throw Error(`Field "${e}" is not allowed for this selection.`);if(!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||!Number.isFinite(a[0])||!Number.isFinite(a[1]))throw Error(`Interval selection field "${e}" requires [min,max].`);n[e]=[Math.min(a[0],a[1]),Math.max(a[0],a[1])]}return n}(r.fields,i.fields);return await(a.selectionActions?.setIntervalSelection?.(i.name,i.clientId,o)),{selectionRef:i.ref,fields:o}}}),c.length&&a.selectionActions?.clearSelection&&d(l,{descriptor:{name:mt,title:"Clear selection",description:"Clear every active clause from one named LinkedCharts selection.",targetRef:o.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:c}},required:["selectionRef"]}},async execute(e){let t=m(f(e,mt),n.selections);return await(a.selectionActions?.clearSelection?.(t.name)),{selectionRef:t.ref,cleared:!0}}});let v=n.charts.map(e=>e.navigation).filter(e=>!!e&&e.index.valid&&!!e.binding.onActiveChange);v.length&&d(l,{descriptor:{name:pt,title:"Activate chart navigation target",description:"Move an accessible chart navigation tree to a uniquely identified datum.",targetRef:o.view,parameters:{type:"object",properties:{navigationRef:{type:"string",enum:v.map(e=>e.ref)},match:{type:"object"}},required:["navigationRef","match"]}},execute(t){let r=f(t,pt);if("string"!=typeof r.navigationRef)throw Error("params.navigationRef must be a navigation ref.");let n=v.find(e=>e.ref===r.navigationRef);if(!n)throw Error(`Unknown navigation ref "${r.navigationRef}".`);let a=function(t,r){if(!e(t))throw Error("params.match must be an object.");for(let e of Object.keys(t))if(!r.includes(e))throw Error(`params.match includes undeclared field "${e}".`);let n=Object.create(null);for(let e of r){if(!Object.prototype.hasOwnProperty.call(t,e)||!p(t[e]))throw Error(`params.match requires a primitive value for "${e}".`);n[e]=t[e]instanceof Date?t[e].toISOString():t[e]}return n}(r.match,n.index.matchFields),o=n.index.byKey.get(i(a));if(!o)throw Error("No navigation datum matches params.match.");return n.binding.onActiveChange?.(o),{navigationRef:n.ref,targetRef:n.index.targetRef(a),match:a}}});let b="function"==typeof a.actions?a.actions():a.actions;for(let e of b??[])e.available&&!e.available()||d(l,{descriptor:{...e.descriptor,...e.descriptor.parameters?{parameters:r(e.descriptor.parameters)}:{}},async execute(t){let r=e.validate?.(t);if("string"==typeof r&&r)throw Error(r);return e.execute(t)}});return l}function y(){let e=globalThis;return e[wt]||(e[wt]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[wt]}function v(e){return y().recipes.get(e)}function b(e){return"string"==typeof e?v(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function $(e){return"string"==typeof e?e:e.id??e.name}function w(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function C(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function A(e,t,r){return r??b(t.recipe)??b(t.recipeId)??v(e)}function k(e,t,r=[]){let n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;let a=r.find(e=>e&&"object"==typeof e);if(!a)return;let i=Object.entries(a).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in a):i.find(([,e])=>"string"==typeof e)?.[0]}function x(e,t){return e.dataRoles.find(e=>e.role===t)}function S(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function P(e,t,r,n,a,i={}){let o={...i};if(t)for(let[e,r]of Object.entries(t))o[e]=r;for(let e of r.dataRoles){let r=k(e,n,a),i=t&&r?t[r]:r;void 0!==i&&(o[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{let r=o[t];return null==r?`{${t}}`:r+""})}function j(e,t,r){let n=Ye(e,t,r);return{mismatchPaths:[...n.mismatchPaths,...void 0!==r&&n.unknownPaths.includes("artifact.component")?["artifact.component"]:[]]}}function I(e,t,r,n){let a={component:t,version:n.version,createdAt:n.createdAt,...void 0!==n.recipeId?{recipeId:n.recipeId}:{},...void 0!==n.portable?{portable:n.portable}:{},...void 0!==n.manifest?{manifest:n.manifest}:{},...void 0!==n.reason?{reason:n.reason}:{},...void 0!==n.warnings?{warnings:n.warnings}:{},...void 0!==n.selections?{selections:n.selections}:{},artifactContract:r,status:e.status,omittedPaths:e.omittedPaths,warnings:e.warnings,...void 0!==e.serializedConfigFingerprint?{serializedConfigFingerprint:e.serializedConfigFingerprint}:{},...Object.prototype.hasOwnProperty.call(e,"serializedDataFingerprint")?{serializedDataFingerprint:e.serializedDataFingerprint}:{}};return tt(a).fingerprint}function M(e,t,r,n,a){let i=Xe(r),o={...e,serializedConfigFingerprint:tt(Qe(r)).fingerprint,serializedDataFingerprint:void 0===i?null:tt(i).fingerprint};return{...o,transferFingerprint:I(o,t,n,a)}}function R(e,t,r,n,a){if(!t)return{};let i=st(t),o=a.recipeId??e,l=j(t,r,o),s=function(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].filter(r=>{if(Object.prototype.hasOwnProperty.call(e,r)!==Object.prototype.hasOwnProperty.call(t,r))return!0;let n=tt(e[r]),a=tt(t[r]);return n.excludedPaths.length>0||n.fingerprint!==a.fingerprint}).map(e=>"props."+e).sort()}(r,n),c=j(t,n,o);return l.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:M({status:"invalid",omittedPaths:l.mismatchPaths,warnings:["The artifact contract fingerprints do not match the supplied chart props or data."]},e,n,i.contract,a)}:s.length>0?{artifactContract:i.contract,artifactTransfer:M({status:"excluded",omittedPaths:s,warnings:["Chart props or data were excluded from the serialized configuration."]},e,n,i.contract,a)}:c.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:M({status:"invalid",omittedPaths:c.mismatchPaths,warnings:["Serialized chart props or data differ from the values bound to the artifact contract."]},e,n,i.contract,a)}:{artifactContract:i.contract,artifactTransfer:M(i.transfer,e,n,i.contract,a)}}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function F(e,t){return!(!kt.has(e)||"areas"===e&&"string"==typeof t)}function D(e,t){return Pt.has(e)||jt.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function L(e){for(let t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){let r=e[t];if("string"==typeof r&&r)return r}}function N(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function E(e){let t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}function T(e,t){let r=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,a=[e.settledProjectionRows,e.projectionRows,n?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(a)?a.map((e,r)=>{if(!e||"object"!=typeof e)return null;let n=e,a=E(n.count??n.value??n.total??n.bodies??n.events);if(null==a)return null;let i=n.label??n.id??n.name??"container "+(r+1),o=E(n.secondary??n.secondaryCount),l=E(n.observed??n.observedCount);return{label:N(i,t),count:a,...null!=o?{secondary:o}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=l?{observed:l}:{}}}).filter(e=>null!=e):null}function B(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function _(e){return Mt[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function z(e,t){let r=function(e){if(e){if("fits"in e||"buildProps"in e){let t=e,r={};for(let[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(r[e]=n);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}(t);if(r?.act)return r.act;if(r?.intentScores){let e=function(e){let t,r=0;for(let[n,a]of Object.entries(e))if("number"==typeof a&&a>0){if(a>r){t=n,r=a;continue}if(a===r&&void 0!==t){let e=Nt.indexOf(n),r=Nt.indexOf(t);-1!==e&&(-1===r||r>e)&&(t=n)}}return t}(r.intentScores);if(e&&Dt[e]&&(r.intentScores[e]??0)>=3)return Dt[e]}return r?.family?Lt[r.family]:function(e){return"BumpChart"===e?"ranking":jt.has(e)||"StackedAreaChart"===e?"apportioning":Ft.has(e)?"relating":Pt.has(e)?"comparing":It.has(e)?"characterizing":St.has(e)?"tracking":Rt.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}function V(e){let t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;let t=e;if("string"!=typeof t.type||!Tt.has(t.type))return!1;let r=t.provenance;return!(!r||"object"!=typeof r)&&(Bt.has(r.authorKind)||_t.has(r.source)||zt.has(r.basis))})}function H(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}function q(e){let t=Vt["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=function(e){let t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}(e),n=r?r+t.replace(/^an? /,""):t,a="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return a?`${n} labeled "${a}"`:n}function G(e){let t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;let r=et(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;let n=r.map(q),a=n.slice(0,5),i=n.length-a.length,o=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${o}.`}function U(e,t,r={}){let n=void 0!==r.levels,a=new Set(r.levels??["l1","l2","l3"]);!n&&(r.capability||V(t))&&a.add("l4");let i=A(e,t,r.recipe);if(i){let e=["l1","l2","l3","l4"].filter(e=>a.has(e));!n&&!e.includes("l4")&&e.push("l4");let o=function(e,t,r={}){let n=C(t),a=w(t),i=r.locale??"en",o=("function"==typeof e.description?e.description({data:n,config:a,locale:i}):void 0)?.levels??function(e,t,r,n){let a=S(e,["nominal","ordinal"]),i=S(e,["quantitative"]),o=a?k(a,r,t):void 0,l=i?k(i,r,t):void 0,s=a?.role??o??"category",c=i?.role??l??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${s} and ${c} are mapped through the recipe's declared visual semantics`,{number:f,percent:h}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(n),m=new Map;if(o&&l)for(let e of t){let t=(e[o]??"Uncategorized")+"",r=Number(e[l]);Number.isFinite(r)&&m.set(t,(m.get(t)??0)+r)}let p=[...m].sort((e,t)=>t[1]-e[1]),g=p.reduce((e,[,t])=>e+t,0),y=p[0],v=p[1],b=g>0?((y?.[1]??0)+(v?.[1]??0))/g:0,w=e.intents.map(e=>({id:$(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,C=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${s} and ${c}. ${A=d,A&&A.charAt(0).toUpperCase()+A.slice(1)}.`,l2:p.length>0?`${p.length} categories total ${f.format(g)}. ${y[0]} accounts for ${f.format(y[1])}${g>0?` (${h.format(y[1]/g)})`:""}${v?`, followed by ${v[0]} at ${f.format(v[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>p.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>b?`The total is distributed across ${p.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${v[0]}, which together account for ${h.format(b)}.`,l4:`The chart is intended for ${w??"explanation"}${C?` with a ${C} audience`:""}: ${e.designContract.whyCustom}`};var A}(e,n,a,i),l=r.levels??["l1","l2","l3","l4"],s={};for(let e of l)o[e]&&(s[e]=o[e]);let c=["l1","l2","l3","l4"].map(e=>s[e]).filter(e=>!!e).join(" "),u=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:c,levels:s,...u?.length?{caveats:u}:{}}}(i,t,{levels:e,locale:r.locale,audience:r.audience,includeCaveats:r.includeCaveats}),l=G(t);return{...o,text:l?`${l} ${o.text}`.trim():o.text,...l?{annotations:l}:{}}}let o=H(r.locale??"en"),l=_(e),s=Array.isArray(t.data)?t.data:null,c=L(t),u=Ot.has(e)?T(t,o):null,d=Ot.has(e)&&null===u?function(e,t){let r="mechanical"===(t.simulationMode??t.mode)&&("GaltonBoardChart"===e||"UnitPileChart"===e);if(!Array.isArray(t.data)&&!r)return null;let n=Array.isArray(t.data)?t.data:[],a=Math.max(2,Math.round(rt(t.bins)??21)),i=Math.max(1,Math.round(rt(t.pegRows)??a-1));if(r&&(n="GaltonBoardChart"===e?nt({bins:a,count:t.mechanicalCount,pegRows:i,branchProbability:t.branchProbability,seed:t.seed}):at({count:t.mechanicalCount,categories:t.mechanicalCategories,unitValue:t.unitValue,seed:t.seed})),n=Ze(n,"UnitPileChart"===e?"pile":"GaltonBoardChart"===e?"galton":"EventDropChart"===e?"event":"collision-swarm").rows,"UnitPileChart"===e){let e=new Map,a=t.valueAccessor??(r?"value":void 0);return n.forEach((r,n)=>{let i=(lt(r,n,t.categoryAccessor??"category")??"unknown")+"",o=a?rt(lt(r,n,a)):1;e.set(i,(e.get(i)??0)+Math.max(0,o??0))}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("GaltonBoardChart"===e){let e=n.map((e,r)=>rt(lt(e,r,t.valueAccessor??"value"))).filter(e=>null!=e),o=r?[0,i]:ot(t.valueExtent),l=o?.[0]??(e.length?Math.min(...e):0),s=o?.[1]??(e.length?Math.max(...e):1),c=l===s?1:s-l,u=Array.from({length:a},(e,t)=>({label:t+1+"",value:0}));for(let t of e)u[Math.max(0,Math.min(a-1,Math.floor((t-l)/c*a)))].value+=1;return{generated:r,rows:u}}if("CollisionSwarmChart"===e){let e=new Map;return n.forEach((r,n)=>{if(null==rt(lt(r,n,t.xAccessor??"x")))return;let a=t.groupAccessor?(lt(r,n,t.groupAccessor)??"All")+"":"All";e.set(a,(e.get(a)??0)+1)}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("EventDropChart"===e){let e=rt(t.windows?.size??10);if(null==e||0>=e)return null;let{events:a}=ut({data:n,timeAccessor:t.timeAccessor??"time",arrivalAccessor:t.arrivalAccessor??"arrivalTime",windowSize:e,watermark:t.watermark,watermarkAtArrivalAccessor:t.watermarkAtArrivalAccessor}),i=a.map(e=>e.eventTime),o=i.length?Math.min(...i):0,l=i.length?Math.max(...i):o+e,s=Math.min(rt(t.timeExtent?.[0])??o,o),c=Math.max(rt(t.timeExtent?.[1])??l,l),u=Math.floor(s/e)*e,d=Math.max(1,Math.ceil((c-u+e)/e)),f=Array.from({length:d},(t,r)=>({label:`${u+r*e}-${u+(r+1)*e}`,value:0,secondary:0,secondaryLabel:"late"}));for(let t of a){let r=f[Math.max(0,Math.min(d-1,Math.floor((t.eventTime-u)/e)))];t.late?r.secondary+=1:r.value+=1}return{generated:r,rows:f}}return null}(e,t):null,{measure:f,measureFallback:h,dimension:m,dimensionFallback:p}=D(e,t),g="string"==typeof f&&f?f:h,y="string"==typeof m&&m?m:p,v={};if(Ot.has(e)&&function(e,t,r,n,a,i,o=null){let l=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=o&&"EventDropChart"===e?"accepted event":function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"UnitPileChart"===e?"unit":"body"}(e),c=o?o.generated?"The generated sample projection":"The source projection":"The settled projection";if(a.has("l1")&&(n.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!a.has("l2")&&!a.has("l3"))return;if(!r||0===r.length)return void(a.has("l2")&&(n.l2=o?"No valid source records are available.":"No settled projection is loaded yet."));let u=r.reduce((e,t)=>e+t.count,0),d=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),f=d[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!f)return;let h=r.reduce((e,t)=>e+(t.secondary??0),0),m=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(a.has("l2"))if(o&&"EventDropChart"===e)n.l2=`${c} classifies ${i(u+h)} ${B(u+h,"event")} across ${r.length} ${B(r.length,l)}: ${i(u)} accepted and ${i(h)} late.`;else if(0===d.length)n.l2=`${c} contains ${i(u)} ${B(u,s)} across ${r.length} ${B(r.length,l)}; no ${B(2,l)} are non-empty yet.`;else{let e=h>0?` ${i(h)} ${B(h,s)} ${1===h?"is":"are"} marked ${m}.`:"";n.l2=`${c} contains ${i(u)} ${B(u,s)} across ${r.length} ${B(r.length,l)}; ${d.length} ${B(d.length,l)} ${1===d.length?"is":"are"} non-empty. The largest ${l} is ${f.label} with ${i(f.count)} ${B(f.count,s)}.${e}`}if(a.has("l3")&&u>0&&d.length>0){let e=d.find(e=>e!==f),t=function(e,t){if(0>=t)return"0%";let r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}(f.count,u);n.l3=e?`${c} is most concentrated in ${f.label}, which holds ${i(f.count)} ${B(f.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${B(e.count,s)}.`:`${c} is concentrated in ${f.label}, which holds all ${i(f.count)} ${B(f.count,s)}.`}}(e,l,u??(d?T({projectionRows:d.rows},o):null),v,a,o,d),a.has("l1")&&!Ot.has(e))if("BumpChart"===e)v.l1=`A ${l} ranking ${c??"series"} by ${g} across ${y}.`;else if(St.has(e)||Pt.has(e))v.l1=`A ${l} of ${g} by ${y}`+(c?`, split by ${c}.`:".");else if(jt.has(e))v.l1=`A ${l} showing ${g} across ${y} categories.`;else if(It.has(e))v.l1=`A ${l} of the distribution of ${g}`+(c?` by ${c}.`:".");else if(Rt.has(e)){let e=Array.isArray(t.nodes)?t.nodes.length:void 0,r=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${J(e,"node")}`:null,null!=r?`${r} ${J(r,"edge")}`:null].filter(Boolean);v.l1=`A ${l}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){let e="string"==typeof t.label?t.label:g;v.l1=`A single value${e?" for "+e:""}.`}else v.l1=`A ${l}.`;let b=St.has(e)||"BumpChart"===e||Pt.has(e)||jt.has(e)||It.has(e),x=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&b&&s&&s.length>0&&(x=function(e,t,r,n){let a=0,i=0,o=1/0,l=-1/0,s=null,c=null,u=0,d=0,f=null,h=null,m=NaN,p=NaN;for(let r of e){let e=t(r);Number.isFinite(e)&&(0===a&&(m=e,f=r),p=e,h=r,o>e&&(o=e,s=r,u=a),e>l&&(l=e,c=r,d=a),a++,i+=e)}return 0===a?null:{count:a,min:o,max:l,mean:i/a,minLabel:N(null!=s?r(s):null,n),maxLabel:N(null!=c?r(c):null,n),first:m,last:p,firstLabel:N(null!=f?r(f):null,n),lastLabel:N(null!=h?r(h):null,n),minIndex:u,maxIndex:d}}(s,ct(f,h),dt(m,p),o)),a.has("l2")&&b&&(s&&0!==s.length?x&&(v.l2=jt.has(e)?`${x.count} segments totaling ${o(function(e){return e.mean*e.count}(x))}. Largest is ${x.maxLabel} at ${o(x.max)}; smallest is ${x.minLabel} at ${o(x.min)}.`:`${g} ranges from ${o(x.min)} (${x.minLabel}) to ${o(x.max)} (${x.maxLabel}), with a mean of ${o(x.mean)} across ${x.count} points.`):v.l2="No data is loaded yet."),a.has("l3")&&x&&!c&&St.has(e)?v.l3=function(e,t,r){let{first:n,last:a,min:i,max:o,maxLabel:l,minLabel:s,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:f,count:h}=e,m=o-i,p=a-n;if(0===m)return`${K(t)} is constant at ${r(n)} across the series.`;if(.04>m/(Math.abs(e.mean)||1))return`${K(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`;let g=f>0&&h-1>f,y=d>0&&h-1>d,v=(o-Math.max(n,a))/m,b=(Math.min(n,a)-i)/m;return g&&v>.15?`Overall ${t} climbs to a peak of ${r(o)} (${l}), then falls to ${r(a)} (${u}).`:y&&b>.15?`Overall ${t} drops to a low of ${r(i)} (${s}), then recovers to ${r(a)} (${u}).`:.05>Math.abs(p)/m?`${K(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`:p>0?f===h-1?`Overall ${t} rises from ${r(n)} (${c}) to a peak of ${r(a)} (${u}).`:`Overall ${t} rises from ${r(n)} (${c}) to ${r(a)} (${u}), after peaking at ${r(o)} (${l}).`:d===h-1?`Overall ${t} falls from ${r(n)} (${c}) to a low of ${r(a)} (${u}).`:`Overall ${t} falls from ${r(n)} (${c}) to ${r(a)} (${u}), after dipping to ${r(i)} (${s}).`}(x,g,o):a.has("l3")&&x&&!c&&Pt.has(e)&&(v.l3=`The highest ${y} is ${x.maxLabel} and the lowest is ${x.minLabel}.`),a.has("l4")){let n=V(t)?"alerting":z(e,r.capability);n&&(v.l4=function(e,t,r,n,a,i,o,l){let s,c,u=Et[e],d=/^[aeiou]/i.test(u)?"an":"a";switch(e){case"locating":s="This is a map",c="read values by location";break;case"presenting":s="This is a single-value display",c=`read ${"string"==typeof r.label&&r.label?r.label:a} as the headline number`;break;case"tracing":s=`This is ${d} ${u} chart`,c="follow the movement between states";break;case"nesting":s=`This is ${d} ${u} chart`,c="read it for nested structure and how children sum into their parents";break;case"relating":s=`This is ${d} ${u} chart`,c=`read it for whether ${i} and ${a} move together`;break;default:s=`This is ${d} ${u} chart`,c=function(e,t,r,n,a,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${n}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,r){if(Pt.has(r)||jt.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;let{first:n,last:a,min:i,max:o,minLabel:l,maxLabel:s,lastLabel:c,minIndex:u,maxIndex:d,count:f}=e,h=o-i;if(h>0){let e=d>0&&f-1>d,r=u>0&&f-1>u,m=(o-Math.max(n,a))/h,p=(Math.min(n,a)-i)/h;if(e&&m>.15)return`the peak of ${t(o)} at ${s} is the point to investigate`;if(r&&p>.15)return`the dip to ${t(i)} at ${l} is the point to investigate`;if(a>=o)return`the climb to ${t(a)} at ${c} warrants a closer look`;if(i>=a)return`the drop to ${t(a)} at ${c} warrants a closer look`}return`the extremes — ${s} (${t(o)}) and ${l} (${t(i)}) — are the points to check`}(t,a,i);case"tracking":return`read it for the trajectory of ${r}, which ${function(e){let t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}(t)} from ${a(t.first)} (${t.firstLabel}) to ${a(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${n}; ${t.maxLabel} leads at ${a(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${a(t.max)}`;case"apportioning":{let e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${a(e)} total; ${t.maxLabel} is the largest at ${a(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${a(t.min)} to ${a(t.max)}`;default:return"read the highlighted features"}}(e,n,a,i,o,t)}return`${s}; ${c}.${function(e,t){if(!t)return"";let r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${_(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,l)}`}(n,e,t,c?null:x,g,y,o,r.audience))}let P=["l1","l2","l3","l4"].filter(e=>a.has(e)&&v[e]).map(e=>v[e]).join(" "),j=G(t);return{text:j?`${j} ${P}`.trim():P,levels:v,...j?{annotations:j}:{}}}function K(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function J(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function W(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Q(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function X(e,t="—"){return null==e||""===e?t:"object"==typeof e?X(e.id??e.name??e.label,t):e+""}function Y(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function Z(e){return X(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function ee(e,t){let r=Q(e,t,"children");return Array.isArray(r)?r:[]}function te(e,t,r){return`${e} ${1===e?t:r}`}function re(e,t){return 0===e.numericLeaves?"":e.numericLeaves===e.leaves?", leaf total "+t(e.leafTotal):`, known leaf total ${t(e.leafTotal)} across ${te(e.numericLeaves,"valued leaf","valued leaves")}`}function ne(e){return"TreeDiagram"===e?"tree":"Treemap"===e?"treemap":"CirclePack"===e?"circle-packing":"orbit"}function ae(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function ie(e,t="—"){return null==e||""===e?t:"object"==typeof e?ie(e.id??e.name??e.label,t):e+""}function oe(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function le(e){return ie(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function se(e){let t=[];return(e.linkedHover||e.selection||e.linkedBrush)&&t.push("Use linked highlighting to compare related locations."),(e.enableHover||e.tooltip)&&t.push("Hover or focus a mark for its details."),t.length>0?" "+t.join(" "):""}function ce(e,t,r){let n=ae(e,t,r);if(void 0!==n)return n;let a=e.properties;return a&&"object"==typeof a?ae(a,t,r):void 0}function ue(e,t,r){return ie(ce(e,t,"id")??ce(e,"name","name")??ce(e,"NAME","NAME")??ce(e,"label","label"),r)}function de(e){let t=0,r=1/0,n=-1/0,a=0;for(let i of e)null!=i.value&&(t+=1,r=Math.min(r,i.value),n=Math.max(n,i.value),a+=i.value);return 0===t?null:{count:t,min:r,max:n,total:a,average:a/t}}function fe(e,t){let r=de(e);return r?`range ${t(r.min)} to ${t(r.max)}, average ${t(r.average)}, total ${t(r.total)}`:"no numeric values"}function he(e,t,r,n){let a=function(e){if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];let t=e;return Array.isArray(t.features)?t.features:"Feature"===t.type?[t]:[]}(t.areas),i="FlowMap"===e&&Array.isArray(t.nodes)?t.nodes:Array.isArray(t.points)?t.points:[],o=Array.isArray(t.flows)?t.flows:[],l=Array.isArray(t.lines)?t.lines:[],s=t.valueAccessor??t.sizeBy??t.costAccessor??"value",c=t.pointIdAccessor??t.nodeIdAccessor??"id",u=("ChoroplethMap"===e?a:i).map((r,n)=>({datum:r,index:n,label:ue(r,"ChoroplethMap"===e?t.idAccessor:c,`${"ChoroplethMap"===e?"region":"location"} ${n+1}`),value:oe(ce(r,s,"value"))})),d=u.filter(e=>null!=e.value),f={id:"root",role:"chart",level:1,label:`${"ChoroplethMap"===e?`A choropleth map with ${a.length} regions.${d.length>0?` Values are available for ${d.length} of ${a.length} regions; ${fe(d,n)}.`:" No regions have numeric values."}`:"FlowMap"===e?`A flow map with ${o.length} flows and ${i.length} locations.`:"DistanceCartogram"===e?`A distance cartogram with ${i.length} locations and ${l.length} routes.`:`A proportional-symbol map with ${i.length} locations.`}${se(t)}`,children:[]};if("ChoroplethMap"===e)f.children=function(e,t,r){let n,a=e.filter(e=>null!=e.value).sort((e,t)=>t.value-e.value||e.index-t.index),i=new Map,o=0;for(let[e,t]of a.entries())n!==t.value&&(o=e+1,n=t.value),i.set(t.index,o);let l=0;return function(e){let t=e.filter(e=>null!=e.value),r=e.filter(e=>null==e.value),n=[],a=de(t);if(a)if(a.min===a.max)n.push({id:"equal",label:"Equal values",rows:t});else{let e=a.min+(a.max-a.min)/3,r=a.min+2*(a.max-a.min)/3,i=t.filter(e=>e.value>=r),o=t.filter(t=>t.value>=e&&r>t.value),l=t.filter(t=>e>t.value);i.length>0&&n.push({id:"highest",label:"Highest values",rows:i}),o.length>0&&n.push({id:"middle",label:"Middle values",rows:o}),l.length>0&&n.push({id:"lowest",label:"Lowest values",rows:l})}return r.length>0&&n.push({id:"missing",label:"No numeric value",rows:r}),n}(e).map(e=>{let n=e.rows.slice(0,Math.max(0,t-l));l+=n.length;let o=n.map(e=>{let t=i.get(e.index),n=null==t||2>a.length?"":`, rank ${t} of ${a.length}`;return{id:`geo-${le(e.label)}-${e.index}`,role:"datum",level:3,label:null==e.value?e.label+": no numeric value.":`${e.label}: ${r(e.value)}${n}.`,...null==e.value?{}:{value:e.value},datum:e.datum}}),s=e.rows.length-n.length;return s>0&&o.push({id:`geo-${e.id}-more`,role:"datum",level:3,label:`${s} more ${1===s?"region":"regions"} in ${e.label.toLowerCase()} not shown; navigation is capped at ${t}.`}),{id:"regions-"+e.id,role:"series",level:2,label:`${e.label}: ${e.rows.length} ${1===e.rows.length?"region":"regions"}, ${fe(e.rows,r)}.`,children:o}})}(u,r,n);else if(u.length>0){let e=u.slice(0,r).map(e=>({id:`geo-${le(e.label)}-${e.index}`,role:"datum",level:3,label:`${e.label}${null==e.value?"":": "+n(e.value)}.`,...null==e.value?{}:{value:e.value},datum:e.datum}));u.length>r&&e.push({id:"geo-more",role:"datum",level:3,label:`…and ${u.length-r} more locations.`}),f.children?.push({id:"locations",role:"series",level:2,label:`Locations: ${u.length} marks.`,children:e})}let h="FlowMap"===e?o:l;if(h.length>0){let e=h.slice(0,r).map((e,t)=>{let r=ie(e.source,"unknown"),a=ie(e.target,"unknown"),i=oe(ae(e,s,"value"));return{id:`route-${le(r)}-${le(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":": "+n(i)}.`,...null==i?{}:{value:i},datum:e}});f.children?.push({id:"routes",role:"series",level:2,label:`Routes: ${h.length} ${1===h.length?"route":"routes"}.`,children:e})}return f}function me(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function pe(e,t="—"){return null==e||""===e?t:"object"==typeof e?pe(e.id??e.name??e.label,t):e+""}function ge(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function ye(e){return pe(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function ve(e,t){let r=[];return(e.linkedHover||e.selection||e.linkedBrush)&&r.push("network"===t?"Use linked highlighting to trace related marks.":"Use linked highlighting to compare related locations."),(e.enableHover||e.tooltip)&&r.push("Hover or focus a mark for its details."),r.length>0?" "+r.join(" "):""}function be(e,t){t&&e.children?.push(t)}function $e(e,t,r={}){let n=r.locale??"en",a=Math.max(1,r.maxLeaves??200),i=H(n),o=A(e,t,r.recipe);if(o)return function(e,t,r={}){let n=C(t),a=w(t),i=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:a,locale:r.locale??"en"});let o=(m=e.navigation)&&"object"==typeof m?e.navigation:void 0,l=(o?.groupByRole?x(e,o.groupByRole):void 0)??(o?.groupBy?.[0]?x(e,o.groupBy[0])??e.dataRoles.find(e=>e.field===o.groupBy?.[0]):void 0)??S(e,["nominal","ordinal"]),s=l?k(l,a,n):void 0,c=(o?.idRole?x(e,o.idRole):void 0)??S(e,["identifier"]),u=c?k(c,a,n):void 0,d={id:"root",role:"chart",label:o?.summaryTemplate?P(o.summaryTemplate,void 0,e,a,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]},f=0,h=(t,r,i)=>{let l=u?t[u]:void 0,s=o?.itemLabelTemplate?P(o.itemLabelTemplate,t,e,a,n,{count:n.length}):function(e,t,r,n){let a=S(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),o=a?k(a,r,n):void 0,l=[];o&&null!=e[o]&&l.push(e[o]+"");for(let t of i){let a=k(t,r,n);a&&null!=e[a]&&l.push(`${t.role}: ${e[a]+""}`)}return l.length>0?l.join(", "):"Data item"}(t,e,a,n);return{id:"datum-"+W(l??r),role:"datum",label:s,level:i,datum:t}};var m;if(s){let e=new Map;for(let t of n){let r=(t[s]??"Uncategorized")+"",n=e.get(r);n?n.push(t):e.set(r,[t])}d.children=[...e].map(([e,t],r)=>{let n=t.slice(0,Math.max(0,i-f));f+=n.length;let a=n.map((e,t)=>h(e,1e5*r+t,3));return t.length>n.length&&a.push({id:"more-"+W(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+W(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:a}})}else{let e=n.slice(0,i);d.children=e.map((e,t)=>h(e,t,2)),n.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return d}(o,t,{maxLeaves:a,locale:n});let l={id:"root",role:"chart",label:U(e,t,{locale:n}).text||"Chart.",level:1,children:[]},s=function(e,t){let r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;let n=et(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let a=0,i=n.slice(0,t).map(e=>{let t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${n=q(e),n&&n.charAt(0).toUpperCase()+n.slice(1)}${r}.`,datum:e};var n});n.length>t&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});let o=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===o?"one marked feature":o+" marked features"}.`,children:i}}(t,a);if(Ht.has(e)){let r=function(e,t,r,n){let a=Array.isArray(t.nodes)?t.nodes:[],i=Array.isArray(t.edges)?t.edges:Array.isArray(t.flows)?t.flows:[],o=t.nodeIdAccessor??t.nodeIDAccessor,l=t.sourceAccessor??"source",s=t.targetAccessor??"target",c=t.valueAccessor??"value",u=e=>pe(me(e,o,"id"),"unknown"),d=(e,t)=>pe(me(e,t,""),"unknown"),f=new Set;for(let e of i)f.add(d(e,l)),f.add(d(e,s));let h=a.length>0?a:[...f].map(e=>({id:e})),m=new Map;for(let e of h)m.set(u(e),{links:0,value:0});for(let e of i){let t=d(e,l),r=d(e,s),n=ge(me(e,c,"value"))??0;for(let e of[t,r]){let t=m.get(e)??{links:0,value:0};t.links+=1,t.value+=n,m.set(e,t)}}let p={id:"root",role:"chart",level:1,label:`A ${"SankeyDiagram"===e||"ProcessSankey"===e?"flow diagram":"ChordDiagram"===e?"chord diagram":"network graph"} with ${h.length} nodes and ${i.length} links.${ve(t,"network")}`,children:[]},g=0,y=new Map,v=t.colorBy??"group";for(let e of h){let t=pe(me(e,v,"group"),"Ungrouped"),r=y.get(t);r?r.push(e):y.set(t,[e])}let b=[...y].map(([e,t],a)=>{let i=[];for(let[e,o]of t.entries()){if(g>=r)break;g+=1;let t=u(o),l=m.get(t)??{links:0,value:0},s=l.value>0?`, ${n(l.value)} total flow`:"";i.push({id:`node-${a}-${e}-${ye(t)}`,role:"datum",level:3,label:`${t}: ${l.links} ${1===l.links?"link":"links"}${s}.`,value:l.value>0?l.value:void 0,datum:o})}return{id:`nodes-${a}-${ye(e)}`,role:"series",level:2,label:`${e}: ${t.length} ${1===t.length?"node":"nodes"}.`,children:i}});b.length>0&&p.children?.push(...b);let $=i.slice(0,r).map((e,t)=>{let r=d(e,l),a=d(e,s),i=ge(me(e,c,"value"));return{id:`link-${ye(r)}-${ye(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":": "+n(i)}.`,value:i,datum:e}});return i.length>r&&$.push({id:"links-more",role:"datum",level:3,label:`…and ${i.length-r} more links.`,value:void 0}),$.length>0&&p.children?.push({id:"links",role:"series",level:2,label:`Links: ${i.length} ${1===i.length?"connection":"connections"}.`,children:$}),p}(e,t,a,i);return be(r,s),r}if(qt.has(e)){let r=function(e,t,r,n){let a=t.data&&"object"==typeof t.data?t.data:null,i=t.childrenAccessor??"children",o=t.valueAccessor??"value",l=t.nodeLabel??t.nodeIdAccessor,s=new WeakMap,c=new WeakSet,u=e=>{let t=s.get(e);if(t)return t;if(c.has(e))return{descendants:0,depth:0,leaves:0,numericLeaves:0,leafTotal:0};c.add(e);let r,n=ee(e,i);if(0===n.length){let t=Y(Q(e,o,"value"));r={descendants:0,depth:1,leaves:1,numericLeaves:null==t?0:1,leafTotal:t??0}}else r=n.reduce((e,t)=>{let r=u(t);return{descendants:e.descendants+1+r.descendants,depth:Math.max(e.depth,r.depth+1),leaves:e.leaves+r.leaves,numericLeaves:e.numericLeaves+r.numericLeaves,leafTotal:e.leafTotal+r.leafTotal}},{descendants:0,depth:1,leaves:0,numericLeaves:0,leafTotal:0});return c.delete(e),s.set(e,r),r},d=0,f=(e,t,a,s)=>{let c=X(Q(e,l,"name"),"item "+a);if(s.has(e))return{id:`hierarchy-${Z(a)}-cycle`,role:"datum",level:t,label:`Repeated hierarchy reference to ${c}; branch omitted.`};let h=ee(e,i),m=u(e);if(0===h.length){if(d>=r)return null;d+=1;let i=Y(Q(e,o,"value"));return{id:`hierarchy-${Z(a)}-${Z(c)}`,role:"datum",level:t,label:`${c}${null==i?"":": "+n(i)}.`,...null==i?{}:{value:i},datum:e}}let p=new Set(s);p.add(e);let g=[],y=0;for(let[e,n]of h.entries()){if(d>=r){y+=u(n).leaves;continue}let i=f(n,t+1,`${a}-${e}`,p);i&&g.push(i)}return y>0&&g.push({id:`hierarchy-${Z(a)}-more`,role:"datum",level:t+1,label:`${te(y,"more leaf","more leaves")} in ${c} not shown; navigation is capped at ${r}.`}),{id:`hierarchy-${Z(a)}-${Z(c)}`,role:"series",level:t,label:`${c}: ${te(h.length,"direct child","direct children")}, ${te(m.descendants,"total descendant","total descendants")}, ${te(m.leaves,"leaf","leaves")}${re(m,n)}.`,datum:e,children:g}},h=a?u(a):null,m={id:"root",role:"chart",level:1,label:a?`A ${ne(e)} chart with ${te(h.leaves,"leaf","leaves")} and ${te(h.descendants,"total descendant","total descendants")} across ${te(h.depth,"hierarchy level","hierarchy levels")}${re(h,n)}.`:"A hierarchy chart with no hierarchy data loaded.",children:[]};if(a){let e=f(a,2,"root",new Set);if(e){let t=X(Q(a,l,"name"),"");m.children="series"===e.role&&""===t?e.children:[e]}}return m}(e,t,a,i);return be(r,s),r}if(Gt.has(e)){let r=he(e,t,a,i);return be(r,s),r}let c=Array.isArray(t.data)?t.data:null,u=function(e,t={},r={}){return!!A(e,t,r.recipe)||Ht.has(e)||qt.has(e)||Gt.has(e)||St.has(e)||Pt.has(e)||jt.has(e)||It.has(e)}(e,t,r);if(!c||0===c.length||!u)return s&&(l.children=[s]),l;let{measure:d,measureFallback:f,dimension:h,dimensionFallback:m}=D(e,t),p=ct(d,f),g=dt(h,m),y="string"==typeof d&&d?d:f,v="string"==typeof h&&h?h:m,b=L(t),$=0,j=e=>`${e}-${$++}`,I=(e,t)=>{let r=e.slice(0,a).map(e=>((e,t)=>{let r=p(e),n=N(g(e),i);return{id:j("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(r)?i(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}})(e,t));return e.length>a&&r.push({id:j("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),r},M=[];if(St.has(e)||Pt.has(e)){let t=1/0,r=-1/0,n=1/0,a=-1/0,o=[],l=!0;for(let e of c){let i=p(e);Number.isFinite(i)&&(t>i&&(t=i),i>r&&(r=i));let s=g(e);o.push(s),"number"==typeof s&&Number.isFinite(s)?(n>s&&(n=s),s>a&&(a=s)):l=!1}let s=new Set,u=[];for(let e of o){let t=e+"";s.has(t)||(s.add(t),u.push(e))}let d=l?`${i(n)} to ${i(a)}`:`${N(u[0],i)} to ${N(u[u.length-1],i)} (${Pt.has(e)?u.length+" categories":c.length+" points"})`;M.push({id:j("axis"),role:"axis",level:2,label:`${Pt.has(e)?"Category axis":"X axis"}: ${v}, ${d}.`}),r>=t&&M.push({id:j("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(r)}.`})}if(b){let r=dt(b,b),a=new Map;for(let e of c){let t=(r(e)??"—")+"",n=a.get(t);n?n.push(e):a.set(t,[e])}let i=[];for(let[r,o]of a){let a=U(e,{...t,data:o},{levels:["l2","l3"],locale:n}).text;i.push({id:j("series"),role:"series",level:2,label:`Series ${r}: ${a}`,children:I(o,3)})}l.children=[...M,...i]}else l.children=[...M,...I(c,2)];return s&&l.children.push(s),l}function we(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ce(e){return we(e)?e:void 0}function Ae(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function ke(e){let t=Ae(e);return null==t?void 0:Math.max(0,Math.floor(t))}function xe(...e){return e.map(Ce).find(Boolean)}function Se(...e){return e.find(Array.isArray)}function Pe(e){let t={};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);return t}function je(e,t,r){return e["string"==typeof t&&t?t:r]}function Ie(e){return e instanceof Date?e.toISOString():"number"==typeof e?Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+"":(e??"—")+""}function Me(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Re(e){return Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+""}function Oe(e,t,r){let n=e?.filter(e=>!0===Ce(e)?.sensor).length,a=Ce(t?.observation),i=Ce(a?.sensors),o=Se(r?.activeSensors);return Math.max(n??0,i?Object.keys(i).length:0,o?.length??0)||void 0}function Fe(e,t,r={}){let n,{capability:a,audience:i,locale:o}=r,l=r.levels??["l1","l2","l3"],s=!1!==r.includeStructure,c=z(e,a),u=U(e,t,{levels:c?[...l,"l4"]:l,locale:o,capability:a,audience:i}),{l4:d,...f}=u.levels,h=["l1","l2","l3"].map(e=>u.levels[e]).filter(Boolean).join(" "),m={levels:f,text:u.annotations?`${u.annotations} ${h}`.trim():h,...u.annotations?{annotations:u.annotations}:{}};if(c&&d){let e=(p=a)?"fits"in p||"buildProps"in p?{family:p.family}:{family:p.family,intentScores:p.intentScores}:{};n={act:c,sentence:d,family:e.family,intentScores:e.intentScores}}var p;let g=s?$e(e,t,{maxLeaves:r.maxLeaves,locale:o}):void 0,y=function(e,t,r){if(!1===r)return;let n=we(r)?r:void 0,a=Ce(t.physics),i=xe(n?.snapshot,a?.snapshot,t.physicsSnapshot,function(e){let t=Ce(e);return!!t&&(we(t.world)||"simulationState"in t||"liveBodyOrder"in t)}(t.snapshot)?t.snapshot:void 0),o=xe(n?.evidence,a?.evidence,t.physicsEvidence,t.settledEvidence),l=xe(n?.config,a?.config,i?.config,t.config),s=xe(Ce(i?.world),Ce(a?.world)),c=xe(Ce(l?.kernel),Ce(s?.options)),u=Se(s?.bodies),d=Se(s?.colliders,l?.colliders),f=Se(i?.queue,a?.queue),h=Se(i?.liveBodyOrder),m=Se(s?.springs),p=Se(i?.activeSensorPairs),g=function(e){if(!e||0===e.length)return;let t=e.map((e,t)=>{let r=Ce(e);if(!r)return;let n=Ae(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return;let a=(r.label??r.id??r.name??"container "+(t+1))+"",i=null==r.id?void 0:r.id+"",o=Ae(r.secondary??r.secondaryCount),l=Ae(r.observed??r.observedCount);return Pe({id:i,label:a,count:n,secondary:o,secondaryLabel:"string"==typeof r.secondaryLabel?r.secondaryLabel:void 0,observed:l})}).filter(e=>null!=e);if(0===t.length)return;let r=t.reduce((e,t)=>e+t.count,0),n=t.filter(e=>e.count>0).length,a=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:r,populatedCount:n,...a?{leader:a}:{}}}(function(e,t,r,n){let a=Ce(e.settledProjection),i=Ce(t?.settledProjection);return Se(r?.projectionRows,r?.aggregates,e.settledProjectionRows,e.projectionRows,a?.rows,t?.settledProjectionRows,t?.projectionRows,i?.rows,n?.binCounts)}(t,a,n,o)),y=function(e,t){let r=e?.map((e,t)=>{let r=Ce(e);if(!r)return;let n=Ae(r.count)??0,a=Ae(r.total),i={label:(r.label??r.id??"sediment "+(t+1))+"",count:n};return null!=r.id&&(i.id=r.id+""),null!=a&&(i.total=a),i}).filter(e=>null!=e),n=ke(t?.bins)??r?.length??0,a=Ae(t?.count)??r?.reduce((e,t)=>e+t.count,0)??0,i=Ae(t?.total)??r?.reduce((e,t)=>e+(t.total??0),0),o=r?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==n||0!==a||i)return{bins:n,count:a,...null!=i&&i>0?{total:i}:{},...o?{leader:o}:{}}}(Se(n?.sediment,a?.sediment,i?.sediment),xe(n?.sedimentTotals,a?.sedimentTotals)),v=h?.length??u?.length??ke(o?.bodyCount),b=function(e){if(e)return e.filter(e=>!0===Ce(e)?.sleeping).length}(u)??ke(o?.sleepingCount),$=f?.length,w="string"==typeof i?.simulationState?i.simulationState:void 0,C="boolean"==typeof o?.settled?o.settled:w?"settled"===w:null!=v||null!=b||null!=$?null!=v&&b===v&&0===($??0):void 0,A=Ce(c?.gravity),k=Ae(A?.x),x=Ae(A?.y),S=Pe({state:w,settled:C,elapsedSeconds:Ae(i?.elapsedSeconds),paused:"boolean"==typeof i?.paused?i.paused:void 0,visible:"boolean"==typeof i?.visible?i.visible:void 0,seed:Ae(c?.seed),gravity:null!=k&&null!=x?{x:k,y:x}:void 0,fixedDt:Ae(l?.fixedDt??c?.fixedDt),timeScale:Ae(l?.timeScale),maxSubsteps:ke(l?.maxSubsteps),liveBodies:v,sleepingBodies:b,queued:$,bodyLimit:Ae(l?.bodyLimit),eviction:"string"==typeof l?.eviction?l.eviction:void 0}),P=Pe({colliders:d?.length,sensors:Oe(d,l,s),springs:m?.length,activeSensorPairs:p?.length}),j=Object.keys(P).length>0,I=Ut.has(e);if(!(Object.keys(S).length>0||j||g||y)||!I&&null==r)return;let M={simulation:S,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},R=function(e){let t=[],r=e.simulation,n=[r.state??(r.settled?"settled":void 0),null!=r.liveBodies?`${r.liveBodies} live ${Me(r.liveBodies,"body")}`:void 0,null!=r.sleepingBodies?r.sleepingBodies+" sleeping":void 0,null!=r.queued?r.queued+" queued":void 0,null!=r.seed?"seed "+Re(r.seed):void 0,r.gravity?`gravity (${Re(r.gravity.x)}, ${Re(r.gravity.y)})`:void 0,null!=r.fixedDt?`fixed step ${Re(r.fixedDt)}s`:void 0,null!=r.timeScale?Re(r.timeScale)+"x time":void 0].filter(Boolean);n.length>0&&t.push(`Physics simulation: ${n.join("; ")}.`);let a=e.geometry;if(a){let e=[null!=a.colliders?`${a.colliders} ${Me(a.colliders,"collider")}`:void 0,null!=a.sensors?`${a.sensors} ${Me(a.sensors,"sensor")}`:void 0,null!=a.springs?`${a.springs} ${Me(a.springs,"spring")}`:void 0,null!=a.activeSensorPairs?`${a.activeSensorPairs} active sensor ${Me(a.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}let i=e.aggregates;if(i){let e=i.leader,r=e?` Largest is ${e.label} with ${Re(e.count)}.`:"";t.push(`Physics aggregates: ${Re(i.totalCount)} settled ${Me(i.totalCount,"body")} across ${i.rows.length} ${Me(i.rows.length,"container")}; ${i.populatedCount} populated.${r}`)}let o=e.sediment;if(o){let e=null!=o.total?", value total "+Re(o.total):"",r=o.leader?`; largest sediment bin is ${o.leader.label} with ${Re(o.leader.count)}`:"";t.push(`Physics sediment: ${o.count} retained ${Me(o.count,"body")} in ${o.bins} ${Me(o.bins,"bin")}${e}${r}.`)}return t.join(" ")}(M);return{...M,text:R}}(e,t,r.physics),v=function(e,t,r){let n=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&n.push(`Current value is ${Ie(t.value)}.`);let e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,r="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;n.push(`The gauge scale runs from ${Ie(e)} to ${Ie(r)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){let a=Array.isArray(t.edges)?t.edges:[];if("ProcessSankey"===e&&Array.isArray(t.domain)&&2===t.domain.length&&n.push(`The ProcessSankey time domain runs from ${Ie(t.domain[0])} to ${Ie(t.domain[1])}.`),a.length>0){n.push(`${a.length} source flow${1===a.length?"":"s"} are supplied.`);for(let i of a.slice(0,r)){let r=je(i,t.sourceAccessor,"source"),a=je(i,t.targetAccessor,"target"),o=je(i,t.valueAccessor,"value");n.push("ProcessSankey"!==e||null==i.startTime&&null==i.endTime?`${Ie(r)} to ${Ie(a)} has value ${Ie(o)}.`:`${Ie(r)} to ${Ie(a)} has value ${Ie(o)} over ${Ie(i.startTime)}–${Ie(i.endTime)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){let e=Ce(t.data),a="string"==typeof t.childrenAccessor&&t.childrenAccessor?t.childrenAccessor:"children",i="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",o="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",l=[],s=e=>{let t=Array.isArray(e[a])?e[a]:[];if(0!==t.length)for(let e of t){let t=Ce(e);t&&s(t)}else l.push(e)};if(e&&s(e),l.length>0){n.push(l.length+" hierarchy leaves are supplied.");for(let e of l.slice(0,r))n.push(`${Ie(e[o])} has value ${Ie(e[i])}.`)}}if(Ut.has(e)&&Array.isArray(t.data)){let r=t.data;n.push(`${r.length} observed source row${1===r.length?"":"s"} are supplied.`);let a="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,i="CollisionSwarmChart"===e?"x":"value",o=r.map(e=>Ae(je(e,a,i))).filter(e=>null!=e);o.length>0&&n.push(`Observed ${"string"==typeof a?a:i} ranges from ${Ie(Math.min(...o))} to ${Ie(Math.max(...o))}.`)}if(0!==n.length)return{source:"chart-props",statements:n,text:"Exact chart-prop facts: "+n.join(" ")}}(e,t,Math.max(1,r.maxLeaves??200)),b=[m.text,n?.sentence,y?.text,v?.text].filter(Boolean).join(" ");return{component:e,description:m,intent:n,structure:g,physics:y,facts:v,text:b}}function De(e,t){let r=e.trim();if(!r)throw Error(t+" must be a non-empty string.");return encodeURIComponent(r)}function Le(e,...t){return`${e}/${t.map(e=>De(e,"VACP ref segment")).join("/")}`}function Ne(e){let t=e.now?.()??new Date,r=t instanceof Date?t:new Date(t);if(!Number.isFinite(r.getTime()))throw Error("VACP bridge clock returned an invalid date.");return r.toISOString()}function Ee(e){try{let{createdAt:t,...n}=function(e,t,r){if(r?.selections&&it(r.selections).length>0)throw new TypeError("Serialized selection state must contain only values that survive JSON serialization unchanged.");let n=v(e)??b(t.recipe)??b(t.recipeId);if(n)return function(e,t,r){let n=!1!==r?.includeData,a=it(e);if("portable"===e.portability&&a.length>0)throw Error(`Portable recipe "${e.id}" has non-JSON definition values at: ${a.join(", ")}.`);let i=function(e,t,r){let n={};for(let[a,i]of Object.entries(e))if(null!=i&&!At.has(a)&&"recipeId"!==a&&(t||!F(a,i))){if("function"==typeof i){if(r)throw Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}if(it(i).length>0){if(r)throw Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}O(n,a,xt(i))}return n}(t,n,"portable"===e.portability),o=e.intents.map($).filter(e=>!!e),l=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.id?e.layout.id:void 0,s=l?function(e){let t=y().layouts.get(e)?.identity;return t?{...t}:void 0}(l):void 0,c=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.version&&e.layout.version?{version:e.layout.version,...e.layout.fingerprint?{fingerprint:e.layout.fingerprint}:{}}:void 0;if(s&&c&&(s.version!==c.version||s.fingerprint!==c.fingerprint))throw Error(`Recipe layout "${l}" registry identity does not match its portable declaration.`);let u=s??c;if("portable"===e.portability&&l&&!u)throw Error(`Portable recipe layout "${l}" must be registered with an explicit version identity.`);let d={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily,...e.version?{recipeVersion:e.version}:{},...0===a.length?{definitionFingerprint:tt(e).fingerprint}:{},...l?{layoutId:l}:{},...u?{layoutVersion:u.version}:{},...u?.fingerprint?{layoutFingerprint:u.fingerprint}:{}},f=(new Date).toISOString();if("portable"===e.portability){if(it(i).length>0)throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);let n={version:Ct,createdAt:f,recipeId:e.id,portable:!0,manifest:d,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:i,manifest:d,version:Ct,createdAt:f,...R("ChartRecipe",r?.artifactContract,t,i,n),...r?.selections?{selections:r.selections}:{}}}let h="Recipe contains or may depend on non-serializable local layout callbacks.",m=["This config is inspectable but cannot be rendered remotely by CLI or MCP."],p={version:Ct,createdAt:f,recipeId:e.id,portable:!1,manifest:d,reason:h,warnings:m,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:h,warnings:m,props:i,manifest:d,version:Ct,createdAt:f,...R("ChartRecipe",r?.artifactContract,t,i,p),...r?.selections?{selections:r.selections}:{}}}(n,t,r);if(!function(e){return $t.has(e)}(e))throw Error(`Unknown component "${e}". Known components: ${bt.join(", ")}`);let a=!1!==r?.includeData,i={};for(let[e,r]of Object.entries(t))if(null!=r&&!At.has(e)&&(a||!F(e,r))&&"function"!=typeof r&&0>=it(r).length)try{O(i,e,xt(r))}catch{}let o=(new Date).toISOString(),l={version:Ct,createdAt:o,...r?.selections?{selections:r.selections}:{}};return{component:e,props:i,version:Ct,createdAt:o,...R(e,r?.artifactContract,t,i,l),...r?.selections?{selections:r.selections}:{}}}(e.component,e.props,{includeData:!1});return r(n)}catch(r){let n=Object.create(null);for(let[r,a]of Object.entries(e.props)){if(Kt.includes(r)||"function"==typeof a)continue;let e=t(a);void 0!==e&&(n[r]=e)}return{component:e.component,props:n,version:"unregistered",warning:r instanceof Error?r.message:"Chart config could not be serialized by toConfig."}}}function Te(e){return Fe(e.component,e.props,{...e.grounding,audience:e.audience,includeStructure:!0,maxLeaves:1})}function Be(e,t){let r=[];for(let n of Kt){let a=e.props[n];Array.isArray(a)&&r.push({ref:t.data(e.chartId,n),chartId:e.chartId,collection:n,rows:a})}return r}function _e(e,t){t(e);for(let r of e.children??[])_e(r,t)}function ze(e,t){if(!t)return;let r;return _e(e,e=>{!r&&e.id===t&&(r=e)}),r}function Ve(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function He(e,t){if("datum"!==e.role||!e.datum)return;let r=Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e.datum,n)||!Ve(e.datum[n]))return;r[n]=e.datum[n]instanceof Date?e.datum[n].toISOString():e.datum[n]}return r}function qe(e,t){let r=Array.from(new Set(e.matchFields.map(e=>e.trim()).filter(Boolean))),n=new Map;if(!r.length)return{valid:!1,diagnostic:"Navigation actions require at least one durable match field.",byKey:n,matchFields:r,targetRef:()=>Le(t,"target","invalid")};let a,o=0,l=0,s=!1;return _e(e.tree,e=>{if("datum"!==e.role)return;o++;let t=He(e,r);if(!t)return void l++;let a=i(t);n.has(a)?s=!0:n.set(a,e)}),o?l?a=l+" navigation leaves lack durable primitive match-field values.":s&&(a="Navigation match fields do not uniquely identify every datum leaf."):a="Navigation tree has no datum leaves.",{valid:!a,...a?{diagnostic:a}:{},byKey:n,matchFields:r,targetRef:e=>Le(t,"target",i(e))}}function Ge(t,n){let{chart:a,ref:i,configRef:o,grounding:l}=t,s=[{ref:i,kind:"Visualization",layer:"VisualizationLayer",title:a.title??(a.props.title??a.component)+"",description:a.description??l.text,data:r({component:a.component,grounding:{description:l.description,intent:l.intent,physics:l.physics,text:l.text},audience:a.audience})},{ref:o,kind:"Param",layer:"ConfigLayer",title:a.component+" configuration",description:"Serializable Semiotic chart configuration with raw data collections omitted.",data:t.config}],c=[{from:t.ref,to:o,kind:"contains"}],u=(l.structure?.children??[]).filter(e=>"axis"===e.role).map(e=>e.label),d=0;for(let[e,t]of Jt){let r=a.props[e];if("string"!=typeof r||!r.trim())continue;let n=Le(i,"encoding",t);if(s.push({ref:n,kind:"EncodingChannel",layer:"VisualizationLayer",title:`${t} → ${r}`,data:{channel:t,field:r,accessorProp:e}}),c.push({from:i,to:n,kind:"contains"}),"x"===t||"y"===t||"category"===t||"value"===t||"ordinal"===t||"radial"===t){let e=Le(i,"axis",t);s.push({ref:e,kind:"Axis",layer:"VisualizationLayer",title:u[d++]??`${t} axis: ${r}`,data:{channel:t,field:r}}),c.push({from:i,to:e,kind:"contains"}),c.push({from:e,to:n,kind:"derivedFrom"})}}for(let e of t.dataHandles)s.push({ref:e.ref,kind:"DataHandle",layer:"DataLayer",title:`${a.chartId}.${e.collection}`,description:"Bounded details-on-demand handle. Use vacp.data_schema before requesting an opt-in sample.",data:{collection:e.collection,rowCount:e.rows.length,schemaAction:vt,...n.dataAccess?.sample?{inspectAction:gt}:{}}}),c.push({from:i,to:e.ref,kind:"contains"});if(t.navigation){let{navigation:e}=t;s.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:(a.title??a.component)+" structured navigation",description:e.index.diagnostic??"Active accessible-navigation target identified by durable datum fields.",data:{matchFields:e.index.matchFields,targetCount:e.index.byKey.size,status:e.index.valid?e.binding.onActiveChange?"actionable":"read-only":"ambiguous"}}),c.push({from:i,to:e.ref,kind:"contains"})}if(n.getObservations){let e=Le(i,"interaction","latest-observation");s.push({ref:e,kind:"InteractionTarget",layer:"InteractionFeedbackLayer",title:(a.title??a.component)+" latest observation",description:"Latest semantic hover, focus, selection, brush, activation, or control observation."}),c.push({from:i,to:e,kind:"contains"})}let f=Array.isArray(a.props.annotations)?a.props.annotations:[],h=new Set;for(let t of f){if(!e(t))continue;let n=e(t.provenance)?t.provenance:void 0,o=t.id??t.stableId??n?.stableId,l=null==o||""===o?void 0:o+"";if(!l)continue;let u=e(t.note)?t.note:void 0,d=e(t.noteData)?t.noteData:void 0,f=Le(i,"annotation",l);if(h.has(f))throw Error(`Duplicate stable annotation id "${l.trim()}" in VACP chart "${a.chartId}".`);h.add(f),s.push({ref:f,kind:"InteractionTarget",layer:"VisualizationLayer",title:(t.label??u?.label??d?.label??"Annotation "+l)+"",description:"string"==typeof t.note?t.note:"string"==typeof t.description?t.description:void 0,data:r({id:l,provenance:n,lifecycle:t.lifecycle})}),c.push({from:i,to:f,kind:"contains"})}return{nodes:s,edges:c}}function Ue(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.chartId===t)return n}}function Ke(e,t){let r=function(e,t){let r=function(e){let t="function"==typeof e?e():e,r=new Set;for(let e of t){let t=e.chartId.trim();if(!t)throw Error("Every VACP chart requires a non-empty chartId.");if(r.has(t))throw Error(`Duplicate VACP chartId "${t}".`);r.add(t)}return t}(e.charts).map(e=>{let r=t.visualization(e.chartId),n=e.navigation?{ref:t.navigation(e.chartId),chartRef:r,chartId:e.chartId,binding:e.navigation,index:qe(e.navigation,t.navigation(e.chartId))}:void 0;return{chart:e,ref:r,configRef:t.config(e.chartId),grounding:Te(e),config:Ee(e),dataHandles:Be(e,t),...n?{navigation:n}:{}}}),n=function(e,t){let r=new Map;for(let t of e)for(let e of t.chart.selections??[]){let n=e.name.trim();if(!n)throw Error("VACP selection names must be non-empty.");let a=r.get(n)??{fields:new Set,modes:new Set,chartRefs:new Set};for(let t of e.fields.map(e=>e.trim()))t&&a.fields.add(t);if("interval"!==e.mode&&a.modes.add("point"),"point"!==e.mode&&a.modes.add("interval"),e.clientId){if(a.clientId&&a.clientId!==e.clientId)throw Error(`Selection "${n}" declares conflicting VACP clientIds.`);a.clientId=e.clientId}a.chartRefs.add(t.ref),r.set(n,a)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,r])=>{if(0===r.fields.size)throw Error(`Selection "${e}" requires at least one allowlisted field.`);return{ref:t.selection(e),name:e,fields:Array.from(r.fields).sort(),modes:r.modes,clientId:r.clientId??"__semiotic-vacp__:"+e,chartRefs:Array.from(r.chartRefs)}})}(r,t),a=r.flatMap(e=>e.dataHandles),i=[{ref:t.app,kind:"App",layer:"ViewLayer",title:e.title??e.appId,description:"Semiotic application state exposed through the experimental VACP 0.1.0 bridge.",data:{provider:"semiotic",protocol:yt}},{ref:t.view,kind:"View",layer:"ViewLayer",title:e.title??e.viewId??"Semiotic charts"}],o=[{from:t.app,to:t.view,kind:"contains"}];for(let n of r){let r=Ge(n,e);i.push(...r.nodes),o.push(...r.edges),o.push({from:t.view,to:n.ref,kind:"contains"})}for(let e of n){i.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:"Selection: "+e.name,description:"Named LinkedCharts selection. Agent mutations are restricted to declared fields and modes.",data:{name:e.name,fields:e.fields,modes:Array.from(e.modes).sort()}}),o.push({from:t.view,to:e.ref,kind:"contains"});for(let t of e.chartRefs)o.push({from:e.ref,to:t,kind:"controls"})}return{charts:r,selections:n,dataHandles:a,nodes:i,edges:o}}(e,t);return{...r,actions:g(r,e,t)}}function Je(e){let n=e.viewId?.trim()||"main",a=function(e,t){let r="vacp://"+De(e,"appId"),n=Le(r,"view",t),a=e=>Le(n,"visualization",e);return{app:r,view:n,visualization:a,config:e=>Le(a(e),"config"),data:(e,t="data")=>Le(a(e),"data",t),selection:e=>Le(n,"selection",e),navigation:e=>Le(a(e),"navigation"),observation:e=>Le(a(e),"interaction","latest-observation")}}(e.appId,n),l="number"==typeof e.stateCacheSize&&Number.isFinite(e.stateCacheSize)?Math.max(1,Math.floor(e.stateCacheSize)):64,u=new Map;return{version:yt,refs:a,getCapabilities:t=>{let r=Ke(e,a),n={version:yt,createdAt:Ne(e),graph:{version:yt,nodes:r.nodes,edges:r.edges,actions:r.actions.map(e=>e.descriptor)}};return t?function(e,t){let r=function(e){return{refs:o(e.refs),prefixes:o(e.prefixes),kinds:e.kinds?.length?new Set(e.kinds):void 0,layers:e.layers?.length?new Set(e.layers):void 0,includeActions:!1!==e.includeActions,includeEdges:!1!==e.includeEdges,includeNodeData:!1!==e.includeNodeData}}(t),n=e.graph.nodes.filter(e=>function(e,t){return!((t.refs?.length||t.prefixes?.length)&&!t.refs?.includes(e.ref)&&!t.prefixes?.some(t=>e.ref===t||e.ref.startsWith(t+"/")))&&(!t.kinds||t.kinds.has(e.kind))&&(!t.layers||t.layers.has(e.layer))}(e,r)).map(e=>{if(r.includeNodeData)return e;let{data:t,...n}=e;return n}),a=new Set(n.map(e=>e.ref)),i=r.includeActions?e.graph.actions.filter(e=>{if(!e.targetRef||a.has(e.targetRef))return!0;for(let t of a)if(t.startsWith(e.targetRef+"/"))return!0;return!1}):[];return{version:e.version,createdAt:e.createdAt,graph:{version:e.graph.version,nodes:n,edges:r.includeEdges?e.graph.edges.filter(e=>a.has(e.from)&&a.has(e.to)):[],actions:i}}}(n,t):n},getState:async function(t){let n=function(e,t,n){let a={},i={},o=t.getSelections?.()??{},l=t.getObservations?.()??[];for(let o of e.charts){a[o.ref]=r({component:o.chart.component,description:o.grounding.description,intent:o.grounding.intent,physics:o.grounding.physics,audience:o.chart.audience}),a[o.configRef]=o.config,i[o.ref]={component:o.chart.component,dataHandles:o.dataHandles.length};for(let e of o.dataHandles)a[e.ref]={kind:"DataHandle",collection:e.collection,rowCount:e.rows.length},i[e.ref]={rowCount:e.rows.length};if(o.navigation){let e=ze(o.navigation.binding.tree,o.navigation.binding.activeId),t=e?He(e,o.navigation.index.matchFields):void 0;a[o.navigation.ref]=r({kind:"Selection",status:o.navigation.index.valid?"ready":"ambiguous",activeRole:e?.role,activeLabel:e?.label,activeMatch:t,activeTargetRef:t?o.navigation.index.targetRef(t):void 0,diagnostic:o.navigation.index.diagnostic}),i[o.navigation.ref]={targetCount:o.navigation.index.byKey.size}}if(t.getObservations){let e=Ue(l,o.chart.chartId);a[n.observation(o.chart.chartId)]=e?r(e):null,e&&(i[n.observation(o.chart.chartId)]={type:e.type,timestamp:e.timestamp})}}for(let t of e.selections){let e=o[t.name];a[t.ref]=(e?r(e):void 0)??{name:t.name,resolution:"union",clauses:[]},i[t.ref]={active:!!e?.clauses.length,clauseCount:e?.clauses.length??0,fields:t.fields}}return{version:yt,createdAt:Ne(t),state:a,...Object.keys(i).length?{summary:i}:{}}}(Ke(e,a),e,a);if(!t)return n;let o,{snapshot:d,refs:f}=s(n,t),h="st_"+i({state:(p=d).state,...p.summary?{summary:p.summary}:{}}),m=t.since?u.get(t.since):void 0;var p;if("full"!==t.mode&&t.since&&m){let e=s(m,t).snapshot;o={version:yt,createdAt:d.createdAt,mode:"delta",token:h,baseToken:t.since,...f?{scope:{refs:f}}:{},delta:c(e,d)}}else o={version:yt,createdAt:d.createdAt,mode:"full",token:h,...f?{scope:{refs:f}}:{},snapshot:d};return((e,t)=>{for(u.has(e)&&u.delete(e),u.set(e,t);u.size>l;){let e=u.keys().next().value;if("string"!=typeof e)break;u.delete(e)}})(h,n),o},execute:async r=>{let n=r&&"string"==typeof r.callId?r.callId:"";try{if(!r||"string"!=typeof r.name||!r.name.trim())throw Error("VACP action call requires a non-empty name.");if(!n)throw Error("VACP action call requires a callId.");let i=Ke(e,a),o=i.actions.find(e=>e.descriptor.name===r.name);if(!o)return{callId:n,ok:!1,error:{message:`Unknown or currently unavailable VACP action "${r.name}".`,details:{available:i.actions.map(e=>e.descriptor.name)}}};let l=t(await o.execute(r.params));return{callId:n,ok:!0,...void 0!==l?{result:l}:{}}}catch(e){return{callId:n,ok:!1,error:{message:e instanceof Error?e.message:"VACP action failed."}}}}}}function We(e,t={}){let r=t.globalKey?.trim()||"__vacp",n=t.target??("u">typeof window?window:void 0);if(!n)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to install "${r}" without a browser window or an explicit target.`,cleanup:()=>!1};if("__proto__"===r||"prototype"===r||"constructor"===r)return{installed:!1,globalKey:r,bridge:e,reason:`Refused unsafe global key "${r}".`,cleanup:()=>!1};let a=n[r];if(void 0!==a&&a!==e)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to replace existing global "${r}".`,cleanup:()=>!1};try{n[r]=e}catch(t){return{installed:!1,globalKey:r,bridge:e,reason:t instanceof Error?`Could not install "${r}": ${t.message}`:`Could not install "${r}".`,cleanup:()=>!1}}return{installed:!0,globalKey:r,bridge:e,cleanup:()=>{if(n[r]!==e)return!1;try{return delete n[r]}catch{return!1}}}}import{artifactConfigurationValue as Qe,artifactDataValue as Xe,compareArtifactIdentity as Ye,createPhysicsSourceState as Ze,filterAnnotationsByStatus as et,fingerprintValue as tt,finiteNumber as rt,generateGaltonMechanicalSamples as nt,generatePhysicsPileMechanicalSamples as at,nonJsonValuePaths as it,normalizedFiniteExtent as ot,readAccessor as lt,requireSerializableArtifactContract as st,resolveAccessor as ct,resolveEventDropAdmissions as ut,resolveRawAccessor as dt}from"./c-E32M6XW5.min.js";import"./c-I4QJ6YLM.min.js";var ft="semiotic.set_point_selection",ht="semiotic.set_interval_selection",mt="semiotic.clear_selection",pt="semiotic.activate_navigation_node",gt="semiotic.inspect_data",yt="0.1.0",vt="vacp.data_schema",bt=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","RadarChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","WaterfallChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],$t=new Set(bt),wt=Symbol.for("semiotic.chartRecipeRegistry"),Ct="1",At=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),kt=new Set(["data","nodes","edges","points","areas","lines","flows"]),xt="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e)),St=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Pt=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),jt=new Set(["PieChart","DonutChart","FunnelChart"]),It=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]),Mt={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",BumpChart:"bump chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},Rt=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),Ot=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),Ft=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Dt={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Lt={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Nt=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Et={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"},Tt=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),Bt=new Set(["system","agent","watcher"]),_t=new Set(["ai","agent","system","computed","dbt","great-expectations"]),zt=new Set(["rule","statistical-test","llm-inference","computed"]),Vt={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"},Ht=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),qt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Gt=new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),Ut=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),Kt=["data","nodes","edges","points","areas","lines","flows"],Jt=[["xAccessor","x"],["yAccessor","y"],["categoryAccessor","category"],["valueAccessor","value"],["colorBy","color"],["sizeAccessor","size"],["lineBy","series"],["groupAccessor","group"],["oAccessor","ordinal"],["rAccessor","radial"],["sourceAccessor","source"],["targetAccessor","target"],["nodeIDAccessor","id"]];export{pt as unstable_SEMIOTIC_VACP_ACTIVATE_NAVIGATION_ACTION,mt as unstable_SEMIOTIC_VACP_CLEAR_SELECTION_ACTION,gt as unstable_SEMIOTIC_VACP_INSPECT_DATA_ACTION,ht as unstable_SEMIOTIC_VACP_SET_INTERVAL_SELECTION_ACTION,ft as unstable_SEMIOTIC_VACP_SET_POINT_SELECTION_ACTION,vt as unstable_VACP_DATA_SCHEMA_ACTION,yt as unstable_VACP_SCHEMA_VERSION,Je as unstable_createSemioticVACPBridge,We as unstable_installSemioticVACPBridge};
1
+ function e(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function t(e,t={}){let r="number"==typeof t.maxDepth&&Number.isFinite(t.maxDepth)?Math.max(1,Math.floor(t.maxDepth)):10,n="number"==typeof t.maxArrayLength&&Number.isFinite(t.maxArrayLength)?Math.max(1,Math.floor(t.maxArrayLength)):1e3,a=/* @__PURE__ */new WeakSet,i=(e,t)=>{if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:e+"";if("bigint"==typeof e)return""+e;if("function"==typeof e||"symbol"==typeof e||typeof e>"u")return;if(e instanceof Date)return e.toISOString();if(t>=r)return"[depth limit]";if("object"!=typeof e)return e+"";if("$$typeof"in e)return;if(a.has(e))return"[circular]";if(a.add(e),Array.isArray(e)){let r=e.slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Set){let r=Array.from(e).slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Map){let r=/* @__PURE__ */Object.create(null),o=0;for(let[a,l]of e){if(o++>=n)break;let e=i(l,t+1);void 0!==e&&(r[a+""]=e)}return a.delete(e),r}let o=/* @__PURE__ */Object.create(null);for(let r of Object.keys(e).sort()){let n=i(e[r],t+1);void 0!==n&&(o[r]=n)}return a.delete(e),o};return i(e,0)}function r(r){let n=t(r);return e(n)?n:{}}function n(t){if(Array.isArray(t))return t.map(n);if(!e(t))return t;let r=/* @__PURE__ */Object.create(null);for(let e of Object.keys(t).sort())r[e]=n(t[e]);return r}function a(e){return JSON.stringify(n(t(e)))}function i(e){let t=BigInt("14695981039346656037"),r=BigInt("1099511628211"),n=BigInt("0xffffffffffffffff");for(let a=0;e.length>a;a++)t^=BigInt(e.charCodeAt(a)),t=t*r&n;return t.toString(16).padStart(16,"0")}function o(e){return i(a(e))}function l(e){return"st_"+o({state:e.state,...e.summary?{summary:e.summary}:{}})}function s(e){if(!e?.length)return;let t=Array.from(new Set(e.filter(e=>"string"==typeof e&&e.length))).sort();return t.length?t:void 0}function c(e,t){return t.some(t=>e===t||e.startsWith(t+"/"))}function u(e,t){let r=s(t.refs),n=!1!==t.includeSummary;if(!r)return{snapshot:{version:e.version,createdAt:e.createdAt,state:e.state,...n&&e.summary?{summary:e.summary}:{}}};let a={};for(let[t,n]of Object.entries(e.state))c(t,r)&&(a[t]=n);let i={};if(n&&e.summary)for(let[t,n]of Object.entries(e.summary))c(t,r)&&(i[t]=n);return{snapshot:{version:e.version,createdAt:e.createdAt,state:a,...Object.keys(i).length?{summary:i}:{}},refs:r}}function d(e,t){let r={},n=[];for(let[n,i]of Object.entries(t.state))(!Object.prototype.hasOwnProperty.call(e.state,n)||a(e.state[n])!==a(i))&&(r[n]=i);for(let r of Object.keys(e.state))Object.prototype.hasOwnProperty.call(t.state,r)||n.push(r);let i={},o=[],l=e.summary??{},s=t.summary??{};for(let[e,t]of Object.entries(s))(!Object.prototype.hasOwnProperty.call(l,e)||a(l[e])!==a(t))&&(i[e]=t);for(let e of Object.keys(l))Object.prototype.hasOwnProperty.call(s,e)||o.push(e);return{changed:r,removed:n.sort(),...Object.keys(i).length?{summaryChanged:i}:{},...o.length?{summaryRemoved:o.sort()}:{}}}function f(e){return{refs:s(e.refs),prefixes:s(e.prefixes),kinds:e.kinds?.length?new Set(e.kinds):void 0,layers:e.layers?.length?new Set(e.layers):void 0,includeActions:!1!==e.includeActions,includeEdges:!1!==e.includeEdges,includeNodeData:!1!==e.includeNodeData}}function h(e,t){return!((t.refs?.length||t.prefixes?.length)&&!t.refs?.includes(e.ref)&&!t.prefixes?.some(t=>e.ref===t||e.ref.startsWith(t+"/")))&&(!t.kinds||t.kinds.has(e.kind))&&(!t.layers||t.layers.has(e.layer))}function m(e,t){let r=f(t),n=e.graph.nodes.filter(e=>h(e,r)).map(e=>{if(r.includeNodeData)return e;let{data:t,...n}=e;return n}),a=new Set(n.map(e=>e.ref)),i=r.includeActions?e.graph.actions.filter(e=>{if(!e.targetRef||a.has(e.targetRef))return!0;for(let t of a)if(t.startsWith(e.targetRef+"/"))return!0;return!1}):[];return{version:e.version,createdAt:e.createdAt,graph:{version:e.graph.version,nodes:n,edges:r.includeEdges?e.graph.edges.filter(e=>a.has(e.from)&&a.has(e.to)):[],actions:i}}}function p(e){return null==e?"NULL":"number"==typeof e?"DOUBLE":"string"==typeof e?"VARCHAR":"boolean"==typeof e?"BOOLEAN":e instanceof Date?"TIMESTAMP":Array.isArray(e)?"ARRAY":"OBJECT"}function g(t){let r=/* @__PURE__ */new Map;for(let n of t)if(e(n))for(let[e,t]of Object.entries(n)){let n=r.get(e)??/* @__PURE__ */new Set;n.add(p(t)),r.set(e,n)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let r=Array.from(t).filter(e=>"NULL"!==e);return{name:e,type:0===r.length?"NULL":1===new Set(r).size?r[0]:"MIXED"}})}function y(t,r){let n=/* @__PURE__ */Object.create(null);for(let a of r){let r=[];for(let n of t){if(!e(n))continue;let t=n[a];"number"==typeof t&&Number.isFinite(t)&&r.push(t)}if(!r.length)continue;let i=r[0],o=r[0],l=0;for(let e of r)i=Math.min(i,e),o=Math.max(o,e),l+=e;n[a]={min:i,max:o,avg:l/r.length}}return Object.keys(n).length?n:void 0}function b(t,r){let n=/* @__PURE__ */Object.create(null);for(let a of r){let r=[];for(let n of t){if(!e(n))continue;let t=n[a];t instanceof Date&&Number.isFinite(t.getTime())&&r.push(t.getTime())}if(!r.length)continue;let i=Math.min(...r),o=Math.max(...r);n[a]={minIso:new Date(i).toISOString(),maxIso:new Date(o).toISOString(),minEpochMs:i,maxEpochMs:o}}return Object.keys(n).length?n:void 0}function v(t,r){let n=/* @__PURE__ */Object.create(null);for(let a of r){let r=/* @__PURE__ */new Map;for(let n of t){if(!e(n))continue;let t=n[a];if("string"!=typeof t&&"boolean"!=typeof t)continue;let i=t+"";r.set(i,(r.get(i)??0)+1)}r.size&&(n[a]=Array.from(r).sort(([e,t],[r,n])=>n-t||e.localeCompare(r)).slice(0,10).map(([e,t])=>({value:e,n:t})))}return Object.keys(n).length?n:void 0}function $(e){let t=e.rows.slice(0,Math.max(0,e.sampleRows)),r=g(e.rows),n=r.map(e=>e.name);if("columns"===e.detail)return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r};let a=y(t,n),i=b(t,n),o=v(t,n);return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r,...a?{numeric:a}:{},...i?{temporal:i}:{},...o?{categoricalTopValues:o}:{},sampledRows:t.length}}function w(e,t){if(!t.descriptor.name.trim())throw Error("VACP action names must be non-empty.");if(e.some(e=>e.descriptor.name===t.descriptor.name))throw Error(`Duplicate VACP action "${t.descriptor.name}".`);e.push(t)}function C(t,r){if(!e(t))throw Error(r+" expects an object parameter payload.");return t}function A(e,t){return"number"==typeof e&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function k(e,t,r){if("string"!=typeof e.selectionRef)throw Error("params.selectionRef must be a VACP selection ref.");let n=t.find(t=>t.ref===e.selectionRef);if(!n)throw Error(`Unknown selection ref "${e.selectionRef}".`);if(r&&!n.modes.has(r))throw Error(`Selection "${n.name}" does not accept ${r} state.`);return n}function x(t,r){if(!e(t)||!Object.keys(t).length)throw Error("params.fields must be a non-empty object.");let n=/* @__PURE__ */Object.create(null);for(let[e,a]of Object.entries(t)){if(!r.includes(e))throw Error(`Field "${e}" is not allowed for this selection.`);if(!Array.isArray(a)||!a.length)throw Error(`Point selection field "${e}" requires values[].`);for(let t of a)if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&("number"!=typeof t||!Number.isFinite(t)))throw Error(`Point selection field "${e}" only accepts JSON primitive values.`);n[e]=[...a]}return n}function S(t,r){if(!e(t)||!Object.keys(t).length)throw Error("params.fields must be a non-empty object.");let n=/* @__PURE__ */Object.create(null);for(let[e,a]of Object.entries(t)){if(!r.includes(e))throw Error(`Field "${e}" is not allowed for this selection.`);if(!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||!Number.isFinite(a[0])||!Number.isFinite(a[1]))throw Error(`Interval selection field "${e}" requires [min,max].`);n[e]=[Math.min(a[0],a[1]),Math.max(a[0],a[1])]}return n}function P(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function j(t,r){if(!e(t))throw Error("params.match must be an object.");for(let e of Object.keys(t))if(!r.includes(e))throw Error(`params.match includes undeclared field "${e}".`);let n=/* @__PURE__ */Object.create(null);for(let e of r){if(!Object.prototype.hasOwnProperty.call(t,e)||!P(t[e]))throw Error(`params.match requires a primitive value for "${e}".`);n[e]=t[e]instanceof Date?t[e].toISOString():t[e]}return n}function I(e,n,a){let i=[],l=e.dataHandles.map(e=>e.ref);l.length&&w(i,{descriptor:{name:Fr,title:"Describe Semiotic data",description:"Return columns, types, row count, and optional bounded summaries for a chart DataHandle.",targetRef:a.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:l},detail:{type:"string",enum:["columns","full"]},sampleRows:{type:"number",minimum:1}},required:["handleRef"]}},execute(t){let r=C(t,Fr);if("string"!=typeof r.handleRef)throw Error("params.handleRef must be a DataHandle ref.");let a=e.dataHandles.find(e=>e.ref===r.handleRef);if(!a)throw Error(`Unknown DataHandle "${r.handleRef}".`);let i=void 0===r.detail||"columns"===r.detail?"columns":"full"===r.detail?"full":(()=>{throw Error('params.detail must be "columns" or "full".')})(),o="number"==typeof r.sampleRows&&Number.isFinite(r.sampleRows)?Math.max(1,Math.floor(r.sampleRows)):"full"===i?1e3:Math.min(a.rows.length,1e3),l=A(n.dataAccess?.maxSchemaRows,5e3);return $({handleRef:a.ref,rows:a.rows,detail:i,sampleRows:Math.min(o,l)})}}),l.length&&n.dataAccess?.sample&&w(i,{descriptor:{name:Rr,title:"Inspect bounded Semiotic rows",description:"Return a bounded JSON sample from a chart DataHandle. This action is opt-in.",targetRef:a.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:l},offset:{type:"number",minimum:0},limit:{type:"number",minimum:1}},required:["handleRef"]}},execute(r){let a=C(r,Rr);if("string"!=typeof a.handleRef)throw Error("params.handleRef must be a DataHandle ref.");let i=e.dataHandles.find(e=>e.ref===a.handleRef);if(!i)throw Error(`Unknown DataHandle "${a.handleRef}".`);let o="number"==typeof a.offset&&Number.isFinite(a.offset)?Math.max(0,Math.floor(a.offset)):0,l=A(n.dataAccess?.maxSampleRows,50),s="number"==typeof a.limit&&Number.isFinite(a.limit)?Math.max(1,Math.floor(a.limit)):Math.min(20,l),c=Math.min(s,l),u=i.rows.slice(o,o+c);return{handleRef:i.ref,offset:o,limit:c,rowCount:i.rows.length,rows:t(u,{maxArrayLength:l}),truncated:i.rows.length>o+u.length}}});let s=e.selections.map(e=>e.ref),c=e.selections.filter(e=>e.modes.has("point"));c.length&&n.selectionActions?.setPointSelection&&w(i,{descriptor:{name:Pr,title:"Set point selection",description:"Set a named LinkedCharts point-selection clause with allowlisted fields.",targetRef:a.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:c.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=C(t,Pr),a=k(r,e.selections,"point"),i=x(r.fields,a.fields);return await(n.selectionActions?.setPointSelection?.(a.name,a.clientId,i)),{selectionRef:a.ref,fields:i}}});let u=e.selections.filter(e=>e.modes.has("interval"));u.length&&n.selectionActions?.setIntervalSelection&&w(i,{descriptor:{name:jr,title:"Set interval selection",description:"Set a named LinkedCharts interval-selection clause in data units.",targetRef:a.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:u.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=C(t,jr),a=k(r,e.selections,"interval"),i=S(r.fields,a.fields);return await(n.selectionActions?.setIntervalSelection?.(a.name,a.clientId,i)),{selectionRef:a.ref,fields:i}}}),s.length&&n.selectionActions?.clearSelection&&w(i,{descriptor:{name:Ir,title:"Clear selection",description:"Clear every active clause from one named LinkedCharts selection.",targetRef:a.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:s}},required:["selectionRef"]}},async execute(t){let r=k(C(t,Ir),e.selections);return await(n.selectionActions?.clearSelection?.(r.name)),{selectionRef:r.ref,cleared:!0}}});let d=e.charts.map(e=>e.navigation).filter(e=>!!e&&e.index.valid&&!!e.binding.onActiveChange);d.length&&w(i,{descriptor:{name:Mr,title:"Activate chart navigation target",description:"Move an accessible chart navigation tree to a uniquely identified datum.",targetRef:a.view,parameters:{type:"object",properties:{navigationRef:{type:"string",enum:d.map(e=>e.ref)},match:{type:"object"}},required:["navigationRef","match"]}},execute(e){let t=C(e,Mr);if("string"!=typeof t.navigationRef)throw Error("params.navigationRef must be a navigation ref.");let r=d.find(e=>e.ref===t.navigationRef);if(!r)throw Error(`Unknown navigation ref "${t.navigationRef}".`);let n=j(t.match,r.index.matchFields),a=r.index.byKey.get(o(n));if(!a)throw Error("No navigation datum matches params.match.");return r.binding.onActiveChange?.(a),{navigationRef:r.ref,targetRef:r.index.targetRef(n),match:n}}});let f="function"==typeof n.actions?n.actions():n.actions;for(let e of f??[])e.available&&!e.available()||w(i,{descriptor:{...e.descriptor,...e.descriptor.parameters?{parameters:r(e.descriptor.parameters)}:{}},async execute(t){let r=e.validate?.(t);if("string"==typeof r&&r)throw Error(r);return e.execute(t)}});return i}function M(e){return Lr.has(e)}function R(){let e=globalThis;return e[Nr]||(e[Nr]={recipes:/* @__PURE__ */new Map,capabilities:/* @__PURE__ */new Map,layouts:/* @__PURE__ */new Map}),e[Nr]}function O(e){return R().recipes.get(e)}function F(e){let t=R().layouts.get(e)?.identity;return t?{...t}:void 0}function D(e){return"string"==typeof e?O(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function L(e){return"string"==typeof e?e:e.id??e.name}function N(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function T(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function E(e,t,r){return r??D(t.recipe)??D(t.recipeId)??O(e)}function B(e,t,r=[]){let n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;let a=r.find(e=>e&&"object"==typeof e);if(!a)return;let i=Object.entries(a).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in a):i.find(([,e])=>"string"==typeof e)?.[0]}function _(e,t){return e.dataRoles.find(e=>e.role===t)}function z(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function V(e,t,r,n,a,i={}){let o={...i};if(t)for(let[e,r]of Object.entries(t))o[e]=r;for(let e of r.dataRoles){let r=B(e,n,a),i=t&&r?t[r]:r;void 0!==i&&(o[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{let r=o[t];return null==r?`{${t}}`:r+""})}function H(e,t,r){let n=br(e,t,r);return{mismatchPaths:[...n.mismatchPaths,...void 0!==r&&n.unknownPaths.includes("artifact.component")?["artifact.component"]:[]]}}function q(e,t){return[.../* @__PURE__ */new Set([...Object.keys(e),...Object.keys(t)])].filter(r=>{if(Object.prototype.hasOwnProperty.call(e,r)!==Object.prototype.hasOwnProperty.call(t,r))return!0;let n=fr(e[r]),a=fr(t[r]);return n.excludedPaths.length>0||n.fingerprint!==a.fingerprint}).map(e=>"props."+e).sort()}function G(e,t,r,n){let a={component:t,version:n.version,createdAt:n.createdAt,...void 0!==n.recipeId?{recipeId:n.recipeId}:{},...void 0!==n.portable?{portable:n.portable}:{},...void 0!==n.manifest?{manifest:n.manifest}:{},...void 0!==n.reason?{reason:n.reason}:{},...void 0!==n.warnings?{warnings:n.warnings}:{},...void 0!==n.selections?{selections:n.selections}:{},artifactContract:r,status:e.status,omittedPaths:e.omittedPaths,warnings:e.warnings,...void 0!==e.serializedConfigFingerprint?{serializedConfigFingerprint:e.serializedConfigFingerprint}:{},...Object.prototype.hasOwnProperty.call(e,"serializedDataFingerprint")?{serializedDataFingerprint:e.serializedDataFingerprint}:{}};return fr(a).fingerprint}function U(e,t,r,n,a){let i=gr(r),o={...e,serializedConfigFingerprint:fr(yr(r)).fingerprint,serializedDataFingerprint:void 0===i?null:fr(i).fingerprint};return{...o,transferFingerprint:G(o,t,n,a)}}function K(e,t,r,n,a){if(!t)return{};let i=mr(t),o=a.recipeId??e,l=H(t,r,o),s=q(r,n),c=H(t,n,o);return l.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:U({status:"invalid",omittedPaths:l.mismatchPaths,warnings:["The artifact contract fingerprints do not match the supplied chart props or data."]},e,n,i.contract,a)}:s.length>0?{artifactContract:i.contract,artifactTransfer:U({status:"excluded",omittedPaths:s,warnings:["Chart props or data were excluded from the serialized configuration."]},e,n,i.contract,a)}:c.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:U({status:"invalid",omittedPaths:c.mismatchPaths,warnings:["Serialized chart props or data differ from the values bound to the artifact contract."]},e,n,i.contract,a)}:{artifactContract:i.contract,artifactTransfer:U(i.transfer,e,n,i.contract,a)}}function J(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function W(e,t){return!(!pr(e,t)||"areas"===e&&"string"==typeof t)}function Q(e,t,r){if(r?.selections&&hr(r.selections).length>0)throw new TypeError("Serialized selection state must contain only values that survive JSON serialization unchanged.");let n=O(e)??D(t.recipe)??D(t.recipeId);if(n)return Y(n,t,r);if(!M(e))throw Error(`Unknown component "${e}". Known components: ${Dr.join(", ")}`);let a=!1!==r?.includeData,i={};for(let[e,r]of Object.entries(t))if(null!=r&&!Er.has(e)&&(a||!W(e,r))&&"function"!=typeof r&&0>=hr(r).length)try{J(i,e,Br(r))}catch{}let o=/* @__PURE__ */(new Date).toISOString(),l={version:Tr,createdAt:o,...r?.selections?{selections:r.selections}:{}};return{component:e,props:i,version:Tr,createdAt:o,...K(e,r?.artifactContract,t,i,l),...r?.selections?{selections:r.selections}:{}}}function X(e,t,r){let n={};for(let[a,i]of Object.entries(e))if(null!=i&&!Er.has(a)&&"recipeId"!==a&&(t||!W(a,i))){if("function"==typeof i){if(r)throw Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}if(hr(i).length>0){if(r)throw Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}J(n,a,Br(i))}return n}function Y(e,t,r){let n=!1!==r?.includeData,a=hr(e);if("portable"===e.portability&&a.length>0)throw Error(`Portable recipe "${e.id}" has non-JSON definition values at: ${a.join(", ")}.`);let i=X(t,n,"portable"===e.portability),o=e.intents.map(L).filter(e=>!!e),l=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.id?e.layout.id:void 0,s=l?F(l):void 0,c=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.version&&e.layout.version?{version:e.layout.version,...e.layout.fingerprint?{fingerprint:e.layout.fingerprint}:{}}:void 0;if(s&&c&&(s.version!==c.version||s.fingerprint!==c.fingerprint))throw Error(`Recipe layout "${l}" registry identity does not match its portable declaration.`);let u=s??c;if("portable"===e.portability&&l&&!u)throw Error(`Portable recipe layout "${l}" must be registered with an explicit version identity.`);let d={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily,...e.version?{recipeVersion:e.version}:{},...0===a.length?{definitionFingerprint:fr(e).fingerprint}:{},...l?{layoutId:l}:{},...u?{layoutVersion:u.version}:{},...u?.fingerprint?{layoutFingerprint:u.fingerprint}:{}},f=/* @__PURE__ */(new Date).toISOString();if("portable"===e.portability){if(hr(i).length>0)throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);let n={version:Tr,createdAt:f,recipeId:e.id,portable:!0,manifest:d,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:i,manifest:d,version:Tr,createdAt:f,...K("ChartRecipe",r?.artifactContract,t,i,n),...r?.selections?{selections:r.selections}:{}}}let h="Recipe contains or may depend on non-serializable local layout callbacks.",m=["This config is inspectable but cannot be rendered remotely by CLI or MCP."],p={version:Tr,createdAt:f,recipeId:e.id,portable:!1,manifest:d,reason:h,warnings:m,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:h,warnings:m,props:i,manifest:d,version:Tr,createdAt:f,...K("ChartRecipe",r?.artifactContract,t,i,p),...r?.selections?{selections:r.selections}:{}}}function Z(e,t){return zr.has(e)||Vr.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function ee(e){for(let t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){let r=e[t];if("string"==typeof r&&r)return r}}function te(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function re(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function ne(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}function ae(e,t,r,n){let a=z(e,["nominal","ordinal"]),i=z(e,["quantitative"]),o=a?B(a,r,t):void 0,l=i?B(i,r,t):void 0,s=a?.role??o??"category",c=i?.role??l??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${s} and ${c} are mapped through the recipe's declared visual semantics`,{number:f,percent:h}=ne(n),m=/* @__PURE__ */new Map;if(o&&l)for(let e of t){let t=(e[o]??"Uncategorized")+"",r=Number(e[l]);Number.isFinite(r)&&m.set(t,(m.get(t)??0)+r)}let p=[...m].sort((e,t)=>t[1]-e[1]),g=p.reduce((e,[,t])=>e+t,0),y=p[0],b=p[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:L(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${s} and ${c}. ${re(d)}.`,l2:p.length>0?`${p.length} categories total ${f.format(g)}. ${y[0]} accounts for ${f.format(y[1])}${g>0?` (${h.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${f.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>p.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${p.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${h.format(v)}.`,l4:`The chart is intended for ${$??"explanation"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`}}function ie(e,t,r={}){let n=T(t),a=N(t),i=r.locale??"en",o=("function"==typeof e.description?e.description({data:n,config:a,locale:i}):void 0)?.levels??ae(e,n,a,i),l=r.levels??["l1","l2","l3","l4"],s={};for(let e of l)o[e]&&(s[e]=o[e]);let c=["l1","l2","l3","l4"].map(e=>s[e]).filter(e=>!!e).join(" "),u=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:c,levels:s,...u?.length?{caveats:u}:{}}}function oe(e,t){let r="mechanical"===(t.simulationMode??t.mode)&&("GaltonBoardChart"===e||"UnitPileChart"===e);if(!Array.isArray(t.data)&&!r)return null;let n=Array.isArray(t.data)?t.data:[],a=Math.max(2,Math.round($r(t.bins)??21)),i=Math.max(1,Math.round($r(t.pegRows)??a-1));if(r&&(n="GaltonBoardChart"===e?Cr({bins:a,count:t.mechanicalCount,pegRows:i,branchProbability:t.branchProbability,seed:t.seed}):xr({count:t.mechanicalCount,categories:t.mechanicalCategories,unitValue:t.unitValue,seed:t.seed})),n=Ar(n,"UnitPileChart"===e?"pile":"GaltonBoardChart"===e?"galton":"EventDropChart"===e?"event":"collision-swarm").rows,"UnitPileChart"===e){let e=/* @__PURE__ */new Map,a=t.valueAccessor??(r?"value":void 0);return n.forEach((r,n)=>{let i=(vr(r,n,t.categoryAccessor??"category")??"unknown")+"",o=a?$r(vr(r,n,a)):1;e.set(i,(e.get(i)??0)+Math.max(0,o??0))}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("GaltonBoardChart"===e){let e=n.map((e,r)=>$r(vr(e,r,t.valueAccessor??"value"))).filter(e=>null!=e),o=r?[0,i]:wr(t.valueExtent),l=o?.[0]??(e.length?Math.min(...e):0),s=o?.[1]??(e.length?Math.max(...e):1),c=l===s?1:s-l,u=Array.from({length:a},(e,t)=>({label:t+1+"",value:0}));for(let t of e)u[Math.max(0,Math.min(a-1,Math.floor((t-l)/c*a)))].value+=1;return{generated:r,rows:u}}if("CollisionSwarmChart"===e){let e=/* @__PURE__ */new Map;return n.forEach((r,n)=>{if(null==$r(vr(r,n,t.xAccessor??"x")))return;let a=t.groupAccessor?(vr(r,n,t.groupAccessor)??"All")+"":"All";e.set(a,(e.get(a)??0)+1)}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("EventDropChart"===e){let e=$r(t.windows?.size??10);if(null==e||0>=e)return null;let{events:a}=kr({data:n,timeAccessor:t.timeAccessor??"time",arrivalAccessor:t.arrivalAccessor??"arrivalTime",windowSize:e,watermark:t.watermark,watermarkAtArrivalAccessor:t.watermarkAtArrivalAccessor}),i=a.map(e=>e.eventTime),o=i.length?Math.min(...i):0,l=i.length?Math.max(...i):o+e,s=Math.min($r(t.timeExtent?.[0])??o,o),c=Math.max($r(t.timeExtent?.[1])??l,l),u=Math.floor(s/e)*e,d=Math.max(1,Math.ceil((c-u+e)/e)),f=Array.from({length:d},(t,r)=>({label:`${u+r*e}-${u+(r+1)*e}`,value:0,secondary:0,secondaryLabel:"late"}));for(let t of a){let r=f[Math.max(0,Math.min(d-1,Math.floor((t.eventTime-u)/e)))];t.late?r.secondary+=1:r.value+=1}return{generated:r,rows:f}}return null}function le(e){let t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}function se(e,t){let r=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,a=[e.settledProjectionRows,e.projectionRows,n?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(a)?a.map((e,r)=>{if(!e||"object"!=typeof e)return null;let n=e,a=le(n.count??n.value??n.total??n.bodies??n.events);if(null==a)return null;let i=n.label??n.id??n.name??"container "+(r+1),o=le(n.secondary??n.secondaryCount),l=le(n.observed??n.observedCount);return{label:te(i,t),count:a,...null!=o?{secondary:o}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=l?{observed:l}:{}}}).filter(e=>null!=e):null}function ce(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}function ue(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"UnitPileChart"===e?"unit":"body"}function de(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}function fe(e,t){if(0>=t)return"0%";let r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}function he(e,t,r,n,a,i,o=null){let l=ce(e),s=o&&"EventDropChart"===e?"accepted event":ue(e),c=o?o.generated?"The generated sample projection":"The source projection":"The settled projection";if(a.has("l1")&&(n.l1=de(e,t)),!a.has("l2")&&!a.has("l3"))return;if(!r||0===r.length)return void(a.has("l2")&&(n.l2=o?"No valid source records are available.":"No settled projection is loaded yet."));let u=r.reduce((e,t)=>e+t.count,0),d=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),f=d[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!f)return;let h=r.reduce((e,t)=>e+(t.secondary??0),0),m=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(a.has("l2"))if(o&&"EventDropChart"===e)n.l2=`${c} classifies ${i(u+h)} ${me(u+h,"event")} across ${r.length} ${me(r.length,l)}: ${i(u)} accepted and ${i(h)} late.`;else if(0===d.length)n.l2=`${c} contains ${i(u)} ${me(u,s)} across ${r.length} ${me(r.length,l)}; no ${me(2,l)} are non-empty yet.`;else{let e=h>0?` ${i(h)} ${me(h,s)} ${1===h?"is":"are"} marked ${m}.`:"";n.l2=`${c} contains ${i(u)} ${me(u,s)} across ${r.length} ${me(r.length,l)}; ${d.length} ${me(d.length,l)} ${1===d.length?"is":"are"} non-empty. The largest ${l} is ${f.label} with ${i(f.count)} ${me(f.count,s)}.${e}`}if(a.has("l3")&&u>0&&d.length>0){let e=d.find(e=>e!==f),t=fe(f.count,u);n.l3=e?`${c} is most concentrated in ${f.label}, which holds ${i(f.count)} ${me(f.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${me(e.count,s)}.`:`${c} is concentrated in ${f.label}, which holds all ${i(f.count)} ${me(f.count,s)}.`}}function me(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function pe(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()}function ge(e){return qr[e]||pe(e)+" chart"}function ye(e){let t,r=0;for(let[n,a]of Object.entries(e))if("number"==typeof a&&a>0){if(a>r){t=n,r=a;continue}if(a===r&&void 0!==t){let e=Qr.indexOf(n),r=Qr.indexOf(t);-1!==e&&(-1===r||r>e)&&(t=n)}}return t}function be(e){return"BumpChart"===e?"ranking":Vr.has(e)||"StackedAreaChart"===e?"apportioning":Kr.has(e)?"relating":zr.has(e)?"comparing":Hr.has(e)?"characterizing":_r.has(e)?"tracking":Gr.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}function ve(e){if(e){if("fits"in e||"buildProps"in e){let t=e,r={};for(let[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(r[e]=n);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}function $e(e,t){let r=ve(t);if(r?.act)return r.act;if(r?.intentScores){let e=ye(r.intentScores);if(e&&Jr[e]&&(r.intentScores[e]??0)>=3)return Jr[e]}return r?.family?Wr[r.family]:be(e)}function we(e){let t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;let t=e;if("string"!=typeof t.type||!Yr.has(t.type))return!1;let r=t.provenance;return!(!r||"object"!=typeof r)&&(Zr.has(r.authorKind)||en.has(r.source)||tn.has(r.basis))})}function Ce(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}function Ae(e,t,r,n){let a=0,i=0,o=1/0,l=-1/0,s=null,c=null,u=0,d=0,f=null,h=null,m=NaN,p=NaN;for(let r of e){let e=t(r);Number.isFinite(e)&&(0===a&&(m=e,f=r),p=e,h=r,o>e&&(o=e,s=r,u=a),e>l&&(l=e,c=r,d=a),a++,i+=e)}return 0===a?null:{count:a,min:o,max:l,mean:i/a,minLabel:te(null!=s?r(s):null,n),maxLabel:te(null!=c?r(c):null,n),first:m,last:p,firstLabel:te(null!=f?r(f):null,n),lastLabel:te(null!=h?r(h):null,n),minIndex:u,maxIndex:d}}function ke(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}function xe(e){let t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}function Se(e){let t=rn["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=xe(e),n=r?r+t.replace(/^an? /,""):t,a="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return a?`${n} labeled "${a}"`:n}function Pe(e){let t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;let r=dr(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;let n=r.map(Se),a=n.slice(0,5),i=n.length-a.length,o=ke(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${o}.`}function je(e,t,r={}){let n=void 0!==r.levels,a=new Set(r.levels??["l1","l2","l3"]);!n&&(r.capability||we(t))&&a.add("l4");let i=E(e,t,r.recipe);if(i){let e=["l1","l2","l3","l4"].filter(e=>a.has(e));!n&&!e.includes("l4")&&e.push("l4");let o=ie(i,t,{levels:e,locale:r.locale,audience:r.audience,includeCaveats:r.includeCaveats}),l=Pe(t);return{...o,text:l?`${l} ${o.text}`.trim():o.text,...l?{annotations:l}:{}}}let o=Ce(r.locale??"en"),l=ge(e),s=Array.isArray(t.data)?t.data:null,c=ee(t),u=Ur.has(e)?se(t,o):null,d=Ur.has(e)&&null===u?oe(e,t):null,{measure:f,measureFallback:h,dimension:m,dimensionFallback:p}=Z(e,t),g="string"==typeof f&&f?f:h,y="string"==typeof m&&m?m:p,b={};if(Ur.has(e)&&he(e,l,u??(d?se({projectionRows:d.rows},o):null),b,a,o,d),a.has("l1")&&!Ur.has(e))if("BumpChart"===e)b.l1=`A ${l} ranking ${c??"series"} by ${g} across ${y}.`;else if(_r.has(e)||zr.has(e))b.l1=`A ${l} of ${g} by ${y}`+(c?`, split by ${c}.`:".");else if(Vr.has(e))b.l1=`A ${l} showing ${g} across ${y} categories.`;else if(Hr.has(e))b.l1=`A ${l} of the distribution of ${g}`+(c?` by ${c}.`:".");else if(Gr.has(e)){let e=Array.isArray(t.nodes)?t.nodes.length:void 0,r=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${Te(e,"node")}`:null,null!=r?`${r} ${Te(r,"edge")}`:null].filter(Boolean);b.l1=`A ${l}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){let e="string"==typeof t.label?t.label:g;b.l1=`A single value${e?" for "+e:""}.`}else b.l1=`A ${l}.`;let v=_r.has(e)||"BumpChart"===e||zr.has(e)||Vr.has(e)||Hr.has(e),$=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&v&&s&&s.length>0&&($=Ae(s,Sr(f,h),ur(m,p),o)),a.has("l2")&&v&&(s&&0!==s.length?$&&(b.l2=Vr.has(e)?`${$.count} segments totaling ${o(Ie($))}. Largest is ${$.maxLabel} at ${o($.max)}; smallest is ${$.minLabel} at ${o($.min)}.`:`${g} ranges from ${o($.min)} (${$.minLabel}) to ${o($.max)} (${$.maxLabel}), with a mean of ${o($.mean)} across ${$.count} points.`):b.l2="No data is loaded yet."),a.has("l3")&&$&&!c&&_r.has(e)?b.l3=Me($,g,o):a.has("l3")&&$&&!c&&zr.has(e)&&(b.l3=`The highest ${y} is ${$.maxLabel} and the lowest is ${$.minLabel}.`),a.has("l4")){let n=we(t)?"alerting":$e(e,r.capability);n&&(b.l4=Re(n,e,t,c?null:$,g,y,o,r.audience))}let w=["l1","l2","l3","l4"].filter(e=>a.has(e)&&b[e]).map(e=>b[e]).join(" "),C=Pe(t);return{text:C?`${C} ${w}`.trim():w,levels:b,...C?{annotations:C}:{}}}function Ie(e){return e.mean*e.count}function Me(e,t,r){let{first:n,last:a,min:i,max:o,maxLabel:l,minLabel:s,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:f,count:h}=e,m=o-i,p=a-n;if(0===m)return`${Ne(t)} is constant at ${r(n)} across the series.`;if(.04>m/(Math.abs(e.mean)||1))return`${Ne(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`;let g=f>0&&h-1>f,y=d>0&&h-1>d,b=(o-Math.max(n,a))/m,v=(Math.min(n,a)-i)/m;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(o)} (${l}), then falls to ${r(a)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${r(i)} (${s}), then recovers to ${r(a)} (${u}).`:.05>Math.abs(p)/m?`${Ne(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`:p>0?f===h-1?`Overall ${t} rises from ${r(n)} (${c}) to a peak of ${r(a)} (${u}).`:`Overall ${t} rises from ${r(n)} (${c}) to ${r(a)} (${u}), after peaking at ${r(o)} (${l}).`:d===h-1?`Overall ${t} falls from ${r(n)} (${c}) to a low of ${r(a)} (${u}).`:`Overall ${t} falls from ${r(n)} (${c}) to ${r(a)} (${u}), after dipping to ${r(i)} (${s}).`}function Re(e,t,r,n,a,i,o,l){let s,c,u=Xr[e],d=/^[aeiou]/i.test(u)?"an":"a";switch(e){case"locating":s="This is a map",c="read values by location";break;case"presenting":s="This is a single-value display",c=`read ${"string"==typeof r.label&&r.label?r.label:a} as the headline number`;break;case"tracing":s=`This is ${d} ${u} chart`,c="follow the movement between states";break;case"nesting":s=`This is ${d} ${u} chart`,c="read it for nested structure and how children sum into their parents";break;case"relating":s=`This is ${d} ${u} chart`,c=`read it for whether ${i} and ${a} move together`;break;default:s=`This is ${d} ${u} chart`,c=Oe(e,n,a,i,o,t)}return`${s}; ${c}.${Le(t,l)}`}function Oe(e,t,r,n,a,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${n}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return Fe(t,a,i);case"tracking":return`read it for the trajectory of ${r}, which ${De(t)} from ${a(t.first)} (${t.firstLabel}) to ${a(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${n}; ${t.maxLabel} leads at ${a(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${a(t.max)}`;case"apportioning":{let e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${a(e)} total; ${t.maxLabel} is the largest at ${a(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${a(t.min)} to ${a(t.max)}`;default:return"read the highlighted features"}}function Fe(e,t,r){if(zr.has(r)||Vr.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;let{first:n,last:a,min:i,max:o,minLabel:l,maxLabel:s,lastLabel:c,minIndex:u,maxIndex:d,count:f}=e,h=o-i;if(h>0){let e=d>0&&f-1>d,r=u>0&&f-1>u,m=(o-Math.max(n,a))/h,p=(Math.min(n,a)-i)/h;if(e&&m>.15)return`the peak of ${t(o)} at ${s} is the point to investigate`;if(r&&p>.15)return`the dip to ${t(i)} at ${l} is the point to investigate`;if(a>=o)return`the climb to ${t(a)} at ${c} warrants a closer look`;if(i>=a)return`the drop to ${t(a)} at ${c} warrants a closer look`}return`the extremes — ${s} (${t(o)}) and ${l} (${t(i)}) — are the points to check`}function De(e){let t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}function Le(e,t){if(!t)return"";let r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${ge(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}function Ne(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Te(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Ee(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Be(e){return!!e&&"object"==typeof e}function _e(e,t,r,n){let a=z(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),o=a?B(a,r,n):void 0,l=[];o&&null!=e[o]&&l.push(e[o]+"");for(let t of i){let a=B(t,r,n);a&&null!=e[a]&&l.push(`${t.role}: ${e[a]+""}`)}return l.length>0?l.join(", "):"Data item"}function ze(e,t,r={}){let n=T(t),a=N(t),i=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:a,locale:r.locale??"en"});let o=Be(e.navigation)?e.navigation:void 0,l=(o?.groupByRole?_(e,o.groupByRole):void 0)??(o?.groupBy?.[0]?_(e,o.groupBy[0])??e.dataRoles.find(e=>e.field===o.groupBy?.[0]):void 0)??z(e,["nominal","ordinal"]),s=l?B(l,a,n):void 0,c=(o?.idRole?_(e,o.idRole):void 0)??z(e,["identifier"]),u=c?B(c,a,n):void 0,d={id:"root",role:"chart",label:o?.summaryTemplate?V(o.summaryTemplate,void 0,e,a,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]},f=0,h=(t,r,i)=>{let l=u?t[u]:void 0,s=o?.itemLabelTemplate?V(o.itemLabelTemplate,t,e,a,n,{count:n.length}):_e(t,e,a,n);return{id:"datum-"+Ee(l??r),role:"datum",label:s,level:i,datum:t}};if(s){let e=/* @__PURE__ */new Map;for(let t of n){let r=(t[s]??"Uncategorized")+"",n=e.get(r);n?n.push(t):e.set(r,[t])}d.children=[...e].map(([e,t],r)=>{let n=t.slice(0,Math.max(0,i-f));f+=n.length;let a=n.map((e,t)=>h(e,1e5*r+t,3));return t.length>n.length&&a.push({id:"more-"+Ee(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+Ee(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:a}})}else{let e=n.slice(0,i);d.children=e.map((e,t)=>h(e,t,2)),n.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return d}function Ve(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function He(e,t="—"){return null==e||""===e?t:"object"==typeof e?He(e.id??e.name??e.label,t):e+""}function qe(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function Ge(e){return He(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Ue(e,t){let r=Ve(e,t,"children");return Array.isArray(r)?r:[]}function Ke(e,t,r){return`${e} ${1===e?t:r}`}function Je(e,t){return 0===e.numericLeaves?"":e.numericLeaves===e.leaves?", leaf total "+t(e.leafTotal):`, known leaf total ${t(e.leafTotal)} across ${Ke(e.numericLeaves,"valued leaf","valued leaves")}`}function We(e){return"TreeDiagram"===e?"tree":"Treemap"===e?"treemap":"CirclePack"===e?"circle-packing":"orbit"}function Qe(e,t,r,n){let a=t.data&&"object"==typeof t.data?t.data:null,i=t.childrenAccessor??"children",o=t.valueAccessor??"value",l=t.nodeLabel??t.nodeIdAccessor,s=/* @__PURE__ */new WeakMap,c=/* @__PURE__ */new WeakSet,u=e=>{let t=s.get(e);if(t)return t;if(c.has(e))return{descendants:0,depth:0,leaves:0,numericLeaves:0,leafTotal:0};c.add(e);let r,n=Ue(e,i);if(0===n.length){let t=qe(Ve(e,o,"value"));r={descendants:0,depth:1,leaves:1,numericLeaves:null==t?0:1,leafTotal:t??0}}else r=n.reduce((e,t)=>{let r=u(t);return{descendants:e.descendants+1+r.descendants,depth:Math.max(e.depth,r.depth+1),leaves:e.leaves+r.leaves,numericLeaves:e.numericLeaves+r.numericLeaves,leafTotal:e.leafTotal+r.leafTotal}},{descendants:0,depth:1,leaves:0,numericLeaves:0,leafTotal:0});return c.delete(e),s.set(e,r),r},d=0,f=(e,t,a,s)=>{let c=He(Ve(e,l,"name"),"item "+a);if(s.has(e))return{id:`hierarchy-${Ge(a)}-cycle`,role:"datum",level:t,label:`Repeated hierarchy reference to ${c}; branch omitted.`};let h=Ue(e,i),m=u(e);if(0===h.length){if(d>=r)return null;d+=1;let i=qe(Ve(e,o,"value"));return{id:`hierarchy-${Ge(a)}-${Ge(c)}`,role:"datum",level:t,label:`${c}${null==i?"":": "+n(i)}.`,...null==i?{}:{value:i},datum:e}}let p=new Set(s);p.add(e);let g=[],y=0;for(let[e,n]of h.entries()){if(d>=r){y+=u(n).leaves;continue}let i=f(n,t+1,`${a}-${e}`,p);i&&g.push(i)}return y>0&&g.push({id:`hierarchy-${Ge(a)}-more`,role:"datum",level:t+1,label:`${Ke(y,"more leaf","more leaves")} in ${c} not shown; navigation is capped at ${r}.`}),{id:`hierarchy-${Ge(a)}-${Ge(c)}`,role:"series",level:t,label:`${c}: ${Ke(h.length,"direct child","direct children")}, ${Ke(m.descendants,"total descendant","total descendants")}, ${Ke(m.leaves,"leaf","leaves")}${Je(m,n)}.`,datum:e,children:g}},h=a?u(a):null,m={id:"root",role:"chart",level:1,label:a?`A ${We(e)} chart with ${Ke(h.leaves,"leaf","leaves")} and ${Ke(h.descendants,"total descendant","total descendants")} across ${Ke(h.depth,"hierarchy level","hierarchy levels")}${Je(h,n)}.`:"A hierarchy chart with no hierarchy data loaded.",children:[]};if(a){let e=f(a,2,"root",/* @__PURE__ */new Set);if(e){let t=He(Ve(a,l,"name"),"");m.children="series"===e.role&&""===t?e.children:[e]}}return m}function Xe(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function Ye(e,t="—"){return null==e||""===e?t:"object"==typeof e?Ye(e.id??e.name??e.label,t):e+""}function Ze(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function et(e){return Ye(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function tt(e){let t=[];return(e.linkedHover||e.selection||e.linkedBrush)&&t.push("Use linked highlighting to compare related locations."),(e.enableHover||e.tooltip)&&t.push("Hover or focus a mark for its details."),t.length>0?" "+t.join(" "):""}function rt(e){if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];let t=e;return Array.isArray(t.features)?t.features:"Feature"===t.type?[t]:[]}function nt(e,t,r){let n=Xe(e,t,r);if(void 0!==n)return n;let a=e.properties;return a&&"object"==typeof a?Xe(a,t,r):void 0}function at(e,t,r){return Ye(nt(e,t,"id")??nt(e,"name","name")??nt(e,"NAME","NAME")??nt(e,"label","label"),r)}function it(e){let t=0,r=1/0,n=-1/0,a=0;for(let i of e)null!=i.value&&(t+=1,r=Math.min(r,i.value),n=Math.max(n,i.value),a+=i.value);return 0===t?null:{count:t,min:r,max:n,total:a,average:a/t}}function ot(e,t){let r=it(e);return r?`range ${t(r.min)} to ${t(r.max)}, average ${t(r.average)}, total ${t(r.total)}`:"no numeric values"}function lt(e){let t=e.filter(e=>null!=e.value),r=e.filter(e=>null==e.value),n=[],a=it(t);if(a)if(a.min===a.max)n.push({id:"equal",label:"Equal values",rows:t});else{let e=a.min+(a.max-a.min)/3,r=a.min+2*(a.max-a.min)/3,i=t.filter(e=>e.value>=r),o=t.filter(t=>t.value>=e&&r>t.value),l=t.filter(t=>e>t.value);i.length>0&&n.push({id:"highest",label:"Highest values",rows:i}),o.length>0&&n.push({id:"middle",label:"Middle values",rows:o}),l.length>0&&n.push({id:"lowest",label:"Lowest values",rows:l})}return r.length>0&&n.push({id:"missing",label:"No numeric value",rows:r}),n}function st(e,t,r){let n,a=e.filter(e=>null!=e.value).sort((e,t)=>t.value-e.value||e.index-t.index),i=/* @__PURE__ */new Map,o=0;for(let[e,t]of a.entries())n!==t.value&&(o=e+1,n=t.value),i.set(t.index,o);let l=0;return lt(e).map(e=>{let n=e.rows.slice(0,Math.max(0,t-l));l+=n.length;let o=n.map(e=>{let t=i.get(e.index),n=null==t||2>a.length?"":`, rank ${t} of ${a.length}`;return{id:`geo-${et(e.label)}-${e.index}`,role:"datum",level:3,label:null==e.value?e.label+": no numeric value.":`${e.label}: ${r(e.value)}${n}.`,...null==e.value?{}:{value:e.value},datum:e.datum}}),s=e.rows.length-n.length;return s>0&&o.push({id:`geo-${e.id}-more`,role:"datum",level:3,label:`${s} more ${1===s?"region":"regions"} in ${e.label.toLowerCase()} not shown; navigation is capped at ${t}.`}),{id:"regions-"+e.id,role:"series",level:2,label:`${e.label}: ${e.rows.length} ${1===e.rows.length?"region":"regions"}, ${ot(e.rows,r)}.`,children:o}})}function ct(e,t,r,n){let a=rt(t.areas),i="FlowMap"===e&&Array.isArray(t.nodes)?t.nodes:Array.isArray(t.points)?t.points:[],o=Array.isArray(t.flows)?t.flows:[],l=Array.isArray(t.lines)?t.lines:[],s=t.valueAccessor??t.sizeBy??t.costAccessor??"value",c=t.pointIdAccessor??t.nodeIdAccessor??"id",u=("ChoroplethMap"===e?a:i).map((r,n)=>({datum:r,index:n,label:at(r,"ChoroplethMap"===e?t.idAccessor:c,`${"ChoroplethMap"===e?"region":"location"} ${n+1}`),value:Ze(nt(r,s,"value"))})),d=u.filter(e=>null!=e.value),f={id:"root",role:"chart",level:1,label:`${"ChoroplethMap"===e?`A choropleth map with ${a.length} regions.${d.length>0?` Values are available for ${d.length} of ${a.length} regions; ${ot(d,n)}.`:" No regions have numeric values."}`:"FlowMap"===e?`A flow map with ${o.length} flows and ${i.length} locations.`:"DistanceCartogram"===e?`A distance cartogram with ${i.length} locations and ${l.length} routes.`:`A proportional-symbol map with ${i.length} locations.`}${tt(t)}`,children:[]};if("ChoroplethMap"===e)f.children=st(u,r,n);else if(u.length>0){let e=u.slice(0,r).map(e=>({id:`geo-${et(e.label)}-${e.index}`,role:"datum",level:3,label:`${e.label}${null==e.value?"":": "+n(e.value)}.`,...null==e.value?{}:{value:e.value},datum:e.datum}));u.length>r&&e.push({id:"geo-more",role:"datum",level:3,label:`…and ${u.length-r} more locations.`}),f.children?.push({id:"locations",role:"series",level:2,label:`Locations: ${u.length} marks.`,children:e})}let h="FlowMap"===e?o:l;if(h.length>0){let e=h.slice(0,r).map((e,t)=>{let r=Ye(e.source,"unknown"),a=Ye(e.target,"unknown"),i=Ze(Xe(e,s,"value"));return{id:`route-${et(r)}-${et(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":": "+n(i)}.`,...null==i?{}:{value:i},datum:e}});f.children?.push({id:"routes",role:"series",level:2,label:`Routes: ${h.length} ${1===h.length?"route":"routes"}.`,children:e})}return f}function ut(e,t={},r={}){return!!E(e,t,r.recipe)||nn.has(e)||an.has(e)||on.has(e)||_r.has(e)||zr.has(e)||Vr.has(e)||Hr.has(e)}function dt(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function ft(e,t="—"){return null==e||""===e?t:"object"==typeof e?ft(e.id??e.name??e.label,t):e+""}function ht(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:void 0}function mt(e){return ft(e,"unknown").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function pt(e,t){let r=[];return(e.linkedHover||e.selection||e.linkedBrush)&&r.push("network"===t?"Use linked highlighting to trace related marks.":"Use linked highlighting to compare related locations."),(e.enableHover||e.tooltip)&&r.push("Hover or focus a mark for its details."),r.length>0?" "+r.join(" "):""}function gt(e,t){t&&e.children?.push(t)}function yt(e,t,r,n){let a=Array.isArray(t.nodes)?t.nodes:[],i=Array.isArray(t.edges)?t.edges:Array.isArray(t.flows)?t.flows:[],o=t.nodeIdAccessor??t.nodeIDAccessor,l=t.sourceAccessor??"source",s=t.targetAccessor??"target",c=t.valueAccessor??"value",u=e=>ft(dt(e,o,"id"),"unknown"),d=(e,t)=>ft(dt(e,t,""),"unknown"),f=/* @__PURE__ */new Set;for(let e of i)f.add(d(e,l)),f.add(d(e,s));let h=a.length>0?a:[...f].map(e=>({id:e})),m=/* @__PURE__ */new Map;for(let e of h)m.set(u(e),{links:0,value:0});for(let e of i){let t=d(e,l),r=d(e,s),n=ht(dt(e,c,"value"))??0;for(let e of[t,r]){let t=m.get(e)??{links:0,value:0};t.links+=1,t.value+=n,m.set(e,t)}}let p={id:"root",role:"chart",level:1,label:`A ${"SankeyDiagram"===e||"ProcessSankey"===e?"flow diagram":"ChordDiagram"===e?"chord diagram":"network graph"} with ${h.length} nodes and ${i.length} links.${pt(t,"network")}`,children:[]},g=0,y=/* @__PURE__ */new Map,b=t.colorBy??"group";for(let e of h){let t=ft(dt(e,b,"group"),"Ungrouped"),r=y.get(t);r?r.push(e):y.set(t,[e])}let v=[...y].map(([e,t],a)=>{let i=[];for(let[e,o]of t.entries()){if(g>=r)break;g+=1;let t=u(o),l=m.get(t)??{links:0,value:0},s=l.value>0?`, ${n(l.value)} total flow`:"";i.push({id:`node-${a}-${e}-${mt(t)}`,role:"datum",level:3,label:`${t}: ${l.links} ${1===l.links?"link":"links"}${s}.`,value:l.value>0?l.value:void 0,datum:o})}return{id:`nodes-${a}-${mt(e)}`,role:"series",level:2,label:`${e}: ${t.length} ${1===t.length?"node":"nodes"}.`,children:i}});v.length>0&&p.children?.push(...v);let $=i.slice(0,r).map((e,t)=>{let r=d(e,l),a=d(e,s),i=ht(dt(e,c,"value"));return{id:`link-${mt(r)}-${mt(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":": "+n(i)}.`,value:i,datum:e}});return i.length>r&&$.push({id:"links-more",role:"datum",level:3,label:`…and ${i.length-r} more links.`,value:void 0}),$.length>0&&p.children?.push({id:"links",role:"series",level:2,label:`Links: ${i.length} ${1===i.length?"connection":"connections"}.`,children:$}),p}function bt(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function vt(e,t){let r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;let n=dr(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let a=0,i=n.slice(0,t).map(e=>{let t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${bt(Se(e))}${r}.`,datum:e}});n.length>t&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});let o=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===o?"one marked feature":o+" marked features"}.`,children:i}}function $t(e,t,r={}){let n=r.locale??"en",a=Math.max(1,r.maxLeaves??200),i=Ce(n),o=E(e,t,r.recipe);if(o)return ze(o,t,{maxLeaves:a,locale:n});let l={id:"root",role:"chart",label:je(e,t,{locale:n}).text||"Chart.",level:1,children:[]},s=vt(t,a);if(nn.has(e)){let r=yt(e,t,a,i);return gt(r,s),r}if(an.has(e)){let r=Qe(e,t,a,i);return gt(r,s),r}if(on.has(e)){let r=ct(e,t,a,i);return gt(r,s),r}let c=Array.isArray(t.data)?t.data:null,u=ut(e,t,r);if(!c||0===c.length||!u)return s&&(l.children=[s]),l;let{measure:d,measureFallback:f,dimension:h,dimensionFallback:m}=Z(e,t),p=Sr(d,f),g=ur(h,m),y="string"==typeof d&&d?d:f,b="string"==typeof h&&h?h:m,v=ee(t),$=0,w=e=>`${e}-${$++}`,C=(e,t)=>{let r=p(e),n=te(g(e),i);return{id:w("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(r)?i(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}},A=(e,t)=>{let r=e.slice(0,a).map(e=>C(e,t));return e.length>a&&r.push({id:w("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),r},k=[];if(_r.has(e)||zr.has(e)){let t=1/0,r=-1/0,n=1/0,a=-1/0,o=[],l=!0;for(let e of c){let i=p(e);Number.isFinite(i)&&(t>i&&(t=i),i>r&&(r=i));let s=g(e);o.push(s),"number"==typeof s&&Number.isFinite(s)?(n>s&&(n=s),s>a&&(a=s)):l=!1}let s=/* @__PURE__ */new Set,u=[];for(let e of o){let t=e+"";s.has(t)||(s.add(t),u.push(e))}let d=l?`${i(n)} to ${i(a)}`:`${te(u[0],i)} to ${te(u[u.length-1],i)} (${zr.has(e)?u.length+" categories":c.length+" points"})`;k.push({id:w("axis"),role:"axis",level:2,label:`${zr.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),r>=t&&k.push({id:w("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(r)}.`})}if(v){let r=ur(v,v),a=/* @__PURE__ */new Map;for(let e of c){let t=(r(e)??"—")+"",n=a.get(t);n?n.push(e):a.set(t,[e])}let i=[];for(let[r,o]of a){let a=je(e,{...t,data:o},{levels:["l2","l3"],locale:n}).text;i.push({id:w("series"),role:"series",level:2,label:`Series ${r}: ${a}`,children:A(o,3)})}l.children=[...k,...i]}else l.children=[...k,...A(c,2)];return s&&l.children.push(s),l}function wt(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ct(e){return wt(e)?e:void 0}function At(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function kt(e){let t=At(e);return null==t?void 0:Math.max(0,Math.floor(t))}function xt(...e){return e.map(Ct).find(Boolean)}function St(...e){return e.find(Array.isArray)}function Pt(e){let t={};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);return t}function jt(e,t,r){return e["string"==typeof t&&t?t:r]}function It(e){return e instanceof Date?e.toISOString():"number"==typeof e?Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+"":(e??"—")+""}function Mt(e,t,r){let n=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&n.push(`Current value is ${It(t.value)}.`);let e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,r="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;n.push(`The gauge scale runs from ${It(e)} to ${It(r)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){let a=Array.isArray(t.edges)?t.edges:[];if("ProcessSankey"===e&&Array.isArray(t.domain)&&2===t.domain.length&&n.push(`The ProcessSankey time domain runs from ${It(t.domain[0])} to ${It(t.domain[1])}.`),a.length>0){n.push(`${a.length} source flow${1===a.length?"":"s"} are supplied.`);for(let i of a.slice(0,r)){let r=jt(i,t.sourceAccessor,"source"),a=jt(i,t.targetAccessor,"target"),o=jt(i,t.valueAccessor,"value");n.push("ProcessSankey"!==e||null==i.startTime&&null==i.endTime?`${It(r)} to ${It(a)} has value ${It(o)}.`:`${It(r)} to ${It(a)} has value ${It(o)} over ${It(i.startTime)}–${It(i.endTime)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){let e=Ct(t.data),a="string"==typeof t.childrenAccessor&&t.childrenAccessor?t.childrenAccessor:"children",i="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",o="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",l=[],s=e=>{let t=Array.isArray(e[a])?e[a]:[];if(0!==t.length)for(let e of t){let t=Ct(e);t&&s(t)}else l.push(e)};if(e&&s(e),l.length>0){n.push(l.length+" hierarchy leaves are supplied.");for(let e of l.slice(0,r))n.push(`${It(e[o])} has value ${It(e[i])}.`)}}if(ln.has(e)&&Array.isArray(t.data)){let r=t.data;n.push(`${r.length} observed source row${1===r.length?"":"s"} are supplied.`);let a="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,i="CollisionSwarmChart"===e?"x":"value",o=r.map(e=>At(jt(e,a,i))).filter(e=>null!=e);o.length>0&&n.push(`Observed ${"string"==typeof a?a:i} ranges from ${It(Math.min(...o))} to ${It(Math.max(...o))}.`)}if(0!==n.length)return{source:"chart-props",statements:n,text:"Exact chart-prop facts: "+n.join(" ")}}function Rt(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Ot(e){return Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+""}function Ft(e,t,r,n){let a=Ct(e.settledProjection),i=Ct(t?.settledProjection);return St(r?.projectionRows,r?.aggregates,e.settledProjectionRows,e.projectionRows,a?.rows,t?.settledProjectionRows,t?.projectionRows,i?.rows,n?.binCounts)}function Dt(e){if(!e||0===e.length)return;let t=e.map((e,t)=>{let r=Ct(e);if(!r)return;let n=At(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return;let a=(r.label??r.id??r.name??"container "+(t+1))+"",i=null==r.id?void 0:r.id+"",o=At(r.secondary??r.secondaryCount),l=At(r.observed??r.observedCount);return Pt({id:i,label:a,count:n,secondary:o,secondaryLabel:"string"==typeof r.secondaryLabel?r.secondaryLabel:void 0,observed:l})}).filter(e=>null!=e);if(0===t.length)return;let r=t.reduce((e,t)=>e+t.count,0),n=t.filter(e=>e.count>0).length,a=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:r,populatedCount:n,...a?{leader:a}:{}}}function Lt(e,t){let r=e?.map((e,t)=>{let r=Ct(e);if(!r)return;let n=At(r.count)??0,a=At(r.total),i={label:(r.label??r.id??"sediment "+(t+1))+"",count:n};return null!=r.id&&(i.id=r.id+""),null!=a&&(i.total=a),i}).filter(e=>null!=e),n=kt(t?.bins)??r?.length??0,a=At(t?.count)??r?.reduce((e,t)=>e+t.count,0)??0,i=At(t?.total)??r?.reduce((e,t)=>e+(t.total??0),0),o=r?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==n||0!==a||i)return{bins:n,count:a,...null!=i&&i>0?{total:i}:{},...o?{leader:o}:{}}}function Nt(e){let t=Ct(e);return!!t&&(wt(t.world)||"simulationState"in t||"liveBodyOrder"in t)}function Tt(e){if(e)return e.filter(e=>!0===Ct(e)?.sleeping).length}function Et(e,t,r){let n=e?.filter(e=>!0===Ct(e)?.sensor).length,a=Ct(t?.observation),i=Ct(a?.sensors),o=St(r?.activeSensors);return Math.max(n??0,i?Object.keys(i).length:0,o?.length??0)||void 0}function Bt(e){let t=[],r=e.simulation,n=[r.state??(r.settled?"settled":void 0),null!=r.liveBodies?`${r.liveBodies} live ${Rt(r.liveBodies,"body")}`:void 0,null!=r.sleepingBodies?r.sleepingBodies+" sleeping":void 0,null!=r.queued?r.queued+" queued":void 0,null!=r.seed?"seed "+Ot(r.seed):void 0,r.gravity?`gravity (${Ot(r.gravity.x)}, ${Ot(r.gravity.y)})`:void 0,null!=r.fixedDt?`fixed step ${Ot(r.fixedDt)}s`:void 0,null!=r.timeScale?Ot(r.timeScale)+"x time":void 0].filter(Boolean);n.length>0&&t.push(`Physics simulation: ${n.join("; ")}.`);let a=e.geometry;if(a){let e=[null!=a.colliders?`${a.colliders} ${Rt(a.colliders,"collider")}`:void 0,null!=a.sensors?`${a.sensors} ${Rt(a.sensors,"sensor")}`:void 0,null!=a.springs?`${a.springs} ${Rt(a.springs,"spring")}`:void 0,null!=a.activeSensorPairs?`${a.activeSensorPairs} active sensor ${Rt(a.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}let i=e.aggregates;if(i){let e=i.leader,r=e?` Largest is ${e.label} with ${Ot(e.count)}.`:"";t.push(`Physics aggregates: ${Ot(i.totalCount)} settled ${Rt(i.totalCount,"body")} across ${i.rows.length} ${Rt(i.rows.length,"container")}; ${i.populatedCount} populated.${r}`)}let o=e.sediment;if(o){let e=null!=o.total?", value total "+Ot(o.total):"",r=o.leader?`; largest sediment bin is ${o.leader.label} with ${Ot(o.leader.count)}`:"";t.push(`Physics sediment: ${o.count} retained ${Rt(o.count,"body")} in ${o.bins} ${Rt(o.bins,"bin")}${e}${r}.`)}return t.join(" ")}function _t(e,t,r){if(!1===r)return;let n=wt(r)?r:void 0,a=Ct(t.physics),i=xt(n?.snapshot,a?.snapshot,t.physicsSnapshot,Nt(t.snapshot)?t.snapshot:void 0),o=xt(n?.evidence,a?.evidence,t.physicsEvidence,t.settledEvidence),l=xt(n?.config,a?.config,i?.config,t.config),s=xt(Ct(i?.world),Ct(a?.world)),c=xt(Ct(l?.kernel),Ct(s?.options)),u=St(s?.bodies),d=St(s?.colliders,l?.colliders),f=St(i?.queue,a?.queue),h=St(i?.liveBodyOrder),m=St(s?.springs),p=St(i?.activeSensorPairs),g=Dt(Ft(t,a,n,o)),y=Lt(St(n?.sediment,a?.sediment,i?.sediment),xt(n?.sedimentTotals,a?.sedimentTotals)),b=h?.length??u?.length??kt(o?.bodyCount),v=Tt(u)??kt(o?.sleepingCount),$=f?.length,w="string"==typeof i?.simulationState?i.simulationState:void 0,C="boolean"==typeof o?.settled?o.settled:w?"settled"===w:null!=b||null!=v||null!=$?null!=b&&v===b&&0===($??0):void 0,A=Ct(c?.gravity),k=At(A?.x),x=At(A?.y),S=Pt({state:w,settled:C,elapsedSeconds:At(i?.elapsedSeconds),paused:"boolean"==typeof i?.paused?i.paused:void 0,visible:"boolean"==typeof i?.visible?i.visible:void 0,seed:At(c?.seed),gravity:null!=k&&null!=x?{x:k,y:x}:void 0,fixedDt:At(l?.fixedDt??c?.fixedDt),timeScale:At(l?.timeScale),maxSubsteps:kt(l?.maxSubsteps),liveBodies:b,sleepingBodies:v,queued:$,bodyLimit:At(l?.bodyLimit),eviction:"string"==typeof l?.eviction?l.eviction:void 0}),P=Pt({colliders:d?.length,sensors:Et(d,l,s),springs:m?.length,activeSensorPairs:p?.length}),j=Object.keys(P).length>0,I=ln.has(e);if(!(Object.keys(S).length>0||j||g||y)||!I&&null==r)return;let M={simulation:S,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},R=Bt(M);return{...M,text:R}}function zt(e){return e?"fits"in e||"buildProps"in e?{family:e.family}:{family:e.family,intentScores:e.intentScores}:{}}function Vt(e,t,r={}){let n,{capability:a,audience:i,locale:o}=r,l=r.levels??["l1","l2","l3"],s=!1!==r.includeStructure,c=$e(e,a),u=je(e,t,{levels:c?[...l,"l4"]:l,locale:o,capability:a,audience:i}),{l4:d,...f}=u.levels,h=["l1","l2","l3"].map(e=>u.levels[e]).filter(Boolean).join(" "),m={levels:f,text:u.annotations?`${u.annotations} ${h}`.trim():h,...u.annotations?{annotations:u.annotations}:{}};if(c&&d){let e=zt(a);n={act:c,sentence:d,family:e.family,intentScores:e.intentScores}}let p=s?$t(e,t,{maxLeaves:r.maxLeaves,locale:o}):void 0,g=_t(e,t,r.physics),y=Mt(e,t,Math.max(1,r.maxLeaves??200)),b=[m.text,n?.sentence,g?.text,y?.text].filter(Boolean).join(" ");return{component:e,description:m,intent:n,structure:p,physics:g,facts:y,text:b}}function Ht(e,t){let r=e.trim();if(!r)throw Error(t+" must be a non-empty string.");return encodeURIComponent(r)}function qt(e,...t){return`${e}/${t.map(e=>Ht(e,"VACP ref segment")).join("/")}`}function Gt(e,t){let r="vacp://"+Ht(e,"appId"),n=qt(r,"view",t),a=e=>qt(n,"visualization",e);return{app:r,view:n,visualization:a,config:e=>qt(a(e),"config"),data:(e,t="data")=>qt(a(e),"data",t),selection:e=>qt(n,"selection",e),navigation:e=>qt(a(e),"navigation"),observation:e=>qt(a(e),"interaction","latest-observation")}}function Ut(e){let t=e.now?.()??/* @__PURE__ */new Date,r=t instanceof Date?t:new Date(t);if(!Number.isFinite(r.getTime()))throw Error("VACP bridge clock returned an invalid date.");return r.toISOString()}function Kt(e){let t="function"==typeof e?e():e,r=/* @__PURE__ */new Set;for(let e of t){let t=e.chartId.trim();if(!t)throw Error("Every VACP chart requires a non-empty chartId.");if(r.has(t))throw Error(`Duplicate VACP chartId "${t}".`);r.add(t)}return t}function Jt(e){try{let{createdAt:t,...n}=Q(e.component,e.props,{includeData:!1});return r(n)}catch(r){let n=/* @__PURE__ */Object.create(null);for(let[r,a]of Object.entries(e.props)){if(sn.includes(r)||"function"==typeof a)continue;let e=t(a);void 0!==e&&(n[r]=e)}return{component:e.component,props:n,version:"unregistered",warning:r instanceof Error?r.message:"Chart config could not be serialized by toConfig."}}}function Wt(e){return Vt(e.component,e.props,{...e.grounding,audience:e.audience,includeStructure:!0,maxLeaves:1})}function Qt(e,t){let r=[];for(let n of sn){let a=e.props[n];Array.isArray(a)&&r.push({ref:t.data(e.chartId,n),chartId:e.chartId,collection:n,rows:a})}return r}function Xt(e,t){t(e);for(let r of e.children??[])Xt(r,t)}function Yt(e,t){if(!t)return;let r;return Xt(e,e=>{!r&&e.id===t&&(r=e)}),r}function Zt(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function er(e,t){if("datum"!==e.role||!e.datum)return;let r=/* @__PURE__ */Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e.datum,n)||!Zt(e.datum[n]))return;r[n]=e.datum[n]instanceof Date?e.datum[n].toISOString():e.datum[n]}return r}function tr(e,t){let r=Array.from(new Set(e.matchFields.map(e=>e.trim()).filter(Boolean))),n=/* @__PURE__ */new Map;if(!r.length)return{valid:!1,diagnostic:"Navigation actions require at least one durable match field.",byKey:n,matchFields:r,targetRef:()=>qt(t,"target","invalid")};let a,i=0,l=0,s=!1;return Xt(e.tree,e=>{if("datum"!==e.role)return;i++;let t=er(e,r);if(!t)return void l++;let a=o(t);n.has(a)?s=!0:n.set(a,e)}),i?l?a=l+" navigation leaves lack durable primitive match-field values.":s&&(a="Navigation match fields do not uniquely identify every datum leaf."):a="Navigation tree has no datum leaves.",{valid:!a,...a?{diagnostic:a}:{},byKey:n,matchFields:r,targetRef:e=>qt(t,"target",o(e))}}function rr(e,t){let r=/* @__PURE__ */new Map;for(let t of e)for(let e of t.chart.selections??[]){let n=e.name.trim();if(!n)throw Error("VACP selection names must be non-empty.");let a=r.get(n)??{fields:/* @__PURE__ */new Set,modes:/* @__PURE__ */new Set,chartRefs:/* @__PURE__ */new Set};for(let t of e.fields.map(e=>e.trim()))t&&a.fields.add(t);if("interval"!==e.mode&&a.modes.add("point"),"point"!==e.mode&&a.modes.add("interval"),e.clientId){if(a.clientId&&a.clientId!==e.clientId)throw Error(`Selection "${n}" declares conflicting VACP clientIds.`);a.clientId=e.clientId}a.chartRefs.add(t.ref),r.set(n,a)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,r])=>{if(0===r.fields.size)throw Error(`Selection "${e}" requires at least one allowlisted field.`);return{ref:t.selection(e),name:e,fields:Array.from(r.fields).sort(),modes:r.modes,clientId:r.clientId??"__semiotic-vacp__:"+e,chartRefs:Array.from(r.chartRefs)}})}function nr(t,n){let{chart:a,ref:i,configRef:o,grounding:l}=t,s=[{ref:i,kind:"Visualization",layer:"VisualizationLayer",title:a.title??(a.props.title??a.component)+"",description:a.description??l.text,data:r({component:a.component,grounding:{description:l.description,intent:l.intent,physics:l.physics,text:l.text},audience:a.audience})},{ref:o,kind:"Param",layer:"ConfigLayer",title:a.component+" configuration",description:"Serializable Semiotic chart configuration with raw data collections omitted.",data:t.config}],c=[{from:t.ref,to:o,kind:"contains"}],u=(l.structure?.children??[]).filter(e=>"axis"===e.role).map(e=>e.label),d=0;for(let[e,t]of cn){let r=a.props[e];if("string"!=typeof r||!r.trim())continue;let n=qt(i,"encoding",t);if(s.push({ref:n,kind:"EncodingChannel",layer:"VisualizationLayer",title:`${t} → ${r}`,data:{channel:t,field:r,accessorProp:e}}),c.push({from:i,to:n,kind:"contains"}),"x"===t||"y"===t||"category"===t||"value"===t||"ordinal"===t||"radial"===t){let e=qt(i,"axis",t);s.push({ref:e,kind:"Axis",layer:"VisualizationLayer",title:u[d++]??`${t} axis: ${r}`,data:{channel:t,field:r}}),c.push({from:i,to:e,kind:"contains"}),c.push({from:e,to:n,kind:"derivedFrom"})}}for(let e of t.dataHandles)s.push({ref:e.ref,kind:"DataHandle",layer:"DataLayer",title:`${a.chartId}.${e.collection}`,description:"Bounded details-on-demand handle. Use vacp.data_schema before requesting an opt-in sample.",data:{collection:e.collection,rowCount:e.rows.length,schemaAction:Fr,...n.dataAccess?.sample?{inspectAction:Rr}:{}}}),c.push({from:i,to:e.ref,kind:"contains"});if(t.navigation){let{navigation:e}=t;s.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:(a.title??a.component)+" structured navigation",description:e.index.diagnostic??"Active accessible-navigation target identified by durable datum fields.",data:{matchFields:e.index.matchFields,targetCount:e.index.byKey.size,status:e.index.valid?e.binding.onActiveChange?"actionable":"read-only":"ambiguous"}}),c.push({from:i,to:e.ref,kind:"contains"})}if(n.getObservations){let e=qt(i,"interaction","latest-observation");s.push({ref:e,kind:"InteractionTarget",layer:"InteractionFeedbackLayer",title:(a.title??a.component)+" latest observation",description:"Latest semantic hover, focus, selection, brush, activation, or control observation."}),c.push({from:i,to:e,kind:"contains"})}let f=Array.isArray(a.props.annotations)?a.props.annotations:[],h=/* @__PURE__ */new Set;for(let t of f){if(!e(t))continue;let n=e(t.provenance)?t.provenance:void 0,o=t.id??t.stableId??n?.stableId,l=null==o||""===o?void 0:o+"";if(!l)continue;let u=e(t.note)?t.note:void 0,d=e(t.noteData)?t.noteData:void 0,f=qt(i,"annotation",l);if(h.has(f))throw Error(`Duplicate stable annotation id "${l.trim()}" in VACP chart "${a.chartId}".`);h.add(f),s.push({ref:f,kind:"InteractionTarget",layer:"VisualizationLayer",title:(t.label??u?.label??d?.label??"Annotation "+l)+"",description:"string"==typeof t.note?t.note:"string"==typeof t.description?t.description:void 0,data:r({id:l,provenance:n,lifecycle:t.lifecycle})}),c.push({from:i,to:f,kind:"contains"})}return{nodes:s,edges:c}}function ar(e,t){let r=Kt(e.charts).map(e=>{let r=t.visualization(e.chartId),n=e.navigation?{ref:t.navigation(e.chartId),chartRef:r,chartId:e.chartId,binding:e.navigation,index:tr(e.navigation,t.navigation(e.chartId))}:void 0;return{chart:e,ref:r,configRef:t.config(e.chartId),grounding:Wt(e),config:Jt(e),dataHandles:Qt(e,t),...n?{navigation:n}:{}}}),n=rr(r,t),a=r.flatMap(e=>e.dataHandles),i=[{ref:t.app,kind:"App",layer:"ViewLayer",title:e.title??e.appId,description:"Semiotic application state exposed through the experimental VACP 0.1.0 bridge.",data:{provider:"semiotic",protocol:Or}},{ref:t.view,kind:"View",layer:"ViewLayer",title:e.title??e.viewId??"Semiotic charts"}],o=[{from:t.app,to:t.view,kind:"contains"}];for(let n of r){let r=nr(n,e);i.push(...r.nodes),o.push(...r.edges),o.push({from:t.view,to:n.ref,kind:"contains"})}for(let e of n){i.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:"Selection: "+e.name,description:"Named LinkedCharts selection. Agent mutations are restricted to declared fields and modes.",data:{name:e.name,fields:e.fields,modes:Array.from(e.modes).sort()}}),o.push({from:t.view,to:e.ref,kind:"contains"});for(let t of e.chartRefs)o.push({from:e.ref,to:t,kind:"controls"})}return{charts:r,selections:n,dataHandles:a,nodes:i,edges:o}}function ir(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.chartId===t)return n}}function or(e,t,n){let a={},i={},o=t.getSelections?.()??{},l=t.getObservations?.()??[];for(let o of e.charts){a[o.ref]=r({component:o.chart.component,description:o.grounding.description,intent:o.grounding.intent,physics:o.grounding.physics,audience:o.chart.audience}),a[o.configRef]=o.config,i[o.ref]={component:o.chart.component,dataHandles:o.dataHandles.length};for(let e of o.dataHandles)a[e.ref]={kind:"DataHandle",collection:e.collection,rowCount:e.rows.length},i[e.ref]={rowCount:e.rows.length};if(o.navigation){let e=Yt(o.navigation.binding.tree,o.navigation.binding.activeId),t=e?er(e,o.navigation.index.matchFields):void 0;a[o.navigation.ref]=r({kind:"Selection",status:o.navigation.index.valid?"ready":"ambiguous",activeRole:e?.role,activeLabel:e?.label,activeMatch:t,activeTargetRef:t?o.navigation.index.targetRef(t):void 0,diagnostic:o.navigation.index.diagnostic}),i[o.navigation.ref]={targetCount:o.navigation.index.byKey.size}}if(t.getObservations){let e=ir(l,o.chart.chartId);a[n.observation(o.chart.chartId)]=e?r(e):null,e&&(i[n.observation(o.chart.chartId)]={type:e.type,timestamp:e.timestamp})}}for(let t of e.selections){let e=o[t.name];a[t.ref]=(e?r(e):void 0)??{name:t.name,resolution:"union",clauses:[]},i[t.ref]={active:!!e?.clauses.length,clauseCount:e?.clauses.length??0,fields:t.fields}}return{version:Or,createdAt:Ut(t),state:a,...Object.keys(i).length?{summary:i}:{}}}function lr(e,t){let r=ar(e,t);return{...r,actions:I(r,e,t)}}function sr(e){let r=e.viewId?.trim()||"main",n=Gt(e.appId,r),a="number"==typeof e.stateCacheSize&&Number.isFinite(e.stateCacheSize)?Math.max(1,Math.floor(e.stateCacheSize)):64,i=/* @__PURE__ */new Map,o=(e,t)=>{for(i.has(e)&&i.delete(e),i.set(e,t);i.size>a;){let e=i.keys().next().value;if("string"!=typeof e)break;i.delete(e)}};return{version:Or,refs:n,getCapabilities:t=>{let r=lr(e,n),a={version:Or,createdAt:Ut(e),graph:{version:Or,nodes:r.nodes,edges:r.edges,actions:r.actions.map(e=>e.descriptor)}};return t?m(a,t):a},getState:async function(t){let r=or(lr(e,n),e,n);if(!t)return r;let a,{snapshot:s,refs:c}=u(r,t),f=l(s),h=t.since?i.get(t.since):void 0;if("full"!==t.mode&&t.since&&h){let e=u(h,t).snapshot;a={version:Or,createdAt:s.createdAt,mode:"delta",token:f,baseToken:t.since,...c?{scope:{refs:c}}:{},delta:d(e,s)}}else a={version:Or,createdAt:s.createdAt,mode:"full",token:f,...c?{scope:{refs:c}}:{},snapshot:s};return o(f,r),a},execute:async r=>{let a=r&&"string"==typeof r.callId?r.callId:"";try{if(!r||"string"!=typeof r.name||!r.name.trim())throw Error("VACP action call requires a non-empty name.");if(!a)throw Error("VACP action call requires a callId.");let i=lr(e,n),o=i.actions.find(e=>e.descriptor.name===r.name);if(!o)return{callId:a,ok:!1,error:{message:`Unknown or currently unavailable VACP action "${r.name}".`,details:{available:i.actions.map(e=>e.descriptor.name)}}};let l=t(await o.execute(r.params));return{callId:a,ok:!0,...void 0!==l?{result:l}:{}}}catch(e){return{callId:a,ok:!1,error:{message:e instanceof Error?e.message:"VACP action failed."}}}}}}function cr(e,t={}){let r=t.globalKey?.trim()||"__vacp",n=t.target??("u">typeof window?window:void 0);if(!n)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to install "${r}" without a browser window or an explicit target.`,cleanup:()=>!1};if("__proto__"===r||"prototype"===r||"constructor"===r)return{installed:!1,globalKey:r,bridge:e,reason:`Refused unsafe global key "${r}".`,cleanup:()=>!1};let a=n[r];if(void 0!==a&&a!==e)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to replace existing global "${r}".`,cleanup:()=>!1};try{n[r]=e}catch(t){return{installed:!1,globalKey:r,bridge:e,reason:t instanceof Error?`Could not install "${r}": ${t.message}`:`Could not install "${r}".`,cleanup:()=>!1}}return{installed:!0,globalKey:r,bridge:e,cleanup:()=>{if(n[r]!==e)return!1;try{return delete n[r]}catch{return!1}}}}import{A as ur,E as dr,b as fr,c as hr,e as mr,f as pr,g as gr,h as yr,i as br,m as vr,n as $r,q as wr,t as Cr,u as Ar,v as kr,w as xr,z as Sr}from"./c-4XLHPQTP.min.js";import"./c-FOTTQHOO.min.js";var Pr="semiotic.set_point_selection",jr="semiotic.set_interval_selection",Ir="semiotic.clear_selection",Mr="semiotic.activate_navigation_node",Rr="semiotic.inspect_data",Or="0.1.0",Fr="vacp.data_schema",Dr=["MotifBraidChart","DependencyForestChart","FlowCircuitChart","BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","RadarChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","WaterfallChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],Lr=new Set(Dr),Nr=/* @__PURE__ */Symbol.for("semiotic.chartRecipeRegistry"),Tr="1",Er=/* @__PURE__ */new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),Br="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e)),_r=/* @__PURE__ */new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),zr=/* @__PURE__ */new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Vr=/* @__PURE__ */new Set(["PieChart","DonutChart","FunnelChart"]),Hr=/* @__PURE__ */new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]),qr={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",BumpChart:"bump chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},Gr=/* @__PURE__ */new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),Ur=/* @__PURE__ */new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),Kr=/* @__PURE__ */new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Jr={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Wr={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Qr=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Xr={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"},Yr=/* @__PURE__ */new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),Zr=/* @__PURE__ */new Set(["system","agent","watcher"]),en=/* @__PURE__ */new Set(["ai","agent","system","computed","dbt","great-expectations"]),tn=/* @__PURE__ */new Set(["rule","statistical-test","llm-inference","computed"]),rn={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"},nn=/* @__PURE__ */new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),an=/* @__PURE__ */new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),on=/* @__PURE__ */new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),ln=/* @__PURE__ */new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),sn=["data","nodes","edges","points","areas","lines","flows"],cn=[["xAccessor","x"],["yAccessor","y"],["categoryAccessor","category"],["valueAccessor","value"],["colorBy","color"],["sizeAccessor","size"],["lineBy","series"],["groupAccessor","group"],["oAccessor","ordinal"],["rAccessor","radial"],["sourceAccessor","source"],["targetAccessor","target"],["nodeIDAccessor","id"]];export{Mr as unstable_SEMIOTIC_VACP_ACTIVATE_NAVIGATION_ACTION,Ir as unstable_SEMIOTIC_VACP_CLEAR_SELECTION_ACTION,Rr as unstable_SEMIOTIC_VACP_INSPECT_DATA_ACTION,jr as unstable_SEMIOTIC_VACP_SET_INTERVAL_SELECTION_ACTION,Pr as unstable_SEMIOTIC_VACP_SET_POINT_SELECTION_ACTION,Fr as unstable_VACP_DATA_SCHEMA_ACTION,Or as unstable_VACP_SCHEMA_VERSION,sr as unstable_createSemioticVACPBridge,cr as unstable_installSemioticVACPBridge};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{LineChart as m}from"./c-GSZRZRD6.min.js";import"./c-D6HAAPTX.min.js";import"./c-KCRJGUHP.min.js";import"./c-MXCP7GNZ.min.js";import"./c-ZYPXQF7B.min.js";import"./c-P65V6HLO.min.js";import"./c-ORLEBW72.min.js";import"./c-QAVFOEUY.min.js";import"./c-CPSPZH6A.min.js";import"./c-NYZ2QNAM.min.js";import"./c-ROEHCIGV.min.js";import"./c-AVO3Q7T7.min.js";import"./c-BNG5ECK5.min.js";import"./c-TKG2NP7G.min.js";import"./c-OO5QLMJC.min.js";import"./c-V4XMSLC3.min.js";import"./c-2N7IU2NY.min.js";import"./c-YLZIV3VS.min.js";import"./c-ITKX3RC5.min.js";import"./c-YDECTEUW.min.js";import"./c-W4ZUKSEQ.min.js";import"./c-LMGSSD2E.min.js";import"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import"./c-QA3HMQJP.min.js";import"./c-553QUDKA.min.js";export{m as LineChart};
2
+ import{e as i}from"./c-7ASK4WBF.min.js";import"./c-IBRLFKWA.min.js";import"./c-HQ27AHMC.min.js";import"./c-TTKWXGAI.min.js";import"./c-VN557BQE.min.js";import"./c-MTX2AO5S.min.js";import"./c-R2HUSWKB.min.js";import"./c-7FKPPCGN.min.js";import"./c-STHZWF3D.min.js";import"./c-TVKZC4BY.min.js";import"./c-GYLOSK7M.min.js";import"./c-UUDAON4Z.min.js";import"./c-2TW5H5PD.min.js";import"./c-HK4OSLZA.min.js";import"./c-VXIYF7V2.min.js";import"./c-NATWERHZ.min.js";import"./c-P5NXQWIM.min.js";import"./c-BYJJ7EMG.min.js";import"./c-TIDKVMMZ.min.js";import"./c-QXLDCATV.min.js";import"./c-U5XVLSHN.min.js";import"./c-KGROWFT2.min.js";import"./c-V5KFJWQQ.min.js";import"./c-CLLCX3PT.min.js";import"./c-G53AVC42.min.js";import"./c-Y342FJ6K.min.js";import"./c-3BYZXCX3.min.js";import"./c-JXVYIXTV.min.js";import"./c-5NYONM6V.min.js";import"./c-U6NLVFN4.min.js";import"./c-3PFVJFBK.min.js";export{i as LineChart};
@@ -12,6 +12,9 @@ import { RingBuffer } from "./components/realtime/RingBuffer";
12
12
  import { IncrementalExtent } from "./components/realtime/IncrementalExtent";
13
13
  import { RunningStats } from "./components/realtime/RunningStats";
14
14
  import { WindowAccumulator, statValue, bandBounds } from "./components/realtime/WindowAccumulator";
15
+ import { TDigest } from "./components/realtime/TDigest";
16
+ import { HyperLogLog } from "./components/realtime/HyperLogLog";
17
+ import { applyChangelog } from "./components/realtime/applyChangelog";
15
18
  import { parseWindowDuration } from "./components/realtime/parseWindowDuration";
16
19
  import { ReorderBuffer } from "./components/realtime/ReorderBuffer";
17
20
  import { RealtimeLineChart } from "./components/charts/realtime/RealtimeLineChart";
@@ -20,10 +23,11 @@ import { RealtimeSwarmChart } from "./components/charts/realtime/RealtimeSwarmCh
20
23
  import { RealtimeWaterfallChart } from "./components/charts/realtime/RealtimeWaterfallChart";
21
24
  import { RealtimeHeatmap } from "./components/charts/realtime/RealtimeHeatmap";
22
25
  export { registerBuiltInXYPlugins } from "./components/stream/xyPlugins/registerBuiltIn";
23
- export { StreamXYFrame, StreamNetworkFrame, RingBuffer, IncrementalExtent, RunningStats, WindowAccumulator, statValue, bandBounds, parseWindowDuration, ReorderBuffer, RealtimeLineChart, RealtimeHistogram, TemporalHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap };
26
+ export { StreamXYFrame, StreamNetworkFrame, RingBuffer, IncrementalExtent, RunningStats, WindowAccumulator, statValue, bandBounds, TDigest, HyperLogLog, applyChangelog, parseWindowDuration, ReorderBuffer, RealtimeLineChart, RealtimeHistogram, TemporalHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap };
24
27
  export { Tooltip, TooltipRoot, MultiLineTooltip, MultiPointTooltip, markTooltipChrome, } from "./components/Tooltip/Tooltip";
25
28
  export type { TooltipProp, TooltipConfig, TooltipField, MultiLineTooltipConfig, MultiTooltipConfig, TooltipRootProps, TooltipChromeMode, } from "./components/Tooltip/Tooltip";
26
29
  export type { WindowType, AggregateStat, AggregateBand, WindowAccumulatorConfig, AggregatedWindow, } from "./components/realtime/WindowAccumulator";
30
+ export type { ChangelogOp, ApplyChangelogOptions, ApplyChangelogResult, } from "./components/realtime/applyChangelog";
27
31
  export type { AggregateConfig, AggregatedRealtimeDatum } from "./components/charts/realtime/aggregate";
28
32
  export type { LatePolicy, ReorderBufferConfig, ReorderResult, } from "./components/realtime/ReorderBuffer";
29
33
  export type { EventTimeConfig } from "./components/charts/realtime/eventTime";
@@ -35,7 +39,7 @@ export type { RealtimeWaterfallChartProps } from "./components/charts/realtime/R
35
39
  export type { RealtimeHeatmapProps } from "./components/charts/realtime/RealtimeHeatmap";
36
40
  export type { FrameTextAnnotation, FrameTextPosition, } from "./components/charts/shared/frameTextAnnotation";
37
41
  export type { ArrowOfTime, WindowMode, ThresholdType, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, AnnotationContext, CrosshairStyle, HoverAnnotationConfig, HoverData, RealtimeFrameHandle } from "./components/realtime/types";
38
- export type { Style, StreamXYFrameProps, StreamXYFrameHandle, StreamChartType } from "./components/stream/types";
42
+ export type { Style, StreamXYFrameProps, StreamXYFrameHandle, StreamChartType, SourceLiveness, StalenessConfig, DecayConfig, PulseConfig } from "./components/stream/types";
39
43
  export type { StreamNetworkFrameProps, StreamNetworkFrameHandle, NetworkChartType } from "./components/stream/networkTypes";
40
44
  export { bandFromAge, DEFAULT_LIFECYCLE_THRESHOLDS } from "./components/realtime/lifecycleBands";
41
45
  export type { LifecycleBand, LifecycleBandThresholds } from "./components/realtime/lifecycleBands";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{registerBuiltInXYPlugins as m}from"./c-7NBU5ZKS.min.js";import{RealtimeHeatmap as i,RealtimeHistogram as r,RealtimeLineChart as o,RealtimeSwarmChart as t,RealtimeWaterfallChart as s,ReorderBuffer as p,RunningStats as c,TemporalHistogram as j,WindowAccumulator as n,bandBounds as Q,parseWindowDuration as E,statValue as X}from"./c-XDQKXPX4.min.js";import"./c-JO2UGTCP.min.js";import"./c-33QOXEUG.min.js";import"./c-WNGH47HF.min.js";import{StreamXYFrame_default as C}from"./c-MXCP7GNZ.min.js";import"./c-ZYPXQF7B.min.js";import"./c-P65V6HLO.min.js";import"./c-ORLEBW72.min.js";import"./c-QAVFOEUY.min.js";import"./c-CPSPZH6A.min.js";import"./c-NYZ2QNAM.min.js";import"./c-DE5Q3U2X.min.js";import"./c-DK662R77.min.js";import{IncrementalExtent as K}from"./c-ROEHCIGV.min.js";import"./c-AVO3Q7T7.min.js";import{RingBuffer as N}from"./c-BNG5ECK5.min.js";import"./c-TKG2NP7G.min.js";import"./c-OO5QLMJC.min.js";import{StreamNetworkFrame_default as O}from"./c-TIXX5CAU.min.js";import"./c-MVR3RWF3.min.js";import"./c-V4XMSLC3.min.js";import"./c-HXDKPIKR.min.js";import"./c-4FN7Q6VQ.min.js";import"./c-2N7IU2NY.min.js";import"./c-YLZIV3VS.min.js";import"./c-ITKX3RC5.min.js";import"./c-YDECTEUW.min.js";import"./c-W4ZUKSEQ.min.js";import"./c-EUBTECGM.min.js";import{DEFAULT_LIFECYCLE_THRESHOLDS as U,MultiLineTooltip as V,MultiPointTooltip as P,Tooltip as G,TooltipRoot as S,bandFromAge as T,compileMotionEncoding as A,deriveMotionVector as D,markTooltipChrome as L,opacityFromAge as M,resolveMotionAccessor as f,resolveMotionVector as F}from"./c-LMGSSD2E.min.js";import"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import"./c-QA3HMQJP.min.js";import"./c-553QUDKA.min.js";export{U as DEFAULT_LIFECYCLE_THRESHOLDS,K as IncrementalExtent,V as MultiLineTooltip,P as MultiPointTooltip,i as RealtimeHeatmap,r as RealtimeHistogram,o as RealtimeLineChart,t as RealtimeSwarmChart,s as RealtimeWaterfallChart,p as ReorderBuffer,N as RingBuffer,c as RunningStats,O as StreamNetworkFrame,C as StreamXYFrame,j as TemporalHistogram,G as Tooltip,S as TooltipRoot,n as WindowAccumulator,Q as bandBounds,T as bandFromAge,A as compileMotionEncoding,D as deriveMotionVector,L as markTooltipChrome,M as opacityFromAge,E as parseWindowDuration,m as registerBuiltInXYPlugins,f as resolveMotionAccessor,F as resolveMotionVector,X as statValue};
2
+ function i(i,t){if("string"==typeof i.id&&i.id.length>0)return i.id;if(!i.row)return;if("function"==typeof t)return t(i.row);let s=i.row[t];return null==s?void 0:s+""}function t(i,t){let s=/* @__PURE__ */new Set;for(let o of i){let i="function"==typeof t?t(o):o[t];null!=i&&s.add(i+"")}return s}function s(s,o,a){let r=!1!==a.coalesce?Array.from(o.reduce((t,s)=>{let o=i(s,a.key);return o&&(t.delete(o),t.set(o,s)),t},/* @__PURE__ */new Map).values()):[...o],m=t(s.getData(),a.key),e=[],n=0,p=0,c=0,l=()=>{0!==e.length&&(s.pushMany(e),c+=e.length,n+=e.length,e.length=0)};for(let t of r){let o=i(t,a.key);if(o){if("delete"===t.op||"retract"===t.op){l(),s.remove(o),m.delete(o),p+=1,c+=1;continue}t.row&&(m.has(o)?(l(),s.update(o,()=>t.row).length>0?(n+=1,c+=1):e.push(t.row)):(e.push(t.row),m.add(o)))}}return l(),{applied:c,upserts:n,retracts:p}}import{a as o}from"./c-BQYD7T4E.min.js";import{a,b as r,c as m,d as e,e as n,f as p,g as c,h as l,i as j,j as u,k as f,m as T,n as d,o as g}from"./c-F2GGJB2S.min.js";import"./c-C4KIXUWU.min.js";import"./c-AXJ2QI3F.min.js";import"./c-CLDCKFBE.min.js";import{d as F}from"./c-TTKWXGAI.min.js";import"./c-VN557BQE.min.js";import"./c-MTX2AO5S.min.js";import"./c-R2HUSWKB.min.js";import"./c-7FKPPCGN.min.js";import"./c-STHZWF3D.min.js";import"./c-TVKZC4BY.min.js";import"./c-GYLOSK7M.min.js";import"./c-UUDAON4Z.min.js";import"./c-PKY4JFY5.min.js";import"./c-SQNEVNWT.min.js";import{b as V}from"./c-2TW5H5PD.min.js";import"./c-HK4OSLZA.min.js";import{a as h}from"./c-VXIYF7V2.min.js";import"./c-NATWERHZ.min.js";import"./c-P5NXQWIM.min.js";import{b as C}from"./c-SG2Y7EBY.min.js";import"./c-YMFUIO54.min.js";import"./c-BYJJ7EMG.min.js";import"./c-TIDKVMMZ.min.js";import"./c-TIMGODBG.min.js";import"./c-3AGX252H.min.js";import"./c-QXLDCATV.min.js";import"./c-U5XVLSHN.min.js";import"./c-KGROWFT2.min.js";import"./c-V5KFJWQQ.min.js";import"./c-CLLCX3PT.min.js";import"./c-N5WT7TXG.min.js";import{Aa as M,Oa as X,Pa as Y,Ua as A,g as L,h as S,i as B,j as K,l as N,m as W,n as w,za as D}from"./c-G53AVC42.min.js";import"./c-Y342FJ6K.min.js";import"./c-3BYZXCX3.min.js";import"./c-JXVYIXTV.min.js";import"./c-5NYONM6V.min.js";import"./c-U6NLVFN4.min.js";import"./c-3PFVJFBK.min.js";export{L as DEFAULT_LIFECYCLE_THRESHOLDS,r as HyperLogLog,V as IncrementalExtent,Y as MultiLineTooltip,A as MultiPointTooltip,g as RealtimeHeatmap,u as RealtimeHistogram,j as RealtimeLineChart,T as RealtimeSwarmChart,d as RealtimeWaterfallChart,l as ReorderBuffer,h as RingBuffer,a as RunningStats,C as StreamNetworkFrame,F as StreamXYFrame,m as TDigest,f as TemporalHistogram,X as Tooltip,D as TooltipRoot,e as WindowAccumulator,s as applyChangelog,p as bandBounds,S as bandFromAge,K as compileMotionEncoding,w as deriveMotionVector,M as markTooltipChrome,N as opacityFromAge,c as parseWindowDuration,o as registerBuiltInXYPlugins,B as resolveMotionAccessor,W as resolveMotionVector,n as statValue};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- function e(e={}){let{staleThresholdMs:r=5e3,pollIntervalMs:t=1e3}=e,i=a(null),[h,p]=s("idle"),[f,c]=s(null),m=n(()=>{let e="u">typeof performance?performance.now():Date.now();i.current=e,c(e),p(e=>"active"===e?e:"active")},[]),y=l(()=>{let e={_frame:null,_origPush:null,_origPushMany:null};return{get current(){return e._frame},set current(r){let t=e._frame;if(t&&t!==r&&e._origPush&&e._origPushMany&&(t.push=e._origPush,t.pushMany=e._origPushMany,delete t[o]),e._frame=r,!r)return e._origPush=null,void(e._origPushMany=null);if(r[o])return;r[o]=!0;let n=r.push,u=r.pushMany,l=n.bind(r),a=u.bind(r);e._origPush=n,e._origPushMany=u,r.push=e=>(m(),l(e)),r.pushMany=e=>(e&&e.length>0&&m(),a(e))}}},[m]);return u(()=>{let e=setInterval(()=>{let e=i.current;if(null==e)return;let t=("u">typeof performance?performance.now():Date.now())-e>r;p(e=>{let r=t?"stale":"active";return e===r?e:r})},t);return()=>clearInterval(e)},[r,t]),{ref:y,status:h,lastPushTime:f}}function r(e,r,t,n){let u=new Map;t.forEach((e,r)=>{u.set(n?n(e,r):r+"",e)});let l=[];r.forEach((e,r)=>{u.has(r)||l.push(r)}),l.length>0&&e.remove?.(l);let a=[];if(u.forEach((t,n)=>{let u=r.get(n);void 0===u?a.push(t):u!==t&&(e.update?e.update(n,()=>t):(e.remove?.(n),a.push(t)))}),a.length>0)if(e.pushMany)e.pushMany(a);else if(e.push)for(let r of a)e.push(r);return u}function t(e,t,n={}){let{id:u,resetKey:l}=n,a=h(()=>function(e){return null==e?null:"function"==typeof e?(r,t)=>{let n=e(r,t);return null==n?t+"":n+""}:(r,t)=>{let n=r[e];return null==n?t+"":n+""}}(u),[u]),s=p({map:new Map,handle:null,resetKey:void 0});i(()=>{let n=e.current;if(!n)return;let u=s.current;(u.handle!==n||u.resetKey!==l)&&(n.clear?.(),u.map=new Map,u.handle=n,u.resetKey=l),u.map=r(n,u.map,t,a)},[e,t,a,l])}import{useCallback as n,useEffect as u,useMemo as l,useRef as a,useState as s}from"react";var o=Symbol("semiotic.useStreamStatus.wrapped");import{useEffect as i,useMemo as h,useRef as p}from"react";export{r as syncPushBuffer,e as useStreamStatus,t as useSyncedPushData};
2
+ function e(e={}){let{staleThresholdMs:t=5e3,pollIntervalMs:r=1e3}=e,u=l(null),[h,i]=o("idle"),[p,c]=o(null),m=n(()=>{let e="u">typeof performance?performance.now():Date.now();u.current=e,c(e),i(e=>"active"===e?e:"active")},[]),y=s(()=>{let e={_frame:null,_origPush:null,_origPushMany:null};return{get current(){return e._frame},set current(t){let r=e._frame;if(r&&r!==t&&e._origPush&&e._origPushMany&&(r.push=e._origPush,r.pushMany=e._origPushMany,delete r[f]),e._frame=t,!t)return e._origPush=null,void(e._origPushMany=null);if(t[f])return;t[f]=!0;let u=t.push,n=t.pushMany,a=u.bind(t),s=n.bind(t);e._origPush=u,e._origPushMany=n,t.push=e=>(m(),a(e)),t.pushMany=e=>(e&&e.length>0&&m(),s(e))}}},[m]);return a(()=>{let e=setInterval(()=>{let e=u.current;if(null==e)return;let r=("u">typeof performance?performance.now():Date.now())-e>t;i(e=>{let t=r?"stale":"active";return e===t?e:t})},r);return()=>clearInterval(e)},[t,r]),{ref:y,status:h,lastPushTime:p}}function t(e){return null==e?null:"function"==typeof e?(t,r)=>{let u=e(t,r);return null==u?r+"":u+""}:(t,r)=>{let u=t[e];return null==u?r+"":u+""}}function r(e,t,r,u){let n=/* @__PURE__ */new Map;r.forEach((e,t)=>{n.set(u?u(e,t):t+"",e)});let a=[];t.forEach((e,t)=>{n.has(t)||a.push(t)}),a.length>0&&e.remove?.(a);let s=[];if(n.forEach((r,u)=>{let n=t.get(u);void 0===n?s.push(r):n!==r&&(e.update?e.update(u,()=>r):(e.remove?.(u),s.push(r)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(let t of s)e.push(t);return n}function u(e,u,n={}){let{id:a,resetKey:s}=n,l=i(()=>t(a),[a]),o=p({map:/* @__PURE__ */new Map,handle:null,resetKey:void 0});h(()=>{let t=e.current;if(!t)return;let n=o.current;(n.handle!==t||n.resetKey!==s)&&(t.clear?.(),n.map=/* @__PURE__ */new Map,n.handle=t,n.resetKey=s),n.map=r(t,n.map,u,l)},[e,u,l,s])}import{useCallback as n,useEffect as a,useMemo as s,useRef as l,useState as o}from"react";var f=/* @__PURE__ */Symbol("semiotic.useStreamStatus.wrapped");import{useEffect as h,useMemo as i,useRef as p}from"react";export{r as syncPushBuffer,e as useStreamStatus,u as useSyncedPushData};