semiotic 3.8.9 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/README.md +55 -81
  2. package/agent-skill/semiotic-charts/SKILL.md +11 -2
  3. package/ai/behaviorContracts.cjs +33 -3
  4. package/ai/cli.js +53 -2
  5. package/ai/componentMetadata.cjs +15 -0
  6. package/ai/dist/mcp-server.js +1530 -611
  7. package/ai/examples.md +48 -42
  8. package/{CLAUDE.md → ai/reference.md} +43 -22
  9. package/ai/schema.json +10603 -986
  10. package/ai/surface-manifest.json +643 -2
  11. package/ai/system-prompt.md +83 -130
  12. package/dist/c-3BLJEQNG.min.js +1 -0
  13. package/dist/c-3KZD6AXJ.min.js +1 -0
  14. package/dist/c-4TWEX5HG.min.js +1 -0
  15. package/dist/c-52TEGIUJ.min.js +1 -0
  16. package/dist/c-5YCIX3VZ.min.js +1 -0
  17. package/dist/c-6FEKTA3U.min.js +1 -0
  18. package/dist/c-6O5EVOPH.min.js +1 -0
  19. package/dist/c-74HEEZGK.min.js +1 -0
  20. package/dist/c-AKAF6JAD.min.js +1 -0
  21. package/dist/c-BBKITSXB.min.js +1 -0
  22. package/dist/c-BWNB6USU.min.js +1 -0
  23. package/dist/c-C25ENHIK.min.js +1 -0
  24. package/dist/c-CDR5AO3R.min.js +1 -0
  25. package/dist/c-COHXCW3Q.min.js +1 -0
  26. package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
  27. package/dist/c-E3JFRRMI.min.js +1 -0
  28. package/dist/c-EBFPQHHO.min.js +1 -0
  29. package/dist/c-G36WS6LN.min.js +1 -0
  30. package/dist/c-GIKRQI4X.min.js +1 -0
  31. package/dist/c-GPYOFETM.min.js +1 -0
  32. package/dist/c-IDUHYYSI.min.js +1 -0
  33. package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
  34. package/dist/c-J5G56TUH.min.js +1 -0
  35. package/dist/c-JAZ73J32.min.js +1 -0
  36. package/dist/c-KG3NXHAL.min.js +1 -0
  37. package/dist/c-KII3PLZE.min.js +1 -0
  38. package/dist/c-LIXGXMNS.min.js +1 -0
  39. package/dist/c-LVEY6D6B.min.js +1 -0
  40. package/dist/c-M4Y3BHFR.min.js +1 -0
  41. package/dist/c-MAIICR2Z.min.js +1 -0
  42. package/dist/c-MG5DM6VE.min.js +1 -0
  43. package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
  44. package/dist/c-MT3WBK7M.min.js +1 -0
  45. package/dist/c-NY3JWV2K.min.js +1 -0
  46. package/dist/c-O6U6K4CW.min.js +1 -0
  47. package/dist/c-OCI56QF2.min.js +1 -0
  48. package/dist/c-OQ7M4AGV.min.js +1 -0
  49. package/dist/c-OXYMVK7Q.min.js +1 -0
  50. package/dist/c-PPWDL5ZI.min.js +1 -0
  51. package/dist/c-QHF5YON3.min.js +1 -0
  52. package/dist/c-RR3GO5SW.min.js +1 -0
  53. package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
  54. package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
  55. package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
  56. package/dist/c-SUILCHWU.min.js +1 -0
  57. package/dist/c-TZW3JGJ5.min.js +1 -0
  58. package/dist/c-US5ZFT6E.min.js +1 -0
  59. package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
  60. package/dist/c-UUKVD4WB.min.js +1 -0
  61. package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
  62. package/dist/c-W3CE4A4S.min.js +1 -0
  63. package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
  64. package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
  65. package/dist/c-YDAY2WFR.min.js +1 -0
  66. package/dist/c-ZOWWU34K.min.js +1 -0
  67. package/dist/components/AccessibleNavTree.d.ts +1 -1
  68. package/dist/components/CategoryColors.d.ts +1 -1
  69. package/dist/components/GradientLegend.d.ts +14 -0
  70. package/dist/components/Legend.d.ts +2 -7
  71. package/dist/components/LinkedCharts.d.ts +1 -1
  72. package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
  73. package/dist/components/ObservationReadout.d.ts +45 -0
  74. package/dist/components/ThemeProvider.d.ts +4 -4
  75. package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
  76. package/dist/components/Tooltip/Tooltip.d.ts +30 -5
  77. package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
  78. package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
  79. package/dist/components/ai/chartClinic.d.ts +2 -0
  80. package/dist/components/ai/deriveProfileFields.d.ts +40 -0
  81. package/dist/components/ai/evaluateChart.d.ts +85 -0
  82. package/dist/components/ai/fieldPolicy.d.ts +7 -0
  83. package/dist/components/ai/fieldRoles.d.ts +24 -0
  84. package/dist/components/ai/generativeChart.d.ts +18 -2
  85. package/dist/components/ai/inferIntent.d.ts +26 -2
  86. package/dist/components/ai/intents.d.ts +35 -0
  87. package/dist/components/ai/navigationTree.d.ts +2 -2
  88. package/dist/components/ai/observedSceneAudit.d.ts +2 -1
  89. package/dist/components/ai/profileData.d.ts +11 -0
  90. package/dist/components/ai/repairChartConfig.d.ts +2 -3
  91. package/dist/components/ai/semanticEvidence.d.ts +4 -0
  92. package/dist/components/ai/semanticViability.d.ts +11 -0
  93. package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
  94. package/dist/components/ai/streamingTypes.d.ts +4 -0
  95. package/dist/components/ai/suggestCharts.d.ts +5 -6
  96. package/dist/components/ai/suggestDashboard.d.ts +2 -3
  97. package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
  98. package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
  99. package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
  100. package/dist/components/ai/variantDiscovery.d.ts +3 -1
  101. package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
  102. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
  103. package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
  104. package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
  105. package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
  106. package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
  107. package/dist/components/charts/index.d.ts +4 -3
  108. package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
  109. package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
  110. package/dist/components/charts/network/Treemap.d.ts +2 -1
  111. package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
  112. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
  113. package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
  114. package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
  115. package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
  116. package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
  117. package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
  118. package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
  119. package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
  120. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
  121. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  122. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
  123. package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
  124. package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
  125. package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
  126. package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
  127. package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
  128. package/dist/components/charts/physics/chainReactionTypes.d.ts +5 -1
  129. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
  130. package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
  131. package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
  132. package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
  133. package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
  134. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  135. package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
  136. package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
  137. package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
  138. package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
  139. package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
  140. package/dist/components/charts/physics/physicsHocUtils.d.ts +25 -12
  141. package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
  142. package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
  143. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +15 -12
  144. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  145. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +35 -14
  146. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +21 -14
  147. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +20 -13
  148. package/dist/components/charts/realtime/aggregate.d.ts +4 -1
  149. package/dist/components/charts/realtime/eventTime.d.ts +4 -0
  150. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
  151. package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
  152. package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
  153. package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
  154. package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
  155. package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
  156. package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
  157. package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
  158. package/dist/components/charts/shared/annotationRules.d.ts +1 -15
  159. package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
  160. package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
  161. package/dist/components/charts/shared/chartMode.d.ts +3 -2
  162. package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
  163. package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
  164. package/dist/components/charts/shared/gradient.d.ts +16 -0
  165. package/dist/components/charts/shared/hatchFill.d.ts +15 -0
  166. package/dist/components/charts/shared/hooks.d.ts +4 -4
  167. package/dist/components/charts/shared/legendUtils.d.ts +1 -0
  168. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -1
  169. package/dist/components/charts/shared/styleRules.d.ts +9 -2
  170. package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
  171. package/dist/components/charts/shared/types.d.ts +18 -9
  172. package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
  173. package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
  174. package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
  175. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
  176. package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
  177. package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
  178. package/dist/components/charts/value/types.d.ts +1 -1
  179. package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
  180. package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
  181. package/dist/components/charts/xy/BumpChart.d.ts +13 -73
  182. package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
  183. package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
  184. package/dist/components/charts/xy/LineChart.d.ts +2 -2
  185. package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
  186. package/dist/components/charts/xy/bumpData.d.ts +44 -0
  187. package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
  188. package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
  189. package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
  190. package/dist/components/legendLayout.d.ts +131 -4
  191. package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
  192. package/dist/components/realtime/types.d.ts +10 -1
  193. package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
  194. package/dist/components/recipes/directedReachability.d.ts +14 -0
  195. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
  196. package/dist/components/recipes/gridObservatory.d.ts +1 -1
  197. package/dist/components/recipes/networkAnalysis.d.ts +1 -18
  198. package/dist/components/recipes/physics.d.ts +7 -4
  199. package/dist/components/recipes/processPhysics.d.ts +0 -1
  200. package/dist/components/recipes/waffle.d.ts +7 -4
  201. package/dist/components/semiotic-ai-core.d.ts +13 -4
  202. package/dist/components/semiotic-ai-observations.d.ts +3 -0
  203. package/dist/components/semiotic-ai.d.ts +16 -9
  204. package/dist/components/semiotic-client-shared.d.ts +10 -0
  205. package/dist/components/semiotic-experimental.d.ts +1 -1
  206. package/dist/components/semiotic-geo.d.ts +4 -1
  207. package/dist/components/semiotic-network.d.ts +7 -4
  208. package/dist/components/semiotic-ordinal.d.ts +4 -1
  209. package/dist/components/semiotic-physics.d.ts +11 -4
  210. package/dist/components/semiotic-realtime-core.d.ts +11 -4
  211. package/dist/components/semiotic-realtime-react.d.ts +4 -3
  212. package/dist/components/semiotic-realtime.d.ts +3 -1
  213. package/dist/components/semiotic-recipes-core.d.ts +7 -5
  214. package/dist/components/semiotic-server-edge.d.ts +3 -2
  215. package/dist/components/semiotic-server.d.ts +3 -2
  216. package/dist/components/semiotic-themes-core.d.ts +5 -48
  217. package/dist/components/semiotic-utils-core.d.ts +10 -5
  218. package/dist/components/semiotic-utils-react.d.ts +2 -0
  219. package/dist/components/semiotic-utils.d.ts +1 -1
  220. package/dist/components/semiotic-xy.d.ts +4 -1
  221. package/dist/components/semiotic.d.ts +68 -26
  222. package/dist/components/server/animatedGif.d.ts +1 -1
  223. package/dist/components/server/renderEvidence.d.ts +25 -2
  224. package/dist/components/server/renderToStaticSVG.d.ts +15 -7
  225. package/dist/components/server/serverChartConfigShared.d.ts +8 -1
  226. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  227. package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
  228. package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
  229. package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
  230. package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
  231. package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
  232. package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
  233. package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
  234. package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
  235. package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
  236. package/dist/components/server/staticAnnotations.d.ts +28 -1
  237. package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
  238. package/dist/components/server/staticLegend.d.ts +1 -1
  239. package/dist/components/server/staticLegendMargin.d.ts +41 -0
  240. package/dist/components/server/staticOrdinal.d.ts +8 -2
  241. package/dist/components/server/staticPhysics.d.ts +13 -1
  242. package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
  243. package/dist/components/server/staticRawLegend.d.ts +15 -0
  244. package/dist/components/server/staticSVGChrome.d.ts +16 -55
  245. package/dist/components/server/staticXYAxes.d.ts +27 -0
  246. package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
  247. package/dist/components/server/staticXYGrid.d.ts +11 -0
  248. package/dist/components/server/themeResolver.d.ts +5 -1
  249. package/dist/components/store/ThemeStore.d.ts +2 -98
  250. package/dist/components/store/designTokens.d.ts +1 -1
  251. package/dist/components/store/themeCSSVariables.d.ts +10 -0
  252. package/dist/components/store/themeCore.d.ts +91 -0
  253. package/dist/components/store/themePresets.d.ts +81 -0
  254. package/dist/components/store/themeSerialization.d.ts +2 -1
  255. package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
  256. package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
  257. package/dist/components/stream/GeoTileRenderer.d.ts +2 -0
  258. package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
  259. package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
  260. package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
  261. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
  262. package/dist/components/stream/SVGChartTitle.d.ts +9 -0
  263. package/dist/components/stream/SVGOverlay.d.ts +1 -21
  264. package/dist/components/stream/SVGUnderlay.d.ts +24 -0
  265. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  266. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  267. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  268. package/dist/components/stream/StreamXYFrame.d.ts +1 -1
  269. package/dist/components/stream/accessibleDataRows.d.ts +11 -0
  270. package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
  271. package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
  272. package/dist/components/stream/axisTickUtils.d.ts +19 -0
  273. package/dist/components/stream/canvasBackground.d.ts +10 -0
  274. package/dist/components/stream/canvasSetup.d.ts +9 -0
  275. package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
  276. package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
  277. package/dist/components/stream/frameGraphics.d.ts +18 -0
  278. package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
  279. package/dist/components/stream/frameLegendOptions.d.ts +18 -0
  280. package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
  281. package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
  282. package/dist/components/stream/geoTypes.d.ts +10 -11
  283. package/dist/components/stream/hitTarget.d.ts +61 -2
  284. package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
  285. package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
  286. package/dist/components/stream/networkCustomLayout.d.ts +2 -2
  287. package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
  288. package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
  289. package/dist/components/stream/networkFramePaint.d.ts +7 -0
  290. package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
  291. package/dist/components/stream/networkTypes.d.ts +30 -32
  292. package/dist/components/stream/normalizeXYData.d.ts +7 -0
  293. package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
  294. package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
  295. package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
  296. package/dist/components/stream/ordinalTypes.d.ts +10 -4
  297. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
  298. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
  299. package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
  300. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
  301. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
  302. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
  303. package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
  304. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
  305. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
  306. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +23 -4
  307. package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
  308. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
  309. package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
  310. package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
  311. package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
  312. package/dist/components/stream/pipelineConfig.d.ts +6 -17
  313. package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
  314. package/dist/components/stream/renderBackend.d.ts +2 -0
  315. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
  316. package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
  317. package/dist/components/stream/responsiveSize.d.ts +17 -0
  318. package/dist/components/stream/sceneCursor.d.ts +41 -0
  319. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
  320. package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
  321. package/dist/components/stream/types.d.ts +25 -12
  322. package/dist/components/stream/useCanvasFrameHost.d.ts +3 -1
  323. package/dist/components/stream/useFrame.d.ts +24 -1
  324. package/dist/components/stream/useResponsiveSize.d.ts +6 -1
  325. package/dist/components/stream/useStalenessCheck.d.ts +1 -1
  326. package/dist/components/stream/xyFrameAxisTypes.d.ts +15 -4
  327. package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
  328. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
  329. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
  330. package/dist/components/types/legendTypes.d.ts +6 -0
  331. package/dist/components/types/marginType.d.ts +7 -8
  332. package/dist/controls.min.js +1 -1
  333. package/dist/controls.module.min.js +1 -1
  334. package/dist/forceLayoutWorker.js +1 -1
  335. package/dist/geo.min.js +1 -1
  336. package/dist/geo.module.min.js +1 -1
  337. package/dist/network.min.js +1 -1
  338. package/dist/network.module.min.js +1 -1
  339. package/dist/ordinal.min.js +1 -1
  340. package/dist/ordinal.module.min.js +1 -1
  341. package/dist/physics-matter.module.min.js +1 -1
  342. package/dist/physics-rapier.module.min.js +1 -1
  343. package/dist/physics.min.js +1 -1
  344. package/dist/physics.module.min.js +1 -1
  345. package/dist/physicsWorker.js +1 -1
  346. package/dist/processSankeyLayoutWorker.js +1 -1
  347. package/dist/realtime.min.js +1 -1
  348. package/dist/realtime.module.min.js +1 -1
  349. package/dist/rough.min.js +1 -1
  350. package/dist/rough.module.min.js +1 -1
  351. package/dist/semiotic-ai-core.d.ts +13 -4
  352. package/dist/semiotic-ai-core.min.js +1 -1
  353. package/dist/semiotic-ai-core.module.min.js +1 -1
  354. package/dist/semiotic-ai.d.ts +16 -9
  355. package/dist/semiotic-ai.min.js +1 -1
  356. package/dist/semiotic-ai.module.min.js +1 -1
  357. package/dist/semiotic-client-cjs-shared.min.js +1 -0
  358. package/dist/semiotic-client-glyph.module.min.js +2 -0
  359. package/dist/semiotic-client-responsive.module.min.js +2 -0
  360. package/dist/semiotic-client-shared.module.min.js +2 -0
  361. package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
  362. package/dist/semiotic-data.min.js +1 -1
  363. package/dist/semiotic-data.module.min.js +1 -1
  364. package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
  365. package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
  366. package/dist/semiotic-experimental-node.module.min.js +2 -0
  367. package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
  368. package/dist/semiotic-experimental-vacp.min.js +1 -1
  369. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  370. package/dist/semiotic-experimental.d.ts +1 -1
  371. package/dist/semiotic-experimental.min.js +1 -1
  372. package/dist/semiotic-experimental.module.min.js +1 -1
  373. package/dist/semiotic-geo.d.ts +4 -1
  374. package/dist/semiotic-network.d.ts +7 -4
  375. package/dist/semiotic-ordinal.d.ts +4 -1
  376. package/dist/semiotic-physics.d.ts +11 -4
  377. package/dist/semiotic-realtime-core.d.ts +11 -4
  378. package/dist/semiotic-realtime-core.min.js +2 -1
  379. package/dist/semiotic-realtime-core.module.min.js +2 -1
  380. package/dist/semiotic-realtime-react.d.ts +4 -3
  381. package/dist/semiotic-realtime-react.min.js +1 -1
  382. package/dist/semiotic-realtime-react.module.min.js +1 -1
  383. package/dist/semiotic-realtime.d.ts +3 -1
  384. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
  385. package/dist/semiotic-recipes-core.d.ts +7 -5
  386. package/dist/semiotic-recipes-core.min.js +9 -1
  387. package/dist/semiotic-recipes-core.module.min.js +1 -1
  388. package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
  389. package/dist/semiotic-recipes-react.min.js +1 -1
  390. package/dist/semiotic-recipes-react.module.min.js +1 -1
  391. package/dist/semiotic-recipes.min.js +7 -1
  392. package/dist/semiotic-recipes.module.min.js +2 -1
  393. package/dist/semiotic-server-edge-node.module.min.js +1 -0
  394. package/dist/semiotic-server-edge.d.ts +3 -2
  395. package/dist/semiotic-server-edge.min.js +1 -1
  396. package/dist/semiotic-server-edge.module.min.js +1 -1
  397. package/dist/semiotic-server-node.min.js +1 -1
  398. package/dist/semiotic-server-node.module.min.js +1 -1
  399. package/dist/semiotic-server.d.ts +3 -2
  400. package/dist/semiotic-themes-core.d.ts +5 -48
  401. package/dist/semiotic-themes-core.min.js +1 -1
  402. package/dist/semiotic-themes-core.module.min.js +1 -1
  403. package/dist/semiotic-themes-react.min.js +1 -1
  404. package/dist/semiotic-themes-react.module.min.js +1 -1
  405. package/dist/semiotic-themes.min.js +1 -1
  406. package/dist/semiotic-themes.module.min.js +1 -1
  407. package/dist/semiotic-utils-core.d.ts +10 -5
  408. package/dist/semiotic-utils-core.min.js +1 -1
  409. package/dist/semiotic-utils-core.module.min.js +1 -1
  410. package/dist/semiotic-utils-react.d.ts +2 -0
  411. package/dist/semiotic-utils-react.min.js +1 -1
  412. package/dist/semiotic-utils-react.module.min.js +1 -1
  413. package/dist/semiotic-utils.d.ts +1 -1
  414. package/dist/semiotic-utils.min.js +2 -1
  415. package/dist/semiotic-utils.module.min.js +2 -1
  416. package/dist/semiotic-value.min.js +1 -1
  417. package/dist/semiotic-value.module.min.js +1 -1
  418. package/dist/semiotic-xy.d.ts +4 -1
  419. package/dist/semiotic.d.ts +68 -26
  420. package/dist/semiotic.min.js +1 -1
  421. package/dist/semiotic.module.min.js +1 -1
  422. package/dist/server.min.js +1 -1
  423. package/dist/server.module.min.js +1 -1
  424. package/dist/xy.min.js +1 -1
  425. package/dist/xy.module.min.js +1 -1
  426. package/package.json +53 -19
  427. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
  428. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
  429. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
  430. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
  431. package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
  432. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
  433. package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
  434. package/dist/chunk-chunk-2X3FJCME.module.min.js +0 -1
  435. package/dist/chunk-chunk-2ZHHWZQM.module.min.js +0 -2
  436. package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
  437. package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
  438. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
  439. package/dist/chunk-chunk-5ZON5NMV.module.min.js +0 -2
  440. package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
  441. package/dist/chunk-chunk-6S3YGYW7.module.min.js +0 -1
  442. package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
  443. package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +0 -2
  444. package/dist/chunk-chunk-A3I4HBD5.module.min.js +0 -1
  445. package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
  446. package/dist/chunk-chunk-AFQHURLO.module.min.js +0 -2
  447. package/dist/chunk-chunk-DDB4TLQG.module.min.js +0 -2
  448. package/dist/chunk-chunk-DTH3SUOU.module.min.js +0 -2
  449. package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
  450. package/dist/chunk-chunk-DVCWU7MT.module.min.js +0 -2
  451. package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
  452. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
  453. package/dist/chunk-chunk-FSIHAW6L.module.min.js +0 -2
  454. package/dist/chunk-chunk-G2RGVEYY.module.min.js +0 -2
  455. package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
  456. package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
  457. package/dist/chunk-chunk-HAJVODLO.module.min.js +0 -2
  458. package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
  459. package/dist/chunk-chunk-HIV7AW2V.module.min.js +0 -2
  460. package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
  461. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  462. package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
  463. package/dist/chunk-chunk-JZAMMSQQ.module.min.js +0 -2
  464. package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
  465. package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
  466. package/dist/chunk-chunk-MXMRXSCI.module.min.js +0 -2
  467. package/dist/chunk-chunk-MXVBXFKW.module.min.js +0 -2
  468. package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
  469. package/dist/chunk-chunk-OFAP623Y.module.min.js +0 -2
  470. package/dist/chunk-chunk-OHLRAEQZ.module.min.js +0 -2
  471. package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
  472. package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
  473. package/dist/chunk-chunk-PRNXOCYZ.module.min.js +0 -2
  474. package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
  475. package/dist/chunk-chunk-RLKZVJMQ.module.min.js +0 -2
  476. package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
  477. package/dist/chunk-chunk-SK2TQMG4.module.min.js +0 -2
  478. package/dist/chunk-chunk-SKLYXNYW.module.min.js +0 -2
  479. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
  480. package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
  481. package/dist/chunk-chunk-U4NZCU5T.module.min.js +0 -2
  482. package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
  483. package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
  484. package/dist/chunk-chunk-VKL6DI43.module.min.js +0 -2
  485. package/dist/chunk-chunk-W62673ZE.module.min.js +0 -1
  486. package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
  487. package/dist/chunk-chunk-XCC25CZZ.module.min.js +0 -2
  488. package/dist/chunk-chunk-XECNOUZY.module.min.js +0 -2
  489. package/dist/chunk-chunk-XYZDTYAF.module.min.js +0 -2
  490. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
  491. package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
  492. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
  493. package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
  494. package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
  495. package/dist/test-utils/canvasMock.d.ts +0 -86
  496. package/dist/test-utils/capturedFrameProps.d.ts +0 -67
  497. package/dist/test-utils/frameMock.d.ts +0 -81
  498. package/dist/test-utils/ordinalFixtures.d.ts +0 -48
  499. /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
  500. /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
  501. /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
  502. /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
@@ -1,12 +1,14 @@
1
1
  import * as React from "react";
2
2
  import type { ReactNode } from "react";
3
- import type { SemioticTheme } from "../store/ThemeStore";
3
+ import type { SemioticTheme } from "../store/themeCore";
4
4
  import { useResponsiveSize } from "./useResponsiveSize";
5
5
  import { resolveAnimateConfig } from "./pipelineTransitionUtils";
6
6
  import type { AnimateProp } from "./pipelineTransitionUtils";
7
7
  import type { TransitionConfig } from "./types";
8
8
  import type { HoverPointerCoords } from "./hoverUtils";
9
9
  import { FrameRuntime, type FrameClock, type FrameRandom } from "./FrameRuntime";
10
+ import { type AxisChromeInput } from "../legendLayout";
11
+ import type { LegendLayout } from "../types/legendTypes";
10
12
  /**
11
13
  * The small scheduling surface `useFrame` needs. Keeping this separate from
12
14
  * the browser global gives hook tests a deterministic, handle-agnostic seam
@@ -60,6 +62,12 @@ export interface UseFrameInput {
60
62
  legend?: unknown;
61
63
  /** Legend placement used for shared top-chrome clearance. */
62
64
  legendPosition?: "right" | "left" | "top" | "bottom";
65
+ /** Shared legend metrics used to reserve direct-frame plot space. */
66
+ legendLayout?: LegendLayout;
67
+ /** Axis chrome adjacent to the legend, when the frame has axes. */
68
+ axisChrome?: AxisChromeInput;
69
+ /** A chart HOC already calculated the legend-aware margin. */
70
+ legendMarginReserved?: boolean;
63
71
  /** Frame's `foregroundGraphics` prop. */
64
72
  foregroundGraphics?: FrameGraphicsProp;
65
73
  /** Frame's `backgroundGraphics` prop. */
@@ -101,6 +109,12 @@ export interface UseFrameInput {
101
109
  * timing on those three).
102
110
  */
103
111
  themeDirtyRef?: React.MutableRefObject<boolean>;
112
+ /**
113
+ * Skip the mount-time invalidation while retaining later theme-change
114
+ * repaints. Useful for frames that synchronously paint their initial settled
115
+ * state and would otherwise queue a redundant animation frame on mount.
116
+ */
117
+ skipInitialThemeInvalidation?: boolean;
104
118
  }
105
119
  export interface UseFrameResult {
106
120
  /** Reduced-motion preference at last render (for re-render gating). */
@@ -155,6 +169,15 @@ export interface UseFrameResult {
155
169
  /** Stable callback to attach to canvas's onPointerLeave (or onMouseLeave).
156
170
  * Cancels any pending hover rAF and invokes hoverLeaveRef. */
157
171
  onPointerLeave: () => void;
172
+ /** Last pointer position over the frame. Frames use this to refresh
173
+ * geometry-derived presentation while marks animate under a stationary
174
+ * pointer; reading/writing the ref never schedules work by itself. */
175
+ pointerStateRef: React.MutableRefObject<{
176
+ inside: boolean;
177
+ clientX: number;
178
+ clientY: number;
179
+ pointerType?: string;
180
+ }>;
158
181
  }
159
182
  /**
160
183
  * Bundles the universally-shared setup boilerplate that opens every
@@ -1,3 +1,7 @@
1
+ import { type RefObject } from "react";
2
+ import { type ResponsiveSizeOptions } from "./responsiveSize";
3
+ export { resolveResponsiveDimension } from "./responsiveSize";
4
+ export type { ResponsiveSizeOptions } from "./responsiveSize";
1
5
  /**
2
6
  * Hook that measures the parent container and returns responsive dimensions.
3
7
  * Uses ResizeObserver to track container size changes.
@@ -5,6 +9,7 @@
5
9
  * @param baseSize - The default [width, height] from the size prop
6
10
  * @param responsiveWidth - Whether width should follow container width
7
11
  * @param responsiveHeight - Whether height should follow container height
12
+ * @param options - Optional min/max and resize-quantization constraints
8
13
  * @returns [containerRef, effectiveSize] — attach the ref to the container div
9
14
  */
10
- export declare function useResponsiveSize(baseSize: [number, number], responsiveWidth?: boolean, responsiveHeight?: boolean): [React.RefObject<HTMLDivElement>, [number, number]];
15
+ export declare function useResponsiveSize(baseSize: [number, number], responsiveWidth?: boolean, responsiveHeight?: boolean, options?: ResponsiveSizeOptions): [RefObject<HTMLDivElement | null>, [number, number]];
@@ -17,5 +17,5 @@ interface StoreWithIngestTime {
17
17
  * declared. The `isStale` / `setIsStale` state must live in the caller
18
18
  * so that the `useState` call order stays unchanged.
19
19
  */
20
- export declare function useStalenessCheck(staleness: StalenessConfig | undefined, storeRef: React.RefObject<StoreWithIngestTime | null>, dirtyRef: React.MutableRefObject<boolean>, scheduleRender: () => void, isStale: boolean, setIsStale: (stale: boolean) => void): void;
20
+ export declare function useStalenessCheck(staleness: StalenessConfig | undefined, storeRef: React.RefObject<StoreWithIngestTime | null>, dirtyRef: React.MutableRefObject<boolean>, scheduleRender: () => void, now: () => number, isStale: boolean, setIsStale: (stale: boolean) => void): void;
21
21
  export {};
@@ -3,6 +3,13 @@ export type AxisTickFormat = ((d: number, index?: number, allTicks?: number[]) =
3
3
  export type AxisTickFormatter = {
4
4
  bivarianceHack(d: string | number | Date, index?: number, allTicks?: number[]): string | ReactNode;
5
5
  }["bivarianceHack"];
6
+ /** SVG stroke properties shared by an axis baseline/ticks or its grid lines. */
7
+ export interface AxisLineStyle {
8
+ stroke?: string;
9
+ strokeWidth?: number;
10
+ strokeOpacity?: number;
11
+ strokeDasharray?: string;
12
+ }
6
13
  /**
7
14
  * Per-axis configuration object for an XY frame's `axes: []` array.
8
15
  * Distinct from `AxisConfig` exported from the HOC layer (which is the
@@ -18,6 +25,8 @@ export interface XYFrameAxisConfig {
18
25
  orient: "left" | "right" | "top" | "bottom";
19
26
  label?: string;
20
27
  ticks?: number;
28
+ /** Compatibility alias for `ticks`; `ticks` wins when both are supplied. */
29
+ tickCount?: number;
21
30
  /**
22
31
  * Override the chart-level `axisExtent` mode for this axis. Horizontal
23
32
  * (`top`/`bottom`) and vertical (`left`/`right`) axes resolve independently.
@@ -33,10 +42,12 @@ export interface XYFrameAxisConfig {
33
42
  * the positions. Pixel-distance filtering downstream still drops
34
43
  * overlapping labels. Mirrors the ordinal frame's `rTickValues`. */
35
44
  tickValues?: Array<number | Date>;
36
- /** Grid line stroke style: `"dashed"` (6,4), `"dotted"` (2,4), or a
37
- * custom strokeDasharray string. Applied to grid lines extending
38
- * from ticks across the chart area. */
39
- gridStyle?: "dashed" | "dotted" | string;
45
+ /** Grid line stroke style. A string is a dash preset (`"dashed"`,
46
+ * `"dotted"`) or custom strokeDasharray; an object controls each grid
47
+ * line's SVG stroke attributes. */
48
+ gridStyle?: "dashed" | "dotted" | string | AxisLineStyle;
49
+ /** Baseline and tick-mark stroke styling for this axis. */
50
+ axisStyle?: AxisLineStyle;
40
51
  /** Set false to suppress grid lines emitted from this axis while retaining
41
52
  * its ticks and baseline. For example, set the bottom axis to `false` for
42
53
  * horizontal-only (y-axis) grid lines. */
@@ -0,0 +1,6 @@
1
+ import type { PipelineStore } from "./PipelineStore";
2
+ import type { CursorFrameGeometry } from "./frameCursorInteraction";
3
+ export declare function rehitXYFrameCursor(options: CursorFrameGeometry & {
4
+ store: PipelineStore;
5
+ hoverRadius: number;
6
+ }): void;
@@ -2,7 +2,7 @@ import type { Datum } from "../../charts/shared/datumTypes";
2
2
  /**
3
3
  * Realtime swarm chart scene builder.
4
4
  *
5
- * Simple point scatter with category-based coloring from barColors config.
5
+ * Simple point scatter with lazily resolved category-based coloring.
6
6
  *
7
7
  * Consumed by: PipelineStore.buildSceneNodes (chartType "swarm")
8
8
  */
@@ -8,7 +8,7 @@ import type { AreaGradientConfig } from "./areaGradient";
8
8
  * Scene builders are pure functions that receive this context instead of
9
9
  * accessing PipelineStore instance fields directly.
10
10
  */
11
- import type { StreamScales, Style, CurveType, BarStyle, ThemeSemanticColors } from "../types";
11
+ import type { StreamScales, Style, CurveType, BarStyle, CandlestickStyle, SwarmStyle, ThemeSemanticColors, WaterfallStyle } from "../types";
12
12
  import type { SymbolName } from "../symbolPath";
13
13
  import type { ResolvedRibbon } from "./ribbonScene";
14
14
  import type { GradientConfig } from "../../charts/shared/gradient";
@@ -66,6 +66,7 @@ export interface XYSceneConfig {
66
66
  semanticLineStops?: Array<{
67
67
  offset: number;
68
68
  color: string;
69
+ opacity?: number;
69
70
  }>;
70
71
  annotations?: Datum[];
71
72
  pointStyle?: (d: Datum) => Style & {
@@ -82,6 +83,7 @@ export interface XYSceneConfig {
82
83
  heatmapYBins?: number;
83
84
  showValues?: boolean;
84
85
  heatmapValueFormat?: (v: number) => string;
86
+ heatmapColorScale?: (value: number) => string;
85
87
  binSize?: number;
86
88
  barColors?: Record<string, string>;
87
89
  /** Bar fill/stroke/strokeWidth/gap. Threaded through from RealtimeHistogram. */
@@ -91,31 +93,9 @@ export interface XYSceneConfig {
91
93
  themeSequential?: string;
92
94
  /** Theme diverging scheme name — fallback when colorScheme is not set. */
93
95
  themeDiverging?: string;
94
- swarmStyle?: {
95
- radius?: number;
96
- fill?: string;
97
- opacity?: number;
98
- stroke?: string;
99
- strokeWidth?: number;
100
- };
101
- waterfallStyle?: {
102
- positiveColor?: string;
103
- negativeColor?: string;
104
- gap?: number;
105
- stroke?: string;
106
- strokeWidth?: number;
107
- opacity?: number;
108
- connectorStroke?: string;
109
- connectorWidth?: number;
110
- };
111
- candlestickStyle?: {
112
- upColor?: string;
113
- downColor?: string;
114
- wickColor?: string;
115
- wickWidth?: number;
116
- bodyWidth?: number;
117
- rangeColor?: string;
118
- };
96
+ swarmStyle?: SwarmStyle;
97
+ waterfallStyle?: WaterfallStyle;
98
+ candlestickStyle?: CandlestickStyle;
119
99
  /** True when candlestick is in range/dumbbell mode (no open/close accessors provided) */
120
100
  candlestickRangeMode?: boolean;
121
101
  boundsStyle?: Style | ((d: Datum, group: string) => Style);
@@ -60,6 +60,12 @@ export interface LegendLayout {
60
60
  rowHeight?: number;
61
61
  /** Override the alignment width used for top/bottom legends */
62
62
  maxWidth?: number;
63
+ /**
64
+ * Space between a left/right legend and the outer SVG edge. The default is
65
+ * sized for the interactive swatch focus ring; set to 0 to preserve the
66
+ * historical flush placement.
67
+ */
68
+ edgeGutter?: number;
63
69
  /**
64
70
  * Space between the plot and a left/right legend reserved for adjacent
65
71
  * chart chrome such as axis ticks and an axis title. Ignored for top/bottom
@@ -8,17 +8,16 @@ export interface MarginType {
8
8
  left: number;
9
9
  right: number;
10
10
  }
11
- /** Public margin side value. Numbers pin a side to an exact pixel value.
12
- * `"auto"` and `null` explicitly leave that side to chart defaults plus
13
- * auto-reservation such as legends. */
11
+ /** Public margin side value. Numbers set a pixel baseline; chart-owned chrome
12
+ * such as legends may grow that side when it needs more room. `"auto"` and
13
+ * `null` explicitly start from the chart-mode default. */
14
14
  export type MarginSide = number | "auto" | null | undefined;
15
15
  /** Public-API margin shape. Users can pass any subset of sides (`{ left: 120 }`
16
16
  * for wide y-axis labels is a common pattern) or a single number as shorthand
17
- * for "same on all sides". Pass a side as `"auto"` or `null` to explicitly
18
- * opt back into chart auto-reservation for that side, e.g.
19
- * `{ right: "auto" }` with a right-side legend. The frame fills missing/auto
20
- * sides from chart-mode defaults before handing a fully-resolved
21
- * `MarginType` to the layout code. */
17
+ * for "same baseline on all sides". Numeric values are minima when Semiotic
18
+ * reserves chart-owned chrome such as legends. Pass a side as `"auto"` or
19
+ * `null` to start from the chart-mode default. The frame fills missing/auto
20
+ * sides before handing a fully-resolved `MarginType` to layout code. */
22
21
  export type PartialMargin = number | {
23
22
  top?: MarginSide;
24
23
  right?: MarginSide;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,l=(e,t,o,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))i.call(e,s)||s===o||n(e,s,{get:()=>t[s],enumerable:!(l=r(t,s))||l.enumerable});return e},s=(e,r,a)=>(a=null!=e?t(o(e)):{},l(!r&&e&&e.__esModule?a:n(a,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(u,{CircularBrush:()=>Q,DirectManipulationControl:()=>b,MobileStandardControls:()=>pe,SentenceFilter:()=>K,VISUALIZATION_CONTROL_TYPES:()=>p,auditVisualizationControls:()=>_,clampMobileRange:()=>ne,createControlObservationAdapter:()=>f,useMobileRangeControls:()=>ae,zoomMobileRange:()=>re}),module.exports=(e=u,l(n({},"__esModule",{value:!0}),e));var c=s(require("react")),d=require("react"),p=["value","threshold","partition-boundary","time-window","range-boundary"];function f({controlType:e,controlId:t,chartId:n,chartType:r="VisualizationControl",onObservation:a}){return(o,i,l)=>{a?.({type:o,controlType:e,value:i,chartType:r,timestamp:Date.now(),...t?{controlId:t}:{},...n?{chartId:n}:{},...l?{source:l}:{}})}}var m=require("react/jsx-runtime");function h(e,t,n,r){return Math.min(n,Math.max(t,Number((t+Math.round((Math.min(n,Math.max(t,e))-t)/r)*r).toFixed(12))))}function b({value:e,onChange:t,pointerToValue:n,min:r,max:a,step:o=1,largeStep:i=5*o,x:l,y:s,controlType:u="value",controlId:p,label:b,valueText:y,radius:g=12,fill:x="var(--semiotic-bg, #ffffff)",stroke:v="var(--semiotic-primary, #4e79a7)",strokeWidth:w=4,labelText:j,labelDx:k=16,labelDy:C=-16,labelClassName:$,className:M,disabled:S=!1,onChangeStart:A,onChangeEnd:I,onObservation:T,chartId:D,chartType:z}){const L=(0,d.useRef)(null),N=(0,d.useRef)(e);N.current=e;const E=c.useMemo(()=>f({controlType:u,controlId:p,chartId:D,chartType:z,onObservation:T}),[D,z,p,u,T]),R=e=>{if(S)return;const i=n(e);if(null==i||!Number.isFinite(i))return;const l=h(i,r,a,o);N.current=l,t(l),E("control-change",l,"pointer")},V=e=>{e.stopPropagation(),L.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),L.current=null,I?.(N.current),E("control-end",N.current,"pointer"))},P=["semiotic-direct-manipulation-control",M].filter(Boolean).join(" ");return(0,m.jsxs)("g",{className:P,role:"slider",tabIndex:S?-1:0,"aria-disabled":S||void 0,"aria-label":b,"aria-valuemin":r,"aria-valuemax":a,"aria-valuenow":e,"aria-valuetext":y??`${b}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":u,"data-viz-control-id":p,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{S||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),L.current=e.pointerId,A?.(N.current),E("control-start",N.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),L.current===e.pointerId&&R(e)},onPointerUp:V,onPointerCancel:V,onLostPointerCapture:V,onKeyDown:e=>{if(S)return;const n=e.shiftKey?i:o,l=N.current;let s=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(s=l-n),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(s=l+n),"Home"===e.key&&(s=r),"End"===e.key&&(s=a),null===s)return;e.preventDefault();const u=h(s,r,a,o);N.current=u,t(u),E("control-change",u,"keyboard")},style:{cursor:S?"default":"grab",touchAction:"none"},children:[(0,m.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:l,cy:s,r:g+10,fill:"transparent"}),(0,m.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:l,cy:s,r:g,fill:x,stroke:v,strokeWidth:w}),j?(0,m.jsx)("text",{className:$,x:l+k,y:s+C,fill:v,children:j}):null]})}var y=s(require("react")),g=require("react/jsx-runtime"),x="undefined"==typeof window?y.useEffect:y.useLayoutEffect,v={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},w={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-text, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},j={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},k={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},C={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function $(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map($).join(""):y.isValidElement(e)?$(e.props.children):""}function M(e,t){return Object.is(e,t)}function S(e,t){return e.find(e=>M(e.value,t))}function A(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function I(e,t){if(A(t))return e.emptyLabel??"Any";if("select"===e.type)return S(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>S(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>(0,g.jsxs)(y.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function T(e,t,n){return A(t)?$(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):$(I(e,t))||t+""}function D(e){return 0===e.detail?"keyboard":"pointer"}function z(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[$(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function L(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const a=(t+n*r+e.length)%e.length;if(!e[a].disabled)return a}return-1}function N(e,t=0){const[n,r]=y.useState(()=>e[t]&&!e[t].disabled?t:L(e,-1,1)),a=y.useRef(null),o=y.useRef({value:"",at:0});y.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(L(e,-1,1))},[n,e]);const i=y.useCallback(e=>{0>e||(r(e),a.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),l=y.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=L(e,n,1);else if("ArrowUp"===t.key)r=L(e,n,-1);else if("Home"===t.key)r=L(e,-1,1);else if("End"===t.key)r=L(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const a=Date.now(),i=o.current,l=`${a-i.at>600?"":i.value}${t.key}`.toLocaleLowerCase();o.current={value:l,at:a};for(let t=1;e.length>=t;t+=1){const a=(Math.max(n,-1)+t)%e.length,o=e[a],i=[$(o.label),...o.keywords??[]];if(!o.disabled&&i.some(e=>e.toLocaleLowerCase().startsWith(l))){r=a;break}}}0>r||(t.preventDefault(),i(r))},[n,i,e]);return{activeIndex:n,focusIndex:i,listRef:a,onKeyDown:l}}function E({option:e}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{children:e.label}),null!=e.count?(0,g.jsx)("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?(0,g.jsx)("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function R({value:e,definition:t,setValue:n,close:r}){const a=t,[o,i]=y.useState(""),l=y.useMemo(()=>z(a.options,o),[o,a.options]),s=Math.max(0,l.findIndex(t=>M(t.value,e))),u=N(l,s);return(0,g.jsxs)(g.Fragment,{children:[a.searchable?(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+a.label,value:o,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),u.focusIndex(L(l,-1,1)))},style:k}):null,(0,g.jsxs)("span",{ref:u.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((t,o)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":o,"data-sentence-filter-autofocus":a.searchable||o!==u.activeIndex?void 0:"",type:"button",role:"option","aria-selected":M(t.value,e),tabIndex:o===u.activeIndex?0:-1,disabled:t.disabled,onKeyDown:u.onKeyDown,onClick:e=>{n(t.value,D(e)),r()},style:{...C,backgroundColor:M(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:(0,g.jsx)(E,{option:t})},`${t.value+""}-${o}`)),0===l.length?(0,g.jsx)("span",{role:"status",children:"No options found."}):null]})]})}function V({value:e,definition:t,setValue:n}){const r=t,[a,o]=y.useState(""),i=y.useMemo(()=>z(r.options,a),[r.options,a]),l=Array.isArray(e)?e:[],s=N(i);return(0,g.jsxs)(g.Fragment,{children:[r.searchable?(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:a,onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(L(i,-1,1)))},style:k}):null,(0,g.jsxs)("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[i.map((e,t)=>{const a=l.some(t=>M(t,e.value));return(0,g.jsxs)("label",{style:{...C,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[(0,g.jsx)("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:a,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...l,e.value]:l.filter(t=>!M(t,e.value));n(r,"input")}}),(0,g.jsx)("span",{style:{flex:1},children:(0,g.jsx)(E,{option:e})})]},`${e.value+""}-${t}`)}),0===i.length?(0,g.jsx)("span",{role:"status",children:"No options found."}):null]})]})}function P({value:e,definition:t,setValue:n}){const r=t,a=r.inputMode??"input",o={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return(0,g.jsxs)(g.Fragment,{children:["slider"!==a?(0,g.jsx)("input",{...o,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:k}):null,"input"!==a?(0,g.jsx)("input",{...o,"data-sentence-filter-autofocus":"slider"===a?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function F({value:e,definition:t,setValue:n}){const r=t,a=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],o=(e,t)=>{if(!Number.isFinite(t))return;const o=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(o,a[1]),a[1]]:[a[0],Math.max(o,a[0])],"input")},i={min:r.min,max:r.max,step:r.step??1};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[(0,g.jsxs)("label",{children:[(0,g.jsx)("span",{children:"Minimum"}),(0,g.jsx)("input",{...i,"data-sentence-filter-autofocus":!0,type:"number",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:k})]}),(0,g.jsxs)("label",{children:[(0,g.jsx)("span",{children:"Maximum"}),(0,g.jsx)("input",{...i,type:"number",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:k})]})]}),(0,g.jsxs)("label",{children:[(0,g.jsxs)("span",{style:v,children:["Minimum ",r.label]}),(0,g.jsx)("input",{...i,type:"range",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),(0,g.jsxs)("label",{children:[(0,g.jsxs)("span",{style:v,children:["Maximum ",r.label]}),(0,g.jsx)("input",{...i,type:"range",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function O({value:e,definition:t,setValue:n,close:r}){const a=t,o=[{value:!0,label:a.trueLabel??"On"},{value:!1,label:a.falseLabel??"Off"}],i=N(o.map(e=>({...e})),!1===e?1:0);return(0,g.jsx)("span",{ref:i.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",gap:4},children:o.map((t,a)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":a===i.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:a===i.activeIndex?0:-1,onKeyDown:i.onKeyDown,onClick:e=>{n(t.value,D(e)),r()},style:{...C,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function W({value:e,definition:t,setValue:n,close:r}){const a=t,o="string"==typeof e?e:"",[i,l]=y.useState(""),s=y.useMemo(()=>z(a.suggestions??[],i),[i,a.suggestions]),u=N(s);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":a.label,placeholder:a.placeholder,value:o,onChange:e=>{l(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),u.focusIndex(L(s,-1,1)))},style:k}),s.length>0?(0,g.jsx)("span",{ref:u.listRef,role:"listbox","aria-label":a.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===o,disabled:e.disabled,tabIndex:t===u.activeIndex?0:-1,onKeyDown:u.onKeyDown,onClick:t=>{n(e.value,D(t)),r()},style:{...C,opacity:e.disabled?.5:1},children:(0,g.jsx)(E,{option:e})},`${e.value}-${t}`))}):null]})}function H(e){switch(e.definition.type){case"select":return(0,g.jsx)(R,{...e});case"multiselect":return(0,g.jsx)(V,{...e});case"number":return(0,g.jsx)(P,{...e});case"range":return(0,g.jsx)(F,{...e});case"toggle":return(0,g.jsx)(O,{...e});case"text":return(0,g.jsx)(W,{...e})}}function K({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:a,as:o="div",className:i,style:l,size:s="inherit",align:u="start",wrap:c=!0,disabled:d=!1,readOnly:p=!1,ariaLabel:f,id:m,renderControl:h,onOpenChange:b}){const[k,$]=y.useState(()=>({...n??{}})),M=t??k,S=y.useRef(M);S.current=M;const D=void 0!==t,z=y.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let a=0;e.length>a;)if(e.startsWith("{{",a))n+="{",a+=2;else if(e.startsWith("}}",a))n+="}",a+=2;else{if("{"===e[a]){const n=e.indexOf("}",a+1);if(-1!==n){const o=e.slice(a+1,n);if(o.length>0&&!o.includes("{")){r(),t.push({type:"filter",key:o}),a=n+1;continue}}}n+=e[a],a+=1}return r(),t}(e),[e]),[L,N]=y.useState(null),[E,R]=y.useState(j),V=y.useRef(L);V.current=L;const P=y.useRef(null),F=y.useRef(null),O=y.useRef(new Set),[W,K]=y.useState(""),[Z,_]=y.useState(null),[q,B]=y.useState(null),U=y.useId().replace(/:/g,""),X=m??"sentence-filter-"+U;y.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of z){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in M||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!O.current.has(t)&&(O.current.add(t),console.warn(t))}},[r,M,z]);const G=y.useCallback(()=>{V.current&&(V.current=null,N(null),R(j),b?.(null),F.current?.focus())},[b]);y.useEffect(()=>{if(!L)return;const e=e=>{P.current?.contains(e.target)||G()},t=e=>{"Escape"===e.key&&(e.preventDefault(),G())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[G,L]),x(()=>{if(!L||"undefined"==typeof window)return;const e=P.current?.querySelector(`[data-sentence-filter-popover="${L.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=F.current?.getBoundingClientRect(),a=window.visualViewport,o=a?.offsetLeft??0,i=a?.offsetTop??0,l=a?.width??window.innerWidth,s=o+l,u=i+(a?.height??window.innerHeight),c=window.getComputedStyle(e),d=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),p=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let f=i+(Number.isFinite(d)?Math.max(0,d):0),m=u-(Number.isFinite(p)?Math.max(0,p):0),h=F.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(i+n))&&(f=Math.max(f,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(u-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-E.offsetX,y=n.right-E.offsetX;let g=0;y>s-t&&(g-=y-(s-t)),o+t>b+g&&(g+=o+t-(b+g));const x=r?m-r.bottom-8-t:m-f-32,v=r?r.top-f-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>x&&v>x?"above":"below",j=Math.max(0,Math.min(384,Math.floor("above"===w?v:x))),k=Math.max(0,Math.floor(l-32));R(e=>e.offsetX===g&&e.placement===w&&e.maxHeight===j&&e.maxWidth===k?e:{offsetX:g,placement:w,maxHeight:j,maxWidth:k})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[L,E]),y.useEffect(()=>{if(!L)return;const e=P.current?.querySelector(`[data-sentence-filter-popover="${L.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[L]),y.useEffect(()=>{L&&(d||p||r[L.key]?.disabled)&&G()},[G,r,d,L,p]);const Y=y.useCallback((e,t,n)=>{const o=S.current,i=o[e]??null,l={...o,[e]:t};D||(S.current=l,$(l));const s={key:e,previousValue:i,value:t,source:n};a?.(l,s);const u=r[e];if(u){const e=T(u,i,o),n=T(u,t,l);K(`${u.label} changed from ${e} to ${n}.`)}},[D,r,a]),J=y.useMemo(()=>z.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?T(t,M[e.key],M):`{${e.key}}`}).join(""),[r,M,z]),Q={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===u?"start":"end"===u?"end":"center",whiteSpace:c?"normal":"nowrap",...l},ee=["semiotic-sentence-filter",i].filter(Boolean).join(" ");let te=0;return(0,g.jsxs)(o,{ref:e=>{P.current=e},id:X,className:ee,style:Q,role:"div"===o||"span"===o?"group":void 0,"aria-label":f??J,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":D?"controlled":"uncontrolled",children:[z.map((e,t)=>{if("text"===e.type)return(0,g.jsx)("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return(0,g.jsx)("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const a=te;te+=1;const o=M[e.key]??null,i=function(e,t,n){return A(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):I(e,t)}(n,o,M),l=T(n,o,M),s=L?.key===e.key&&L.occurrence===a,u=d||p||!!n.disabled,c=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),f=`${X}-${c}-${a}-popover`;return(0,g.jsxs)("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[(0,g.jsx)("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":f,"aria-label":`${n.label}: ${l}. Activate to change.`,disabled:u,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>_(a),onMouseLeave:()=>_(e=>e===a?null:e),onFocus:()=>B(a),onBlur:()=>B(e=>e===a?null:e),onClick:t=>{if(u)return;if(s)return void G();F.current=t.currentTarget;const r={key:e.key,occurrence:a};V.current=r,R(j),N(r),K(n.label+" control opened."),b?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:Z===a||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:q===a?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:u?"default":"pointer",opacity:u?.6:1},children:i}),s?(0,g.jsxs)("span",{id:f,role:"dialog","aria-label":n.label,"aria-describedby":n.description?f+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":a,"data-sentence-filter-key":e.key,style:{...w,top:"below"===E.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===E.placement?"calc(100% + 0.5rem)":"auto",left:E.offsetX,maxHeight:E.maxHeight??w.maxHeight,maxWidth:E.maxWidth??w.maxWidth},children:[(0,g.jsx)("span",{style:{fontWeight:650},children:n.label}),n.description?(0,g.jsx)("span",{id:f+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,h?h({key:e.key,value:o,filters:M,definition:n,setValue:(t,n="programmatic")=>Y(e.key,t,n),close:G}):(0,g.jsx)(H,{value:o,definition:n,setValue:(t,n)=>Y(e.key,t,n),close:G}),n.allowClear&&!A(o)?(0,g.jsxs)("button",{type:"button",onClick:()=>{Y(e.key,"multiselect"===n.type?[]:null,"clear"),G()},style:{...C,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${a}`)}),(0,g.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:v,children:W})]})}function Z(e,t,n,r,a){return{id:e,...t?{controlId:t}:{},status:n,message:r,...a?{remediation:a}:{}}}function _({controls:e=[],minimumTargetSize:t=24}){const n=[],r=new Set;for(const a of e){const e=a?.id,o="controls."+(e||"unknown"),i=a?.domain,l=Array.isArray(i)&&2===i.length&&Number.isFinite(i[0])&&Number.isFinite(i[1])&&i[1]>i[0],s=p.includes(a?.type),u="string"==typeof a?.target&&a.target.trim().length>0,c=["slider","buttons","native-range"].includes(a?.keyboard??""),d=a?.minimumTargetSize;n.push(Z(o+".semantic-type",e,s?"pass":"fail",s?`Control uses the semantic type "${a.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),n.push(Z(o+".state-binding",e,u?"pass":"fail",u?`Control is bound to "${a.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),n.push(Z(o+".domain",e,l?"pass":"fail",l?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),n.push(Z(o+".keyboard",e,c?"pass":"fail",c?`Control declares a ${a.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),n.push(Z(o+".value-text",e,"string"==typeof a?.valueText&&a.valueText.trim().length>0?"pass":"fail","string"==typeof a?.valueText&&a.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),n.push(Z(o+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=a?.step&&n.push(Z(o+".step",e,Number.isFinite(a.step)&&a.step>0?"pass":"fail",Number.isFinite(a.step)&&a.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),a?.observations?.length&&n.push(Z(o+".observations",e,a.observations.includes("control-change")?"pass":"warn",a.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!r.has(e)||n.push(Z(o+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&r.add(e)}return{ok:n.every(e=>"fail"!==e.status),findings:n}}var q=require("react"),B=2*Math.PI;function U(e,t,n){const r=n?.center?.x??0,a=n?.center?.y??0;return{x:r+Math.sin(e)*t,y:a-Math.cos(e)*t}}function X(e,t,n,r,a){const o=a?.center,i=(e,t)=>{const{x:n,y:r}=U(e,t,{center:o});return`${G(n)},${G(r)}`},l=Math.max(0,n),s=Math.max(l,r),u=Math.abs(t-e),c=e>t?0:1;if(u>=B-1e-6){const e=o?.x??0,t=o?.y??0,n=`${G(e)},${G(t-s)}`,r=`${G(e)},${G(t+s)}`;let a=`M${n} A${G(s)},${G(s)} 0 1 1 ${r} A${G(s)},${G(s)} 0 1 1 ${n} Z`;if(l>0){const n=`${G(e)},${G(t-l)}`,r=`${G(e)},${G(t+l)}`;a+=` M${n} A${G(l)},${G(l)} 0 1 0 ${r} A${G(l)},${G(l)} 0 1 0 ${n} Z`}return a}const d=u>Math.PI?1:0,p=i(e,s),f=i(t,s);if(0>=l){const e=o?.x??0,t=o?.y??0;return`M${G(e)},${G(t)} L${p} A${G(s)},${G(s)} 0 ${d} ${c} ${f} Z`}const m=i(t,l),h=i(e,l);return`M${p} A${G(s)},${G(s)} 0 ${d} ${c} ${f} L${m} A${G(l)},${G(l)} 0 ${d} ${1===c?0:1} ${h} Z`}function G(e){return Math.round(1e3*e)/1e3}function Y(e,t,n=0){return t>0?((e-n)%t+t)%t+n:e}var J=require("react/jsx-runtime");function Q({value:e,onChange:t,period:n=365,radius:r=180,innerRadius:a=14,width:o,height:i,step:l=1,largeStep:s=7,label:u="Range",formatValue:c,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:p="var(--semiotic-bg, #ffffff)",className:f,style:m}){const h=o??2*r+40,b=i??2*r+40,y=h/2,g=b/2,x=function(e){const[t,n]=e,r=n-t||1,a=B;return e=>0+(e-t)/r*(a-0)}([0,n]),v=(0,q.useRef)(null),w=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||h)/(r.width||1)*(e.clientX-r.left)-y-0,-((a?.height||b)/(r.height||1)*(e.clientY-r.top)-g-0))+B)%B/B*n)%n},j=(e,t)=>{e.preventDefault(),e.stopPropagation();const n=e.currentTarget.ownerSVGElement;n?.setPointerCapture?.(e.pointerId),v.current={mode:t,lastValue:w(e)}},k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),v.current=null},C=(e,r)=>{t("range"===e?e=>({start:Y(e.start+r,n),end:Y(e.end+r,n)}):t=>({...t,[e]:Y(t[e]+r,n)}))},$=e=>t=>{const n=t.shiftKey?s:l;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),C(e,n)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),C(e,-n))},M=e.start>e.end?[[e.start,n],[0,e.end]]:[[e.start,e.end]],S=e=>c?c(e):e+"";return(0,J.jsx)("svg",{viewBox:`0 0 ${h} ${b}`,width:h,height:b,className:f,onPointerMove:e=>{const r=v.current;if(!r)return;const a=w(e);if("range"===r.mode){const e=function(e,t,n){if(0>=n)return t-e;let r=(t-e)%n;return r>n/2?r-=n:-n/2>r&&(r+=n),r}(r.lastValue,a,n);if(0===e)return;return r.lastValue=a,void t(t=>({start:Y(t.start+e,n),end:Y(t.end+e,n)}))}t(e=>({...e,[r.mode]:a}))},onPointerUp:k,onPointerCancel:k,onLostPointerCapture:k,style:{touchAction:"none",...m},"aria-label":u+" brush",children:(0,J.jsxs)("g",{transform:`translate(${y},${g})`,children:[(0,J.jsx)("g",{role:"slider",tabIndex:0,"aria-label":u+" (move both ends)","aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":e.start,"aria-valuetext":`${S(e.start)} to ${S(e.end)}`,onPointerDown:e=>j(e,"range"),onKeyDown:$("range"),style:{cursor:"grab"},children:M.map(([e,t],n)=>(0,J.jsx)("path",{d:X(x(e),x(t),a,r),fill:d,fillOpacity:.35,stroke:p,strokeWidth:1},n))}),["start","end"].map(t=>{const o=e[t],i=(e=>U(x(e),a))(o),l=(e=>U(x(e),r+8))(o);return(0,J.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${u} ${t}`,"aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":o,"aria-valuetext":S(o),onPointerDown:e=>j(e,t),onKeyDown:$(t),style:{cursor:"grab"},children:[(0,J.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"transparent",strokeWidth:20}),(0,J.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:p,strokeWidth:1.5}),(0,J.jsx)("circle",{cx:l.x,cy:l.y,r:4.5,fill:p,stroke:d,strokeWidth:1})]},t)})]})})}var ee=s(require("react")),te=require("react/jsx-runtime");function ne(e,t,n=0){const r=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),o=Math.max(r,Math.min(a,e[0])),i=Math.max(r,Math.min(a,e[1])),l=o>i?[i,o]:[o,i];if(l[1]-l[0]>=n)return l;const s=(l[0]+l[1])/2,u=n/2;return[Math.max(r,Math.min(a-n,s-u)),Math.min(a,Math.max(r+n,s+u))]}function re(e,t,n,r=1,a=r){const o="in"===n?r:-r;return ne([e[0]+o,e[1]-o],t,a)}function ae(e){const{domain:t,initialValue:n=t,step:r=1,minSpan:a=r,label:o,formatValue:i,onChange:l}=e,[s,u]=ee.useState(()=>ne(n,t,a)),c=ne(s,t,a),d=ee.useCallback(e=>{const n=ne(e,t,a);u(n),l?.(n)},[t,a,l]),p=ee.useMemo(()=>({label:o,domain:t,value:c,step:r,formatValue:i,onChange:d,onClear:()=>d(t)}),[t,i,o,d,r,c]),f=ee.useMemo(()=>({onZoomIn:()=>d(re(c,t,"in",r,a)),onZoomOut:()=>d(re(c,t,"out",r,a)),onReset:()=>d(t)}),[t,a,d,r,c]);return{value:c,setValue:d,xExtent:c,brush:p,zoom:f}}var oe={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},ie={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function le(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-bg, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function se(e){return"function"==typeof e}function ue({brush:e,targetSize:t}){const n=e?.value,r=e?.domain,a=!!n&&!!r,o=!0===e?.disabled,i=e?.formatValue??(e=>e),l=!!e?.onChange&&a&&!o,s=r?.[0]??0,u=r?.[1]??1,c=n?.[0]??s,d=n?.[1]??u,p=e?.step??((u-s)/100||1);return(0,te.jsxs)("section",{style:oe,"aria-label":"Brush controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Filter range"}),a?(0,te.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,te.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,te.jsxs)("span",{children:["Start: ",i(c)]}),(0,te.jsx)("input",{type:"range",min:s,max:u,step:p,value:c,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([Math.min(n,d),d])}})]}),(0,te.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,te.jsxs)("span",{children:["End: ",i(d)]}),(0,te.jsx)("input",{type:"range",min:s,max:u,step:p,value:d,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([c,Math.max(n,c)])}})]})]}):(0,te.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,te.jsx)("button",{type:"button",disabled:o||!se(e?.onClear),onClick:e?.onClear,style:le(t),children:"Clear range"})]})}function ce({zoom:e,targetSize:t}){const n=!0===e?.disabled;return(0,te.jsxs)("section",{style:oe,"aria-label":"Zoom controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Zoom"}),(0,te.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,te.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:n||!se(e?.onZoomOut),onClick:e?.onZoomOut,style:le(t),children:"-"}),(0,te.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:n||!se(e?.onReset),onClick:e?.onReset,style:le(t),children:"Reset"}),(0,te.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:n||!se(e?.onZoomIn),onClick:e?.onZoomIn,style:le(t),children:"+"})]})]})}function de({legend:e,targetSize:t}){const n=!0===e?.disabled,r=e?.items??[];return(0,te.jsxs)("section",{style:oe,"aria-label":"Legend controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Series"}),r.length>0&&(0,te.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const a=!1!==r.active;return(0,te.jsxs)("button",{type:"button",disabled:n||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!a),style:le(t,a),"aria-pressed":a,children:[r.color&&(0,te.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:r.color}}),r.label??r.id]},r.id)})}),(0,te.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,te.jsx)("button",{type:"button",disabled:n||!se(e?.onShowAll),onClick:e?.onShowAll,style:le(t),children:"Show all"}),(0,te.jsx)("button",{type:"button",disabled:n||!se(e?.onHideAll),onClick:e?.onHideAll,style:le(t),children:"Hide all"})]})]})}function pe({controls:e,targetSize:t=44,compact:n=!1,className:r,style:a,ariaLabel:o="Mobile chart controls",brush:i,zoom:l,legend:s}){const u=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const n=[];return t.brush&&n.push("brush"),t.zoom&&n.push("zoom"),t.legend&&n.push("legend"),n}(e,{brush:i,zoom:l,legend:s});return 0===u.length?null:(0,te.jsxs)("div",{className:r,role:"group","aria-label":o,style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...a},children:[u.includes("brush")&&(0,te.jsx)(ue,{brush:i,targetSize:t}),u.includes("zoom")&&(0,te.jsx)(ce,{zoom:l,targetSize:t}),u.includes("legend")&&(0,te.jsx)(de,{legend:s,targetSize:t})]})}
2
+ module.exports=require("./semiotic-client-cjs-shared.min.js").controls;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{CircularBrush as e,DirectManipulationControl as t}from"./chunk-chunk-4ITOQRXM.module.min.js";import{MobileStandardControls as n,clampMobileRange as r,useMobileRangeControls as i,zoomMobileRange as a}from"./chunk-chunk-UOQRPGPK.module.min.js";import{VISUALIZATION_CONTROL_TYPES as l,auditVisualizationControls as o,createControlObservationAdapter as s}from"./chunk-chunk-FQPKOAIH.module.min.js";import*as u from"react";import{Fragment as c,jsx as d,jsxs as f}from"react/jsx-runtime";var p="undefined"==typeof window?u.useEffect:u.useLayoutEffect,m={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},h={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-text, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},b={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},y={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},v={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function g(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map(g).join(""):u.isValidElement(e)?g(e.props.children):""}function x(e,t){return Object.is(e,t)}function w(e,t){return e.find(e=>x(e.value,t))}function k(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function C(e,t){if(k(t))return e.emptyLabel??"Any";if("select"===e.type)return w(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>w(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>f(u.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function L(e,t,n){return k(t)?g(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):g(C(e,t))||t+""}function M(e){return 0===e.detail?"keyboard":"pointer"}function E(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[g(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function S(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const i=(t+n*r+e.length)%e.length;if(!e[i].disabled)return i}return-1}function A(e,t=0){const[n,r]=u.useState(()=>e[t]&&!e[t].disabled?t:S(e,-1,1)),i=u.useRef(null),a=u.useRef({value:"",at:0});u.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(S(e,-1,1))},[n,e]);const l=u.useCallback(e=>{0>e||(r(e),i.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),o=u.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=S(e,n,1);else if("ArrowUp"===t.key)r=S(e,n,-1);else if("Home"===t.key)r=S(e,-1,1);else if("End"===t.key)r=S(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const i=Date.now(),l=a.current,o=`${i-l.at>600?"":l.value}${t.key}`.toLocaleLowerCase();a.current={value:o,at:i};for(let t=1;e.length>=t;t+=1){const i=(Math.max(n,-1)+t)%e.length,a=e[i],l=[g(a.label),...a.keywords??[]];if(!a.disabled&&l.some(e=>e.toLocaleLowerCase().startsWith(o))){r=i;break}}}0>r||(t.preventDefault(),l(r))},[n,l,e]);return{activeIndex:n,focusIndex:l,listRef:i,onKeyDown:o}}function D({option:e}){return f(c,{children:[d("span",{children:e.label}),null!=e.count?d("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?d("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function $({value:e,definition:t,setValue:n,close:r}){const i=t,[a,l]=u.useState(""),o=u.useMemo(()=>E(i.options,a),[a,i.options]),s=Math.max(0,o.findIndex(t=>x(t.value,e))),p=A(o,s);return f(c,{children:[i.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+i.label,value:a,onChange:e=>l(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),p.focusIndex(S(o,-1,1)))},style:y}):null,f("span",{ref:p.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",flexDirection:"column",gap:2},children:[o.map((t,a)=>d("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":i.searchable||a!==p.activeIndex?void 0:"",type:"button",role:"option","aria-selected":x(t.value,e),tabIndex:a===p.activeIndex?0:-1,disabled:t.disabled,onKeyDown:p.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...v,backgroundColor:x(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:d(D,{option:t})},`${t.value+""}-${a}`)),0===o.length?d("span",{role:"status",children:"No options found."}):null]})]})}function N({value:e,definition:t,setValue:n}){const r=t,[i,a]=u.useState(""),l=u.useMemo(()=>E(r.options,i),[r.options,i]),o=Array.isArray(e)?e:[],s=A(l);return f(c,{children:[r.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:i,onChange:e=>a(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(S(l,-1,1)))},style:y}):null,f("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((e,t)=>{const i=o.some(t=>x(t,e.value));return f("label",{style:{...v,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[d("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:i,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...o,e.value]:o.filter(t=>!x(t,e.value));n(r,"input")}}),d("span",{style:{flex:1},children:d(D,{option:e})})]},`${e.value+""}-${t}`)}),0===l.length?d("span",{role:"status",children:"No options found."}):null]})]})}function I({value:e,definition:t,setValue:n}){const r=t,i=r.inputMode??"input",a={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return f(c,{children:["slider"!==i?d("input",{...a,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:y}):null,"input"!==i?d("input",{...a,"data-sentence-filter-autofocus":"slider"===i?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function V({value:e,definition:t,setValue:n}){const r=t,i=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],a=(e,t)=>{if(!Number.isFinite(t))return;const a=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(a,i[1]),i[1]]:[i[0],Math.max(a,i[0])],"input")},l={min:r.min,max:r.max,step:r.step??1};return f(c,{children:[f("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[f("label",{children:[d("span",{children:"Minimum"}),d("input",{...l,"data-sentence-filter-autofocus":!0,type:"number",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:y})]}),f("label",{children:[d("span",{children:"Maximum"}),d("input",{...l,type:"number",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:y})]})]}),f("label",{children:[f("span",{style:m,children:["Minimum ",r.label]}),d("input",{...l,type:"range",value:i[0],onChange:e=>a(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),f("label",{children:[f("span",{style:m,children:["Maximum ",r.label]}),d("input",{...l,type:"range",value:i[1],onChange:e=>a(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function R({value:e,definition:t,setValue:n,close:r}){const i=t,a=[{value:!0,label:i.trueLabel??"On"},{value:!1,label:i.falseLabel??"Off"}],l=A(a.map(e=>({...e})),!1===e?1:0);return d("span",{ref:l.listRef,role:"listbox","aria-label":i.label,style:{display:"flex",gap:4},children:a.map((t,i)=>d("button",{"data-sentence-filter-option-index":i,"data-sentence-filter-autofocus":i===l.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:i===l.activeIndex?0:-1,onKeyDown:l.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...v,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function F({value:e,definition:t,setValue:n,close:r}){const i=t,a="string"==typeof e?e:"",[l,o]=u.useState(""),s=u.useMemo(()=>E(i.suggestions??[],l),[l,i.suggestions]),p=A(s);return f(c,{children:[d("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":i.label,placeholder:i.placeholder,value:a,onChange:e=>{o(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),p.focusIndex(S(s,-1,1)))},style:y}),s.length>0?d("span",{ref:p.listRef,role:"listbox","aria-label":i.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>d("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===a,disabled:e.disabled,tabIndex:t===p.activeIndex?0:-1,onKeyDown:p.onKeyDown,onClick:t=>{n(e.value,M(t)),r()},style:{...v,opacity:e.disabled?.5:1},children:d(D,{option:e})},`${e.value}-${t}`))}):null]})}function K(e){switch(e.definition.type){case"select":return d($,{...e});case"multiselect":return d(N,{...e});case"number":return d(I,{...e});case"range":return d(V,{...e});case"toggle":return d(R,{...e});case"text":return d(F,{...e})}}function H({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:i,as:a="div",className:l,style:o,size:s="inherit",align:c="start",wrap:y=!0,disabled:g=!1,readOnly:x=!1,ariaLabel:w,id:M,renderControl:E,onOpenChange:S}){const[A,D]=u.useState(()=>({...n??{}})),$=t??A,N=u.useRef($);N.current=$;const I=void 0!==t,V=u.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let i=0;e.length>i;)if(e.startsWith("{{",i))n+="{",i+=2;else if(e.startsWith("}}",i))n+="}",i+=2;else{if("{"===e[i]){const n=e.indexOf("}",i+1);if(-1!==n){const a=e.slice(i+1,n);if(a.length>0&&!a.includes("{")){r(),t.push({type:"filter",key:a}),i=n+1;continue}}}n+=e[i],i+=1}return r(),t}(e),[e]),[R,F]=u.useState(null),[H,W]=u.useState(b),T=u.useRef(R);T.current=R;const j=u.useRef(null),z=u.useRef(null),O=u.useRef(new Set),[X,B]=u.useState(""),[P,q]=u.useState(null),[_,Q]=u.useState(null),U=u.useId().replace(/:/g,""),G=M??"sentence-filter-"+U;u.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of V){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in $||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!O.current.has(t)&&(O.current.add(t),console.warn(t))}},[r,$,V]);const Z=u.useCallback(()=>{T.current&&(T.current=null,F(null),W(b),S?.(null),z.current?.focus())},[S]);u.useEffect(()=>{if(!R)return;const e=e=>{j.current?.contains(e.target)||Z()},t=e=>{"Escape"===e.key&&(e.preventDefault(),Z())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[Z,R]),p(()=>{if(!R||"undefined"==typeof window)return;const e=j.current?.querySelector(`[data-sentence-filter-popover="${R.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=z.current?.getBoundingClientRect(),i=window.visualViewport,a=i?.offsetLeft??0,l=i?.offsetTop??0,o=i?.width??window.innerWidth,s=a+o,u=l+(i?.height??window.innerHeight),c=window.getComputedStyle(e),d=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),f=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let p=l+(Number.isFinite(d)?Math.max(0,d):0),m=u-(Number.isFinite(f)?Math.max(0,f):0),h=z.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(l+n))&&(p=Math.max(p,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(u-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-H.offsetX,y=n.right-H.offsetX;let v=0;y>s-t&&(v-=y-(s-t)),a+t>b+v&&(v+=a+t-(b+v));const g=r?m-r.bottom-8-t:m-p-32,x=r?r.top-p-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>g&&x>g?"above":"below",k=Math.max(0,Math.min(384,Math.floor("above"===w?x:g))),C=Math.max(0,Math.floor(o-32));W(e=>e.offsetX===v&&e.placement===w&&e.maxHeight===k&&e.maxWidth===C?e:{offsetX:v,placement:w,maxHeight:k,maxWidth:C})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[R,H]),u.useEffect(()=>{if(!R)return;const e=j.current?.querySelector(`[data-sentence-filter-popover="${R.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[R]),u.useEffect(()=>{R&&(g||x||r[R.key]?.disabled)&&Z()},[Z,r,g,R,x]);const J=u.useCallback((e,t,n)=>{const a=N.current,l=a[e]??null,o={...a,[e]:t};I||(N.current=o,D(o));const s={key:e,previousValue:l,value:t,source:n};i?.(o,s);const u=r[e];if(u){const e=L(u,l,a),n=L(u,t,o);B(`${u.label} changed from ${e} to ${n}.`)}},[I,r,i]),Y=u.useMemo(()=>V.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?L(t,$[e.key],$):`{${e.key}}`}).join(""),[r,$,V]),ee={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===c?"start":"end"===c?"end":"center",whiteSpace:y?"normal":"nowrap",...o},te=["semiotic-sentence-filter",l].filter(Boolean).join(" ");let ne=0;return f(a,{ref:e=>{j.current=e},id:G,className:te,style:ee,role:"div"===a||"span"===a?"group":void 0,"aria-label":w??Y,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":I?"controlled":"uncontrolled",children:[V.map((e,t)=>{if("text"===e.type)return d("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return d("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const i=ne;ne+=1;const a=$[e.key]??null,l=function(e,t,n){return k(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):C(e,t)}(n,a,$),o=L(n,a,$),s=R?.key===e.key&&R.occurrence===i,u=g||x||!!n.disabled,c=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),p=`${G}-${c}-${i}-popover`;return f("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[d("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":p,"aria-label":`${n.label}: ${o}. Activate to change.`,disabled:u,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>q(i),onMouseLeave:()=>q(e=>e===i?null:e),onFocus:()=>Q(i),onBlur:()=>Q(e=>e===i?null:e),onClick:t=>{if(u)return;if(s)return void Z();z.current=t.currentTarget;const r={key:e.key,occurrence:i};T.current=r,W(b),F(r),B(n.label+" control opened."),S?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:P===i||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:_===i?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:u?"default":"pointer",opacity:u?.6:1},children:l}),s?f("span",{id:p,role:"dialog","aria-label":n.label,"aria-describedby":n.description?p+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":i,"data-sentence-filter-key":e.key,style:{...h,top:"below"===H.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===H.placement?"calc(100% + 0.5rem)":"auto",left:H.offsetX,maxHeight:H.maxHeight??h.maxHeight,maxWidth:H.maxWidth??h.maxWidth},children:[d("span",{style:{fontWeight:650},children:n.label}),n.description?d("span",{id:p+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,E?E({key:e.key,value:a,filters:$,definition:n,setValue:(t,n="programmatic")=>J(e.key,t,n),close:Z}):d(K,{value:a,definition:n,setValue:(t,n)=>J(e.key,t,n),close:Z}),n.allowClear&&!k(a)?f("button",{type:"button",onClick:()=>{J(e.key,"multiselect"===n.type?[]:null,"clear"),Z()},style:{...v,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${i}`)}),d("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:m,children:X})]})}export{e as CircularBrush,t as DirectManipulationControl,n as MobileStandardControls,H as SentenceFilter,l as VISUALIZATION_CONTROL_TYPES,o as auditVisualizationControls,r as clampMobileRange,s as createControlObservationAdapter,i as useMobileRangeControls,a as zoomMobileRange};
2
+ import{VISUALIZATION_CONTROL_TYPES as e,auditVisualizationControls as t,createControlObservationAdapter as n}from"./c-IUHFPMHD.min.js";import*as r from"react";import{useRef as a}from"react";import{jsx as o,jsxs as i}from"react/jsx-runtime";function l(e,t,n,r){return Math.min(n,Math.max(t,Number((t+Math.round((Math.min(n,Math.max(t,e))-t)/r)*r).toFixed(12))))}function s({value:e,onChange:t,pointerToValue:s,min:c,max:u,step:d=1,largeStep:p=5*d,x:f,y:m,controlType:h="value",controlId:b,label:y,valueText:g,radius:v=12,fill:x="var(--semiotic-bg, #ffffff)",stroke:w="var(--semiotic-primary, #4e79a7)",strokeWidth:k=4,labelText:C,labelDx:$=16,labelDy:M=-16,labelClassName:S,className:A,disabled:D=!1,onChangeStart:I,onChangeEnd:L,onObservation:z,chartId:E,chartType:N}){const V=a(null),R=a(e);R.current=e;const T=r.useMemo(()=>n({controlType:h,controlId:b,chartId:E,chartType:N,onObservation:z}),[E,N,b,h,z]),P=e=>{if(D)return;const n=s(e);if(null==n||!Number.isFinite(n))return;const r=l(n,c,u,d);R.current=r,t(r),T("control-change",r,"pointer")},W=e=>{e.stopPropagation(),V.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),V.current=null,L?.(R.current),T("control-end",R.current,"pointer"))},H=["semiotic-direct-manipulation-control",A].filter(Boolean).join(" ");return i("g",{className:H,role:"slider",tabIndex:D?-1:0,"aria-disabled":D||void 0,"aria-label":y,"aria-valuemin":c,"aria-valuemax":u,"aria-valuenow":e,"aria-valuetext":g??`${y}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":h,"data-viz-control-id":b,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{D||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),V.current=e.pointerId,I?.(R.current),T("control-start",R.current,"pointer"),P(e))},onPointerMove:e=>{e.stopPropagation(),V.current===e.pointerId&&P(e)},onPointerUp:W,onPointerCancel:W,onLostPointerCapture:W,onKeyDown:e=>{if(D)return;const n=e.shiftKey?p:d,r=R.current;let a=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(a=r-n),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(a=r+n),"Home"===e.key&&(a=c),"End"===e.key&&(a=u),null===a)return;e.preventDefault();const o=l(a,c,u,d);R.current=o,t(o),T("control-change",o,"keyboard")},style:{cursor:D?"default":"grab",touchAction:"none"},children:[o("circle",{className:"semiotic-direct-manipulation-control__hit",cx:f,cy:m,r:v+10,fill:"transparent"}),o("circle",{className:"semiotic-direct-manipulation-control__handle",cx:f,cy:m,r:v,fill:x,stroke:w,strokeWidth:k}),C?o("text",{className:S,x:f+$,y:m+M,fill:w,children:C}):null]})}import*as c from"react";import{Fragment as u,jsx as d,jsxs as p}from"react/jsx-runtime";var f="undefined"==typeof window?c.useEffect:c.useLayoutEffect,m={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},h={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-text, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},b={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},y={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},g={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function v(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map(v).join(""):c.isValidElement(e)?v(e.props.children):""}function x(e,t){return Object.is(e,t)}function w(e,t){return e.find(e=>x(e.value,t))}function k(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function C(e,t){if(k(t))return e.emptyLabel??"Any";if("select"===e.type)return w(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>w(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>p(c.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function $(e,t,n){return k(t)?v(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):v(C(e,t))||t+""}function M(e){return 0===e.detail?"keyboard":"pointer"}function S(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[v(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function A(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const a=(t+n*r+e.length)%e.length;if(!e[a].disabled)return a}return-1}function D(e,t=0){const[n,r]=c.useState(()=>e[t]&&!e[t].disabled?t:A(e,-1,1)),a=c.useRef(null),o=c.useRef({value:"",at:0});c.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(A(e,-1,1))},[n,e]);const i=c.useCallback(e=>{0>e||(r(e),a.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),l=c.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=A(e,n,1);else if("ArrowUp"===t.key)r=A(e,n,-1);else if("Home"===t.key)r=A(e,-1,1);else if("End"===t.key)r=A(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const a=Date.now(),i=o.current,l=`${a-i.at>600?"":i.value}${t.key}`.toLocaleLowerCase();o.current={value:l,at:a};for(let t=1;e.length>=t;t+=1){const a=(Math.max(n,-1)+t)%e.length,o=e[a],i=[v(o.label),...o.keywords??[]];if(!o.disabled&&i.some(e=>e.toLocaleLowerCase().startsWith(l))){r=a;break}}}0>r||(t.preventDefault(),i(r))},[n,i,e]);return{activeIndex:n,focusIndex:i,listRef:a,onKeyDown:l}}function I({option:e}){return p(u,{children:[d("span",{children:e.label}),null!=e.count?d("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?d("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function L({value:e,definition:t,setValue:n,close:r}){const a=t,[o,i]=c.useState(""),l=c.useMemo(()=>S(a.options,o),[o,a.options]),s=Math.max(0,l.findIndex(t=>x(t.value,e))),f=D(l,s);return p(u,{children:[a.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+a.label,value:o,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),f.focusIndex(A(l,-1,1)))},style:y}):null,p("span",{ref:f.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((t,o)=>d("button",{"data-sentence-filter-option-index":o,"data-sentence-filter-autofocus":a.searchable||o!==f.activeIndex?void 0:"",type:"button",role:"option","aria-selected":x(t.value,e),tabIndex:o===f.activeIndex?0:-1,disabled:t.disabled,onKeyDown:f.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...g,backgroundColor:x(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:d(I,{option:t})},`${t.value+""}-${o}`)),0===l.length?d("span",{role:"status",children:"No options found."}):null]})]})}function z({value:e,definition:t,setValue:n}){const r=t,[a,o]=c.useState(""),i=c.useMemo(()=>S(r.options,a),[r.options,a]),l=Array.isArray(e)?e:[],s=D(i);return p(u,{children:[r.searchable?d("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:a,onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(A(i,-1,1)))},style:y}):null,p("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[i.map((e,t)=>{const a=l.some(t=>x(t,e.value));return p("label",{style:{...g,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[d("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:a,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...l,e.value]:l.filter(t=>!x(t,e.value));n(r,"input")}}),d("span",{style:{flex:1},children:d(I,{option:e})})]},`${e.value+""}-${t}`)}),0===i.length?d("span",{role:"status",children:"No options found."}):null]})]})}function E({value:e,definition:t,setValue:n}){const r=t,a=r.inputMode??"input",o={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return p(u,{children:["slider"!==a?d("input",{...o,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:y}):null,"input"!==a?d("input",{...o,"data-sentence-filter-autofocus":"slider"===a?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function N({value:e,definition:t,setValue:n}){const r=t,a=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],o=(e,t)=>{if(!Number.isFinite(t))return;const o=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(o,a[1]),a[1]]:[a[0],Math.max(o,a[0])],"input")},i={min:r.min,max:r.max,step:r.step??1};return p(u,{children:[p("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[p("label",{children:[d("span",{children:"Minimum"}),d("input",{...i,"data-sentence-filter-autofocus":!0,type:"number",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:y})]}),p("label",{children:[d("span",{children:"Maximum"}),d("input",{...i,type:"number",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:y})]})]}),p("label",{children:[p("span",{style:m,children:["Minimum ",r.label]}),d("input",{...i,type:"range",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),p("label",{children:[p("span",{style:m,children:["Maximum ",r.label]}),d("input",{...i,type:"range",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function V({value:e,definition:t,setValue:n,close:r}){const a=t,o=[{value:!0,label:a.trueLabel??"On"},{value:!1,label:a.falseLabel??"Off"}],i=D(o.map(e=>({...e})),!1===e?1:0);return d("span",{ref:i.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",gap:4},children:o.map((t,a)=>d("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":a===i.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:a===i.activeIndex?0:-1,onKeyDown:i.onKeyDown,onClick:e=>{n(t.value,M(e)),r()},style:{...g,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function R({value:e,definition:t,setValue:n,close:r}){const a=t,o="string"==typeof e?e:"",[i,l]=c.useState(""),s=c.useMemo(()=>S(a.suggestions??[],i),[i,a.suggestions]),f=D(s);return p(u,{children:[d("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":a.label,placeholder:a.placeholder,value:o,onChange:e=>{l(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),f.focusIndex(A(s,-1,1)))},style:y}),s.length>0?d("span",{ref:f.listRef,role:"listbox","aria-label":a.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>d("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===o,disabled:e.disabled,tabIndex:t===f.activeIndex?0:-1,onKeyDown:f.onKeyDown,onClick:t=>{n(e.value,M(t)),r()},style:{...g,opacity:e.disabled?.5:1},children:d(I,{option:e})},`${e.value}-${t}`))}):null]})}function T(e){switch(e.definition.type){case"select":return d(L,{...e});case"multiselect":return d(z,{...e});case"number":return d(E,{...e});case"range":return d(N,{...e});case"toggle":return d(V,{...e});case"text":return d(R,{...e})}}function P({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:a,as:o="div",className:i,style:l,size:s="inherit",align:u="start",wrap:y=!0,disabled:v=!1,readOnly:x=!1,ariaLabel:w,id:M,renderControl:S,onOpenChange:A}){const[D,I]=c.useState(()=>({...n??{}})),L=t??D,z=c.useRef(L);z.current=L;const E=void 0!==t,N=c.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let a=0;e.length>a;)if(e.startsWith("{{",a))n+="{",a+=2;else if(e.startsWith("}}",a))n+="}",a+=2;else{if("{"===e[a]){const n=e.indexOf("}",a+1);if(-1!==n){const o=e.slice(a+1,n);if(o.length>0&&!o.includes("{")){r(),t.push({type:"filter",key:o}),a=n+1;continue}}}n+=e[a],a+=1}return r(),t}(e),[e]),[V,R]=c.useState(null),[P,W]=c.useState(b),H=c.useRef(V);H.current=V;const F=c.useRef(null),j=c.useRef(null),K=c.useRef(new Set),[Z,O]=c.useState(""),[B,_]=c.useState(null),[X,U]=c.useState(null),q=c.useId().replace(/:/g,""),G=M??"sentence-filter-"+q;c.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of N){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in L||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!K.current.has(t)&&(K.current.add(t),console.warn(t))}},[r,L,N]);const Y=c.useCallback(()=>{H.current&&(H.current=null,R(null),W(b),A?.(null),j.current?.focus())},[A]);c.useEffect(()=>{if(!V)return;const e=e=>{F.current?.contains(e.target)||Y()},t=e=>{"Escape"===e.key&&(e.preventDefault(),Y())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[Y,V]),f(()=>{if(!V||"undefined"==typeof window)return;const e=F.current?.querySelector(`[data-sentence-filter-popover="${V.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=j.current?.getBoundingClientRect(),a=window.visualViewport,o=a?.offsetLeft??0,i=a?.offsetTop??0,l=a?.width??window.innerWidth,s=o+l,c=i+(a?.height??window.innerHeight),u=window.getComputedStyle(e),d=Number.parseFloat(u.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),p=Number.parseFloat(u.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let f=i+(Number.isFinite(d)?Math.max(0,d):0),m=c-(Number.isFinite(p)?Math.max(0,p):0),h=j.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(i+n))&&(f=Math.max(f,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(c-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-P.offsetX,y=n.right-P.offsetX;let g=0;y>s-t&&(g-=y-(s-t)),o+t>b+g&&(g+=o+t-(b+g));const v=r?m-r.bottom-8-t:m-f-32,x=r?r.top-f-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>v&&x>v?"above":"below",k=Math.max(0,Math.min(384,Math.floor("above"===w?x:v))),C=Math.max(0,Math.floor(l-32));W(e=>e.offsetX===g&&e.placement===w&&e.maxHeight===k&&e.maxWidth===C?e:{offsetX:g,placement:w,maxHeight:k,maxWidth:C})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[V,P]),c.useEffect(()=>{if(!V)return;const e=F.current?.querySelector(`[data-sentence-filter-popover="${V.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[V]),c.useEffect(()=>{V&&(v||x||r[V.key]?.disabled)&&Y()},[Y,r,v,V,x]);const J=c.useCallback((e,t,n)=>{const o=z.current,i=o[e]??null,l={...o,[e]:t};E||(z.current=l,I(l));const s={key:e,previousValue:i,value:t,source:n};a?.(l,s);const c=r[e];if(c){const e=$(c,i,o),n=$(c,t,l);O(`${c.label} changed from ${e} to ${n}.`)}},[E,r,a]),Q=c.useMemo(()=>N.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?$(t,L[e.key],L):`{${e.key}}`}).join(""),[r,L,N]),ee={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===u?"start":"end"===u?"end":"center",whiteSpace:y?"normal":"nowrap",...l},te=["semiotic-sentence-filter",i].filter(Boolean).join(" ");let ne=0;return p(o,{ref:e=>{F.current=e},id:G,className:te,style:ee,role:"div"===o||"span"===o?"group":void 0,"aria-label":w??Q,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":E?"controlled":"uncontrolled",children:[N.map((e,t)=>{if("text"===e.type)return d("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return d("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const a=ne;ne+=1;const o=L[e.key]??null,i=function(e,t,n){return k(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):C(e,t)}(n,o,L),l=$(n,o,L),s=V?.key===e.key&&V.occurrence===a,c=v||x||!!n.disabled,u=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),f=`${G}-${u}-${a}-popover`;return p("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[d("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":f,"aria-label":`${n.label}: ${l}. Activate to change.`,disabled:c,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>_(a),onMouseLeave:()=>_(e=>e===a?null:e),onFocus:()=>U(a),onBlur:()=>U(e=>e===a?null:e),onClick:t=>{if(c)return;if(s)return void Y();j.current=t.currentTarget;const r={key:e.key,occurrence:a};H.current=r,W(b),R(r),O(n.label+" control opened."),A?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:B===a||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:X===a?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:c?"default":"pointer",opacity:c?.6:1},children:i}),s?p("span",{id:f,role:"dialog","aria-label":n.label,"aria-describedby":n.description?f+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":a,"data-sentence-filter-key":e.key,style:{...h,top:"below"===P.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===P.placement?"calc(100% + 0.5rem)":"auto",left:P.offsetX,maxHeight:P.maxHeight??h.maxHeight,maxWidth:P.maxWidth??h.maxWidth},children:[d("span",{style:{fontWeight:650},children:n.label}),n.description?d("span",{id:f+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,S?S({key:e.key,value:o,filters:L,definition:n,setValue:(t,n="programmatic")=>J(e.key,t,n),close:Y}):d(T,{value:o,definition:n,setValue:(t,n)=>J(e.key,t,n),close:Y}),n.allowClear&&!k(o)?p("button",{type:"button",onClick:()=>{J(e.key,"multiselect"===n.type?[]:null,"clear"),Y()},style:{...g,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${a}`)}),d("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:m,children:Z})]})}import{useRef as W}from"react";var H=2*Math.PI;function F(e,t,n){const r=n?.center?.x??0,a=n?.center?.y??0;return{x:r+Math.sin(e)*t,y:a-Math.cos(e)*t}}function j(e,t,n,r,a){const o=a?.center,i=(e,t)=>{const{x:n,y:r}=F(e,t,{center:o});return`${K(n)},${K(r)}`},l=Math.max(0,n),s=Math.max(l,r),c=Math.abs(t-e),u=e>t?0:1;if(c>=H-1e-6){const e=o?.x??0,t=o?.y??0,n=`${K(e)},${K(t-s)}`,r=`${K(e)},${K(t+s)}`;let a=`M${n} A${K(s)},${K(s)} 0 1 1 ${r} A${K(s)},${K(s)} 0 1 1 ${n} Z`;if(l>0){const n=`${K(e)},${K(t-l)}`,r=`${K(e)},${K(t+l)}`;a+=` M${n} A${K(l)},${K(l)} 0 1 0 ${r} A${K(l)},${K(l)} 0 1 0 ${n} Z`}return a}const d=c>Math.PI?1:0,p=i(e,s),f=i(t,s);if(0>=l){const e=o?.x??0,t=o?.y??0;return`M${K(e)},${K(t)} L${p} A${K(s)},${K(s)} 0 ${d} ${u} ${f} Z`}const m=i(t,l),h=i(e,l);return`M${p} A${K(s)},${K(s)} 0 ${d} ${u} ${f} L${m} A${K(l)},${K(l)} 0 ${d} ${1===u?0:1} ${h} Z`}function K(e){return Math.round(1e3*e)/1e3}function Z(e,t,n=0){return t>0?((e-n)%t+t)%t+n:e}import{jsx as O,jsxs as B}from"react/jsx-runtime";function _({value:e,onChange:t,period:n=365,radius:r=180,innerRadius:a=14,width:o,height:i,step:l=1,largeStep:s=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:p="var(--semiotic-bg, #ffffff)",className:f,style:m}){const h=o??2*r+40,b=i??2*r+40,y=h/2,g=b/2,v=function(e){const[t,n]=e,r=n-t||1,a=H;return e=>0+(e-t)/r*(a-0)}([0,n]),x=W(null),w=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||h)/(r.width||1)*(e.clientX-r.left)-y-0,-((a?.height||b)/(r.height||1)*(e.clientY-r.top)-g-0))+H)%H/H*n)%n},k=(e,t)=>{e.preventDefault(),e.stopPropagation();const n=e.currentTarget.ownerSVGElement;n?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:w(e)}},C=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},$=(e,r)=>{t("range"===e?e=>({start:Z(e.start+r,n),end:Z(e.end+r,n)}):t=>({...t,[e]:Z(t[e]+r,n)}))},M=e=>t=>{const n=t.shiftKey?s:l;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),$(e,n)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),$(e,-n))},S=e.start>e.end?[[e.start,n],[0,e.end]]:[[e.start,e.end]],A=e=>u?u(e):e+"";return O("svg",{viewBox:`0 0 ${h} ${b}`,width:h,height:b,className:f,onPointerMove:e=>{const r=x.current;if(!r)return;const a=w(e);if("range"===r.mode){const e=function(e,t,n){if(0>=n)return t-e;let r=(t-e)%n;return r>n/2?r-=n:-n/2>r&&(r+=n),r}(r.lastValue,a,n);if(0===e)return;return r.lastValue=a,void t(t=>({start:Z(t.start+e,n),end:Z(t.end+e,n)}))}t(e=>({...e,[r.mode]:a}))},onPointerUp:C,onPointerCancel:C,onLostPointerCapture:C,style:{touchAction:"none",...m},"aria-label":c+" brush",children:B("g",{transform:`translate(${y},${g})`,children:[O("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":e.start,"aria-valuetext":`${A(e.start)} to ${A(e.end)}`,onPointerDown:e=>k(e,"range"),onKeyDown:M("range"),style:{cursor:"grab"},children:S.map(([e,t],n)=>O("path",{d:j(v(e),v(t),a,r),fill:d,fillOpacity:.35,stroke:p,strokeWidth:1},n))}),["start","end"].map(t=>{const o=e[t],i=(e=>F(v(e),a))(o),l=(e=>F(v(e),r+8))(o);return B("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":o,"aria-valuetext":A(o),onPointerDown:e=>k(e,t),onKeyDown:M(t),style:{cursor:"grab"},children:[O("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"transparent",strokeWidth:20}),O("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:p,strokeWidth:1.5}),O("circle",{cx:l.x,cy:l.y,r:4.5,fill:p,stroke:d,strokeWidth:1})]},t)})]})})}import*as X from"react";import{jsx as U,jsxs as q}from"react/jsx-runtime";function G(e,t,n=0){const r=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),o=Math.max(r,Math.min(a,e[0])),i=Math.max(r,Math.min(a,e[1])),l=o>i?[i,o]:[o,i];if(l[1]-l[0]>=n)return l;const s=(l[0]+l[1])/2,c=n/2;return[Math.max(r,Math.min(a-n,s-c)),Math.min(a,Math.max(r+n,s+c))]}function Y(e,t,n,r=1,a=r){const o="in"===n?r:-r;return G([e[0]+o,e[1]-o],t,a)}function J(e){const{domain:t,initialValue:n=t,step:r=1,minSpan:a=r,label:o,formatValue:i,onChange:l}=e,[s,c]=X.useState(()=>G(n,t,a)),u=G(s,t,a),d=X.useCallback(e=>{const n=G(e,t,a);c(n),l?.(n)},[t,a,l]),p=X.useMemo(()=>({label:o,domain:t,value:u,step:r,formatValue:i,onChange:d,onClear:()=>d(t)}),[t,i,o,d,r,u]),f=X.useMemo(()=>({onZoomIn:()=>d(Y(u,t,"in",r,a)),onZoomOut:()=>d(Y(u,t,"out",r,a)),onReset:()=>d(t)}),[t,a,d,r,u]);return{value:u,setValue:d,xExtent:u,brush:p,zoom:f}}var Q={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},ee={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function te(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-bg, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function ne(e){return"function"==typeof e}function re({brush:e,targetSize:t}){const n=e?.value,r=e?.domain,a=!!n&&!!r,o=!0===e?.disabled,i=e?.formatValue??(e=>e),l=!!e?.onChange&&a&&!o,s=r?.[0]??0,c=r?.[1]??1,u=n?.[0]??s,d=n?.[1]??c,p=e?.step??((c-s)/100||1);return q("section",{style:Q,"aria-label":"Brush controls",children:[U("div",{style:ee,children:e?.label??"Filter range"}),a?q("div",{style:{display:"grid",gap:8},children:[q("label",{style:{display:"grid",gap:4,fontSize:12},children:[q("span",{children:["Start: ",i(u)]}),U("input",{type:"range",min:s,max:c,step:p,value:u,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([Math.min(n,d),d])}})]}),q("label",{style:{display:"grid",gap:4,fontSize:12},children:[q("span",{children:["End: ",i(d)]}),U("input",{type:"range",min:s,max:c,step:p,value:d,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(n,u)])}})]})]}):U("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),U("button",{type:"button",disabled:o||!ne(e?.onClear),onClick:e?.onClear,style:te(t),children:"Clear range"})]})}function ae({zoom:e,targetSize:t}){const n=!0===e?.disabled;return q("section",{style:Q,"aria-label":"Zoom controls",children:[U("div",{style:ee,children:e?.label??"Zoom"}),q("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[U("button",{type:"button","aria-label":"Zoom out",disabled:n||!ne(e?.onZoomOut),onClick:e?.onZoomOut,style:te(t),children:"-"}),U("button",{type:"button","aria-label":"Reset zoom",disabled:n||!ne(e?.onReset),onClick:e?.onReset,style:te(t),children:"Reset"}),U("button",{type:"button","aria-label":"Zoom in",disabled:n||!ne(e?.onZoomIn),onClick:e?.onZoomIn,style:te(t),children:"+"})]})]})}function oe({legend:e,targetSize:t}){const n=!0===e?.disabled,r=e?.items??[];return q("section",{style:Q,"aria-label":"Legend controls",children:[U("div",{style:ee,children:e?.label??"Series"}),r.length>0&&U("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const a=!1!==r.active;return q("button",{type:"button",disabled:n||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!a),style:te(t,a),"aria-pressed":a,children:[r.color&&U("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:r.color}}),r.label??r.id]},r.id)})}),q("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[U("button",{type:"button",disabled:n||!ne(e?.onShowAll),onClick:e?.onShowAll,style:te(t),children:"Show all"}),U("button",{type:"button",disabled:n||!ne(e?.onHideAll),onClick:e?.onHideAll,style:te(t),children:"Hide all"})]})]})}function ie({controls:e,targetSize:t=44,compact:n=!1,className:r,style:a,ariaLabel:o="Mobile chart controls",brush:i,zoom:l,legend:s}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const n=[];return t.brush&&n.push("brush"),t.zoom&&n.push("zoom"),t.legend&&n.push("legend"),n}(e,{brush:i,zoom:l,legend:s});return 0===c.length?null:q("div",{className:r,role:"group","aria-label":o,style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...a},children:[c.includes("brush")&&U(re,{brush:i,targetSize:t}),c.includes("zoom")&&U(ae,{zoom:l,targetSize:t}),c.includes("legend")&&U(oe,{legend:s,targetSize:t})]})}export{_ as CircularBrush,s as DirectManipulationControl,ie as MobileStandardControls,P as SentenceFilter,e as VISUALIZATION_CONTROL_TYPES,t as auditVisualizationControls,G as clampMobileRange,n as createControlObservationAdapter,J as useMobileRangeControls,Y as zoomMobileRange};
@@ -1 +1 @@
1
- import{forceCenter as e,forceCollide as t,forceLink as n,forceManyBody as o,forceSimulation as a,forceX as r,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,l=i.iterations??260,u=i.repulsion??5200,h=i.linkDistance??165,g=i.linkStrength??.045,b=i.centerStrength??.018,m=i.damping??.84,y=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(l>0){const c=a(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/l)).velocityDecay(Math.max(0,Math.min(1,1-m))).force("charge",o().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(u)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof y?y(e.data):y)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",r(k).strength(b)).force("y",f(k).strength(b));q.length>0&&c.force("link",n(q).id(e=>e.id).distance(h).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(S.get(t)??1,S.get(n)??1));return g/.045/o})),c.stop();for(let e=0;e<l;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,n=e.y??k;t<z&&(z=t),n<I&&(I=n),t>R&&(R=t),n>$&&($=n)}const E=R-z,_=$-I,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};return C}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as l,forceLink as u,forceManyBody as h,forceCollide as g}from"d3-force";import{scaleLinear as b}from"d3-scale";function m(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function y(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function p(e){const t=e.map(m),n=t.length-1;return e=>{if(e<=0){const[e,n,o]=t[0];return y(e,n,o)}if(e>=1){const[e,o,a]=t[n];return y(e,o,a)}const o=e*n,a=Math.floor(o),r=o-a,[f,c,s]=t[a],[i,d,l]=t[a+1];return y(Math.round(f+(i-f)*r),Math.round(c+(d-c)*r),Math.round(s+(l-s)*r))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let n=S.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,S.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}function w(e){return"string"==typeof e?e:e.id}var v={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const a=n.forceStrength??.1,r=o[0]/2,f=o[1]/2,c=Math.max(.1,Math.min(1,Math.min(o[0],o[1])/200)),b=Math.min(.5,.06+1.8*(1-c)),m=n.__previousPositions;let y=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=m?.get(t.id);e?y++:n?(t.x=n.x,t.y=n.y,y++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=y>0&&M<=.3;if(x){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of p){const o=q(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const a=z(e.id),r=a%360*(Math.PI/180),f=(10+a%20)*c;e.x=t/o.length+f*Math.cos(r),e.y=n/o.length+f*Math.sin(r)}else{const t=z(e.id),n=t%360*(Math.PI/180),o=(15+t%30)*c;e.x=r+o*Math.cos(n),e.y=f+o*Math.sin(n)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let n=0;n<e.length;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5)*c,a=n*t;o.x=r+e*Math.cos(a),o.y=f+e*Math.sin(a)}}}const S=e.length,k=n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),v=n.__skipForceSimulation||0===n.iterations?0:x?40:k,R=I(n.nodeSize,n.nodeSizeRange,e),$=e=>R(e);if(v>0){const m=new Map,y=new Map;for(const t of e)m.set(t.id,0),y.set(t.id,t);for(const e of t){const t=w(e.source),n=w(e.target);m.set(t,(m.get(t)??0)+1),m.set(n,(m.get(n)??0)+1)}const p=u().strength(e=>{const t=e.weight,n=w(e.source),o=w(e.target),r=Math.max(1,Math.min(m.get(n)??1,m.get(o)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*a/(.1*r))}).distance(e=>{const t="string"==typeof e.source?y.get(e.source):e.source,n="string"==typeof e.target?y.get(e.target):e.target,o=(t?$(t):0)+(n?$(n):0)+Math.max(6,12*c);return Math.max(16,40*c,o)}).id(e=>e.id),M=s();if(void 0===n.random&&void 0===n.seed||M.randomSource(n.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n.seed)),M.force("charge",h().strength(e=>{const t=m.get(e.id)??0;return-15*c*$(e)*Math.sqrt(t+1)})).force("collide",g(e=>$(e)+3*c).strength(.9).iterations(2)).force("center",i(r,f).strength(.8)).force("x",d(r).strength(b)).force("y",l(f).strength(b)).force("bounds",function(e,t,n=2,o=.6){let a=[];const r=r=>{const f=o*Math.max(r,.2);for(const o of a){const a=o.x??e[0]/2,r=o.y??e[1]/2,c=o.vx??0,s=o.vy??0,i=t(o)+n,d=Math.min(e[0]/2,i),l=Math.max(e[0]/2,e[0]-i),u=Math.min(e[1]/2,i),h=Math.max(e[1]/2,e[1]-i),g=a+c,b=r+s;g<d?o.vx=c+(d-g)*f:g>l&&(o.vx=c+(l-g)*f),b<u?o.vy=s+(u-b)*f:b>h&&(o.vy=s+(h-b)*f)}};return r.initialize=e=>{a=e},r}(o,$)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:w(e.source),target:w(e.target)}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<v;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=$(t),n=v>0?2:0,a=Math.min(o[0]/2,e+n),r=Math.min(o[1]/2,e+n);t.x=Math.max(a,Math.min(o[0]-a,t.x)),t.y=Math.max(r,Math.min(o[1]-r,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const E=new Map;for(const t of e)E.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=E.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=E.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){const a=n.nodeStyle,r=n.edgeStyle,f=I(n.nodeSize,n.nodeSizeRange,e),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],l=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),o=a?a(k(t,"nodeStyle")):{},r={fill:o.fill||s.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:r,datum:t,id:t.id,label:t.id})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const a=r?r(k(e,"edgeStyle")):{},f={stroke:a.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:a.strokeWidth??1,opacity:a.opacity??.6};d.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:f,datum:e})}if(!1!==n.showLabels){const t=(h=n.nodeLabel)?"function"==typeof h?h:e=>e[h]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=f(k(n,"nodeSize"));l.push({x:n.x,y:n.y-o-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var h;return{sceneNodes:i,sceneEdges:d,labels:l}}};function q(e,t,n){const o=[];for(const a of t){const t=w(a.source),r=w(a.target);let f=null;if(t===e?f=r:r===e&&(f=t),f){const e=n.get(f);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function z(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function I(e,t,n){if(n.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const o=t||[5,20],a=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&a.push(n)}if(0===a.length)return()=>o[0];const[r,f]=function(e){let t=1/0,n=-1/0;for(const o of e)o<t&&(t=o),o>n&&(n=o);return[t,n]}(a);if(r===f)return()=>(o[0]+o[1])/2;const c=b().domain([r,f]).range(o).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?o[0]:c(n)}}self.onmessage=e=>{const t=e.data,n=t?.requestId,o=t?.request??t;try{if("normalized"===o.kind){const e=o.nodeRadii,t=e?{...o.options,nodeRadius:t=>e[t.id]??12}:o.options;return void self.postMessage({requestId:n,positions:c(o.nodes,o.edges,t)})}const e=o.nodes,t=o.edges;v.computeLayout(e,t,o.config,o.size),self.postMessage({requestId:n,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:n,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};
1
+ import{forceCenter as e,forceCollide as t,forceLink as n,forceManyBody as o,forceSimulation as a,forceX as r,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,u=i.iterations??260,l=i.repulsion??5200,h=i.linkDistance??165,g=i.linkStrength??.045,b=i.centerStrength??.018,m=i.damping??.84,y=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(u>0){const c=a(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/u)).velocityDecay(Math.max(0,Math.min(1,1-m))).force("charge",o().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(l)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof y?y(e.data):y)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",r(k).strength(b)).force("y",f(k).strength(b));q.length>0&&c.force("link",n(q).id(e=>e.id).distance(h).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(S.get(t)??1,S.get(n)??1));return g/.045/o})),c.stop();for(let e=0;e<u;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,n=e.y??k;t<z&&(z=t),n<I&&(I=n),t>R&&(R=t),n>$&&($=n)}const E=R-z,_=$-I,P={};for(const e of w){const t={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};Object.defineProperty(P,e.id,{value:t,enumerable:!0,configurable:!0,writable:!0})}return P}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as u,forceLink as l,forceManyBody as h,forceCollide as g}from"d3-force";import{scaleLinear as b}from"d3-scale";function m(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function y(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function p(e){const t=e.map(m),n=t.length-1;return e=>{if(e<=0){const[e,n,o]=t[0];return y(e,n,o)}if(e>=1){const[e,o,a]=t[n];return y(e,o,a)}const o=e*n,a=Math.floor(o),r=o-a,[f,c,s]=t[a],[i,d,u]=t[a+1];return y(Math.round(f+(i-f)*r),Math.round(c+(d-c)*r),Math.round(s+(u-s)*r))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let n=S.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,S.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}function w(e){return"string"==typeof e?e:e.id}var v={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const a=n.forceStrength??.1,r=o[0]/2,f=o[1]/2,c=Math.max(.1,Math.min(1,Math.min(o[0],o[1])/200)),b=Math.min(.5,.06+1.8*(1-c)),m=n.__previousPositions;let y=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=m?.get(t.id);e?y++:n?(t.x=n.x,t.y=n.y,y++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=y>0&&M<=.3;if(x){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of p){const o=q(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const a=z(e.id),r=a%360*(Math.PI/180),f=(10+a%20)*c;e.x=t/o.length+f*Math.cos(r),e.y=n/o.length+f*Math.sin(r)}else{const t=z(e.id),n=t%360*(Math.PI/180),o=(15+t%30)*c;e.x=r+o*Math.cos(n),e.y=f+o*Math.sin(n)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let n=0;n<e.length;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5)*c,a=n*t;o.x=r+e*Math.cos(a),o.y=f+e*Math.sin(a)}}}const S=e.length,k=n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),v=n.__skipForceSimulation||0===n.iterations?0:x?40:k,R=I(n.nodeSize,n.nodeSizeRange,e),$=e=>R(e);if(v>0){const m=new Map,y=new Map;for(const t of e)m.set(t.id,0),y.set(t.id,t);for(const e of t){const t=w(e.source),n=w(e.target);m.set(t,(m.get(t)??0)+1),m.set(n,(m.get(n)??0)+1)}const p=l().strength(e=>{const t=e.weight,n=w(e.source),o=w(e.target),r=Math.max(1,Math.min(m.get(n)??1,m.get(o)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*a/(.1*r))}).distance(e=>{const t="string"==typeof e.source?y.get(e.source):e.source,n="string"==typeof e.target?y.get(e.target):e.target,o=(t?$(t):0)+(n?$(n):0)+Math.max(6,12*c);return Math.max(16,40*c,o)}).id(e=>e.id),M=s();if(void 0===n.random&&void 0===n.seed||M.randomSource(n.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n.seed)),M.force("charge",h().strength(e=>{const t=m.get(e.id)??0;return-15*c*$(e)*Math.sqrt(t+1)})).force("collide",g(e=>$(e)+3*c).strength(.9).iterations(2)).force("center",i(r,f).strength(.8)).force("x",d(r).strength(b)).force("y",u(f).strength(b)).force("bounds",function(e,t,n=2,o=.6){let a=[];const r=r=>{const f=o*Math.max(r,.2);for(const o of a){const a=o.x??e[0]/2,r=o.y??e[1]/2,c=o.vx??0,s=o.vy??0,i=t(o)+n,d=Math.min(e[0]/2,i),u=Math.max(e[0]/2,e[0]-i),l=Math.min(e[1]/2,i),h=Math.max(e[1]/2,e[1]-i),g=a+c,b=r+s;g<d?o.vx=c+(d-g)*f:g>u&&(o.vx=c+(u-g)*f),b<l?o.vy=s+(l-b)*f:b>h&&(o.vy=s+(h-b)*f)}};return r.initialize=e=>{a=e},r}(o,$)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:w(e.source),target:w(e.target)}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<v;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=$(t),n=v>0?2:0,a=Math.min(o[0]/2,e+n),r=Math.min(o[1]/2,e+n);t.x=Math.max(a,Math.min(o[0]-a,t.x)),t.y=Math.max(r,Math.min(o[1]-r,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const E=new Map;for(const t of e)E.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=E.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=E.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){const a=n.nodeStyle,r=n.edgeStyle,f=I(n.nodeSize,n.nodeSizeRange,e),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],u=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),o=a?a(k(t,"nodeStyle")):{},r={fill:o.fill||s.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity,cursor:o.cursor};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:r,datum:t,id:t.id,label:t.id})}const l=new Map;for(const t of e)l.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:l.get(e.source),o="object"==typeof e.target?e.target:l.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const a=r?r(k(e,"edgeStyle")):{},f={stroke:a.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:a.strokeWidth??1,opacity:a.opacity??.6,cursor:a.cursor};d.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:f,datum:e})}if(!1!==n.showLabels){const t=(h=n.nodeLabel)?"function"==typeof h?h:e=>e[h]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=f(k(n,"nodeSize"));u.push({x:n.x,y:n.y-o-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var h;return{sceneNodes:i,sceneEdges:d,labels:u}}};function q(e,t,n){const o=[];for(const a of t){const t=w(a.source),r=w(a.target);let f=null;if(t===e?f=r:r===e&&(f=t),f){const e=n.get(f);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function z(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function I(e,t,n){if(n.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const o=t||[5,20],a=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&a.push(n)}if(0===a.length)return()=>o[0];const[r,f]=function(e){let t=1/0,n=-1/0;for(const o of e)o<t&&(t=o),o>n&&(n=o);return[t,n]}(a);if(r===f)return()=>(o[0]+o[1])/2;const c=b().domain([r,f]).range(o).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?o[0]:c(n)}}self.onmessage=e=>{const t=e.data,n=t?.requestId,o=t?.request??t;try{if("normalized"===o.kind){const e=o.nodeRadii,t=e?{...o.options,nodeRadius:t=>e[t.id]??12}:o.options;return void self.postMessage({requestId:n,positions:c(o.nodes,o.edges,t)})}const e=o.nodes,t=o.edges;v.computeLayout(e,t,o.config,o.size),self.postMessage({requestId:n,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:n,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};