semiotic 3.8.6 → 3.8.8

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 (302) hide show
  1. package/CLAUDE.md +34 -8
  2. package/README.md +93 -56
  3. package/ai/behaviorContracts.cjs +86 -1
  4. package/ai/componentMetadata.cjs +4 -9
  5. package/ai/dist/mcp-server.js +125 -12
  6. package/ai/examples.md +154 -7
  7. package/ai/schema.json +1742 -156
  8. package/ai/surface-manifest.json +12 -10
  9. package/ai/system-prompt.md +9 -3
  10. package/dist/{chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
  12. package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
  13. package/dist/chunk-chunk-3GCILWPB.module.min.js +2 -0
  14. package/dist/chunk-chunk-46KRGJQP.module.min.js +1 -0
  15. package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
  16. package/dist/chunk-chunk-4MLLQUGW.module.min.js +2 -0
  17. package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
  18. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
  19. package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
  20. package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
  21. package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
  22. package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
  23. package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
  24. package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
  25. package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
  26. package/dist/chunk-chunk-BZNOAHJV.module.min.js +2 -0
  27. package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
  28. package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
  29. package/dist/chunk-chunk-FC3NZWYR.module.min.js +2 -0
  30. package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
  31. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
  32. package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
  33. package/dist/chunk-chunk-FRGBMTZR.module.min.js +1 -0
  34. package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
  35. package/dist/chunk-chunk-H5IFO6CU.module.min.js +2 -0
  36. package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
  37. package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
  38. package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
  39. package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
  40. package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
  41. package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
  42. package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
  43. package/dist/chunk-chunk-LJDH3WV3.module.min.js +2 -0
  44. package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
  45. package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
  46. package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
  47. package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
  48. package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
  49. package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
  50. package/dist/chunk-chunk-QQJNG23C.module.min.js +2 -0
  51. package/dist/chunk-chunk-RGJ6TKAH.module.min.js +2 -0
  52. package/dist/{chunk-chunk-RA7JCG7D.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
  53. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  54. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
  55. package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
  56. package/dist/{chunk-chunk-XP3OHHFX.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
  57. package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
  58. package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
  59. package/dist/{chunk-chunk-GFTVACTO.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
  60. package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
  61. package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
  62. package/dist/chunk-chunk-WSDJFBKX.module.min.js +2 -0
  63. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
  64. package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
  65. package/dist/components/ai/chartCapabilities.d.ts +4 -3
  66. package/dist/components/ai/conversationArc.d.ts +2 -176
  67. package/dist/components/ai/conversationArcTypes.d.ts +202 -0
  68. package/dist/components/ai/readerGrounding.d.ts +12 -0
  69. package/dist/components/ai/vacpAdapter.d.ts +13 -0
  70. package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
  71. package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
  72. package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
  73. package/dist/components/ai/vacpAdapterState.d.ts +3 -0
  74. package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
  75. package/dist/components/ai/vacpTypes.d.ts +160 -0
  76. package/dist/components/charts/index.d.ts +6 -6
  77. package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
  78. package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
  79. package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
  80. package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
  81. package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
  82. package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
  83. package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
  84. package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
  85. package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
  86. package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
  87. package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
  88. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
  89. package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
  90. package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
  91. package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
  92. package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
  93. package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
  94. package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
  95. package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
  96. package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
  97. package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
  98. package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
  99. package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
  100. package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
  101. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
  102. package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
  103. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
  104. package/dist/components/charts/network/processSankey/time.d.ts +11 -0
  105. package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
  106. package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
  107. package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
  108. package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
  109. package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
  110. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
  111. package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
  112. package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
  113. package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
  114. package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
  115. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
  116. package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
  117. package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
  118. package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
  119. package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
  120. package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
  121. package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
  122. package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
  123. package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
  124. package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
  125. package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
  126. package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
  127. package/dist/components/charts/shared/formatUtils.d.ts +12 -1
  128. package/dist/components/charts/shared/hatchFill.d.ts +2 -0
  129. package/dist/components/charts/shared/hooks.d.ts +1 -1
  130. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  131. package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
  132. package/dist/components/charts/shared/styleRules.d.ts +5 -1
  133. package/dist/components/charts/shared/useChartLegend.d.ts +14 -1
  134. package/dist/components/charts/shared/useChartSetup.d.ts +8 -1
  135. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  136. package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
  137. package/dist/components/data/numericFieldProfiler.d.ts +2 -0
  138. package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
  139. package/dist/components/data/portability/index.d.ts +2 -0
  140. package/dist/components/legendLayout.d.ts +56 -0
  141. package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
  142. package/dist/components/recipes/geographicGrid.d.ts +100 -0
  143. package/dist/components/recipes/layout1d.d.ts +68 -0
  144. package/dist/components/recipes/physics.d.ts +2 -0
  145. package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
  146. package/dist/components/semiotic-ai.d.ts +4 -3
  147. package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
  148. package/dist/components/semiotic-experimental.d.ts +6 -3
  149. package/dist/components/semiotic-geo.d.ts +4 -0
  150. package/dist/components/semiotic-network.d.ts +2 -2
  151. package/dist/components/semiotic-physics.d.ts +9 -6
  152. package/dist/components/semiotic-recipes-core.d.ts +8 -1
  153. package/dist/components/semiotic.d.ts +2 -0
  154. package/dist/components/server/renderEvidence.d.ts +1 -1
  155. package/dist/components/server/renderToStaticSVG.d.ts +2 -1
  156. package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
  157. package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
  158. package/dist/components/server/serverChartConfigShared.d.ts +16 -0
  159. package/dist/components/server/serverChartConfigs.d.ts +2 -2
  160. package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
  161. package/dist/components/server/serverChartConfigsXY.d.ts +0 -1
  162. package/dist/components/server/staticLegend.d.ts +6 -0
  163. package/dist/components/server/staticSVGChrome.d.ts +12 -3
  164. package/dist/components/server/staticValue.d.ts +8 -0
  165. package/dist/components/store/createStore.d.ts +2 -0
  166. package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
  167. package/dist/components/stream/PipelineStore.d.ts +5 -0
  168. package/dist/components/stream/accessorUtils.d.ts +21 -0
  169. package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
  170. package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
  171. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
  172. package/dist/components/stream/layouts/index.d.ts +1 -1
  173. package/dist/components/stream/legendRenderer.d.ts +8 -0
  174. package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
  175. package/dist/components/stream/networkTypes.d.ts +2 -0
  176. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
  177. package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
  178. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  179. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
  180. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
  181. package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
  182. package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
  183. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
  184. package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
  185. package/dist/components/stream/pipelineTransitions.d.ts +15 -1
  186. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
  187. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
  188. package/dist/components/stream/symbolPath.d.ts +8 -0
  189. package/dist/components/stream/types.d.ts +4 -0
  190. package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
  191. package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
  192. package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -0
  193. package/dist/components/types/legendTypes.d.ts +17 -1
  194. package/dist/controls.min.js +1 -1
  195. package/dist/controls.module.min.js +1 -1
  196. package/dist/forceLayoutWorker.js +1 -1
  197. package/dist/geo.min.js +1 -1
  198. package/dist/geo.module.min.js +1 -1
  199. package/dist/network.min.js +1 -1
  200. package/dist/network.module.min.js +1 -1
  201. package/dist/ordinal.min.js +1 -1
  202. package/dist/ordinal.module.min.js +1 -1
  203. package/dist/physics.min.js +1 -1
  204. package/dist/physics.module.min.js +1 -1
  205. package/dist/physicsWorker.js +1 -1
  206. package/dist/processSankeyLayoutWorker.js +1 -0
  207. package/dist/realtime.min.js +1 -1
  208. package/dist/realtime.module.min.js +1 -1
  209. package/dist/semiotic-ai-core.min.js +1 -1
  210. package/dist/semiotic-ai-core.module.min.js +1 -1
  211. package/dist/semiotic-ai.d.ts +4 -3
  212. package/dist/semiotic-ai.min.js +1 -1
  213. package/dist/semiotic-ai.module.min.js +1 -1
  214. package/dist/semiotic-data.module.min.js +1 -1
  215. package/dist/semiotic-experimental-vacp.d.ts +11 -0
  216. package/dist/semiotic-experimental-vacp.min.js +1 -0
  217. package/dist/semiotic-experimental-vacp.module.min.js +1 -0
  218. package/dist/semiotic-experimental.d.ts +6 -3
  219. package/dist/semiotic-experimental.min.js +2 -1
  220. package/dist/semiotic-experimental.module.min.js +2 -1
  221. package/dist/semiotic-geo.d.ts +4 -0
  222. package/dist/semiotic-network.d.ts +2 -2
  223. package/dist/semiotic-physics.d.ts +9 -6
  224. package/dist/semiotic-realtime-core.min.js +1 -1
  225. package/dist/semiotic-realtime-core.module.min.js +1 -1
  226. package/dist/semiotic-recipes-core.d.ts +8 -1
  227. package/dist/semiotic-recipes-core.min.js +1 -1
  228. package/dist/semiotic-recipes-core.module.min.js +1 -1
  229. package/dist/semiotic-recipes.min.js +1 -1
  230. package/dist/semiotic-recipes.module.min.js +1 -1
  231. package/dist/semiotic-server-edge.min.js +1 -1
  232. package/dist/semiotic-server-edge.module.min.js +1 -1
  233. package/dist/semiotic-server-node.min.js +1 -1
  234. package/dist/semiotic-server-node.module.min.js +1 -1
  235. package/dist/semiotic-themes-core.module.min.js +1 -1
  236. package/dist/semiotic-themes-react.module.min.js +1 -1
  237. package/dist/semiotic-themes.module.min.js +1 -1
  238. package/dist/semiotic-utils-core.min.js +1 -1
  239. package/dist/semiotic-utils-core.module.min.js +1 -1
  240. package/dist/semiotic-utils-react.module.min.js +1 -1
  241. package/dist/semiotic-utils.min.js +1 -1
  242. package/dist/semiotic-utils.module.min.js +1 -1
  243. package/dist/semiotic-value.min.js +1 -1
  244. package/dist/semiotic-value.module.min.js +1 -1
  245. package/dist/semiotic.d.ts +2 -0
  246. package/dist/semiotic.min.js +1 -1
  247. package/dist/semiotic.module.min.js +1 -1
  248. package/dist/server.min.js +1 -1
  249. package/dist/server.module.min.js +1 -1
  250. package/dist/xy.min.js +1 -1
  251. package/dist/xy.module.min.js +1 -1
  252. package/package.json +21 -4
  253. package/spec/README.md +94 -2
  254. package/spec/bindings/README.md +14 -3
  255. package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
  256. package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
  257. package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
  258. package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
  259. package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
  260. package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
  261. package/dist/chunk-chunk-2CHN2TA3.module.min.js +0 -1
  262. package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
  263. package/dist/chunk-chunk-3SHB24AG.module.min.js +0 -1
  264. package/dist/chunk-chunk-4MMOOYTX.module.min.js +0 -2
  265. package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
  266. package/dist/chunk-chunk-75OTQSXS.module.min.js +0 -1
  267. package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
  268. package/dist/chunk-chunk-A5GRQUOF.module.min.js +0 -1
  269. package/dist/chunk-chunk-AAF5LZAU.module.min.js +0 -2
  270. package/dist/chunk-chunk-ARZGA4LJ.module.min.js +0 -2
  271. package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
  272. package/dist/chunk-chunk-CAFLML4L.module.min.js +0 -2
  273. package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
  274. package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
  275. package/dist/chunk-chunk-FHBN7OEB.module.min.js +0 -2
  276. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
  277. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  278. package/dist/chunk-chunk-ITDWLZXV.module.min.js +0 -2
  279. package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
  280. package/dist/chunk-chunk-LPSPATPC.module.min.js +0 -1
  281. package/dist/chunk-chunk-OM6NWS4H.module.min.js +0 -2
  282. package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
  283. package/dist/chunk-chunk-PX5YQGDP.module.min.js +0 -2
  284. package/dist/chunk-chunk-Q2BS46W2.module.min.js +0 -2
  285. package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
  286. package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
  287. package/dist/chunk-chunk-RNUHEXZA.module.min.js +0 -2
  288. package/dist/chunk-chunk-ROZWKEUG.module.min.js +0 -1
  289. package/dist/chunk-chunk-SMVD3EQJ.module.min.js +0 -2
  290. package/dist/chunk-chunk-T2FKJD4O.module.min.js +0 -2
  291. package/dist/chunk-chunk-UDREYOLV.module.min.js +0 -1
  292. package/dist/chunk-chunk-VOWE3SAP.module.min.js +0 -2
  293. package/dist/chunk-chunk-VQPNBUSW.module.min.js +0 -2
  294. package/dist/chunk-chunk-WAWCIHFJ.module.min.js +0 -1
  295. package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
  296. package/dist/chunk-chunk-WYARAXHR.module.min.js +0 -2
  297. package/dist/chunk-chunk-XV3KGYTR.module.min.js +0 -2
  298. package/dist/chunk-chunk-YC2IVEPX.module.min.js +0 -1
  299. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
  300. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
  301. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
  302. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
@@ -49,8 +49,17 @@ export declare class PhysicsPipelineStore {
49
49
  materializeDueSpawns(): string[];
50
50
  clear(): void;
51
51
  tick(deltaSeconds: number): PhysicsPipelineTickResult;
52
+ /** Steps-only settle. Kernel/sensor transitions are stepped but not observed. */
52
53
  settle(maxSteps?: number): number;
53
54
  settleWithObservations(maxSteps?: number): PhysicsPipelineTickResult;
55
+ /** Bind this store to the shared settle loop (see physicsPipelineSettle). */
56
+ private settleHost;
57
+ /**
58
+ * One settle implementation for both entry points, so "run to completion"
59
+ * can't mean two different things. `observe` adds kernel/sensor observation
60
+ * and the collected tick result; the stepping itself is identical.
61
+ */
62
+ private runSettle;
54
63
  readBodies(out?: PhysicsBodyState[]): PhysicsBodyState[];
55
64
  readSediment(): PhysicsSedimentBinSnapshot[];
56
65
  bodyBudgetStatus(): PhysicsBodyBudgetDecision;
@@ -8,6 +8,11 @@ export interface PhysicsSettledSceneOptions {
8
8
  projectionRows?: PhysicsSettledProjectionRow[];
9
9
  bodyStyle?: Style | ((body: PhysicsBodyState) => Style);
10
10
  getBodyLabel?: (body: PhysicsBodyState) => string | undefined;
11
+ /**
12
+ * Total bodies the chart claims entered. Enables the settled ledger check
13
+ * (see {@link PhysicsSettledEvidence.ledger}); omitted means no ledger.
14
+ */
15
+ charge?: number;
11
16
  }
12
17
  export interface PhysicsSettledScene {
13
18
  snapshot: PhysicsPipelineSnapshot;
@@ -0,0 +1,19 @@
1
+ import type { Datum } from "../../charts/shared/datumTypes";
2
+ import type { PhysicsObservationEvent, PhysicsPipelineConfig } from "./PhysicsPipelineStore";
3
+ import type { StreamPhysicsRegionEffect } from "./StreamPhysicsTypes";
4
+ interface PhysicsFramePipelineConfigOptions {
5
+ annotations?: Datum[];
6
+ chartId?: string;
7
+ chartType: string;
8
+ config?: PhysicsPipelineConfig;
9
+ onRegionObservation: (event: PhysicsObservationEvent) => void;
10
+ regionEffects: StreamPhysicsRegionEffect[];
11
+ seed?: number;
12
+ size: [number, number];
13
+ }
14
+ /**
15
+ * Adds frame-owned annotation/region colliders and observation wiring without
16
+ * mutating the caller's pipeline configuration.
17
+ */
18
+ export declare function resolvePhysicsFramePipelineConfig({ annotations, chartId, chartType, config, onRegionObservation, regionEffects, seed, size }: PhysicsFramePipelineConfigOptions): PhysicsPipelineConfig | undefined;
19
+ export {};
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The shared "run this simulation to completion" loop behind both of
3
+ * `PhysicsPipelineStore`'s settle entry points.
4
+ *
5
+ * Settling has to mean *the simulation reached its end state*, and that includes
6
+ * admitting every arrival the queue still owes. Advancing simulated time per
7
+ * step and re-checking due spawns inside the loop is what lets paced spawns
8
+ * (`initialSpawnPacing`, per-datum `spawnAt`) and elapsed-time event tapes
9
+ * finish on the reduced-motion / snapshot path instead of freezing at the first
10
+ * spawn instant. Both entry points run this one loop so they cannot drift apart.
11
+ */
12
+ import type { PhysicsBodyBudgetDecision } from "./PhysicsBodyBudget";
13
+ import type { PhysicsKernelEvent } from "./PhysicsKernel";
14
+ import type { PhysicsPipelineEvictionResult } from "./physicsPipelineHelpers";
15
+ import type { PhysicsObservationEvent } from "./PhysicsPipelineTypes";
16
+ /**
17
+ * The slice of store behavior the loop drives. Passed explicitly (rather than
18
+ * reaching into the store) so the loop stays independently testable.
19
+ */
20
+ export interface PhysicsSettleHost {
21
+ fixedDt: number;
22
+ queueSize: () => number;
23
+ atRest: () => boolean;
24
+ /** Advance simulated time; this is what makes time-driven consumers progress. */
25
+ advanceTime: (seconds: number) => void;
26
+ spawnDue: (spawned: string[], observations?: PhysicsObservationEvent[]) => void;
27
+ observeBodyBudget: (observations?: PhysicsObservationEvent[]) => PhysicsBodyBudgetDecision;
28
+ evictOverflow: (observations?: PhysicsObservationEvent[]) => PhysicsPipelineEvictionResult;
29
+ step: (deltaSeconds: number) => void;
30
+ /** Drain buffered kernel events for this step. */
31
+ drainEvents: () => PhysicsKernelEvent[];
32
+ observeKernelEvents: (events: PhysicsKernelEvent[], observations?: PhysicsObservationEvent[]) => void;
33
+ observeSensorTransitions: (observations?: PhysicsObservationEvent[]) => void;
34
+ refreshQuiescence: (deltaSeconds: number, spawnedCount: number) => void;
35
+ }
36
+ /**
37
+ * Collectors for the run. Only `spawned` is required — the cheap `settle()` path
38
+ * discards the rest, while `settleWithObservations()` collects everything.
39
+ * Omitting `events` also suppresses observation of kernel/sensor transitions.
40
+ */
41
+ export interface PhysicsSettleSink {
42
+ spawned: string[];
43
+ evicted?: string[];
44
+ sedimented?: string[];
45
+ events?: PhysicsKernelEvent[];
46
+ observations?: PhysicsObservationEvent[];
47
+ }
48
+ export interface PhysicsSettleRun {
49
+ steps: number;
50
+ budget?: PhysicsBodyBudgetDecision;
51
+ }
52
+ export declare function runPhysicsSettleSteps(host: PhysicsSettleHost, maxSteps: number, sink: PhysicsSettleSink): PhysicsSettleRun;
@@ -29,6 +29,29 @@ export declare function regionRuntimeEffectsRequireSync(regionEffects: readonly
29
29
  export declare function applyActiveRegionEffects(controls: PhysicsPipelineControlSurface, regionEffects: readonly StreamPhysicsRegionEffect[], regionState: Map<string, InternalStreamPhysicsBodyRegionState>, dtSeconds: number): boolean;
30
30
  export declare function resolveBodyForceVector(force: StreamPhysicsBodyForce | undefined, context: StreamPhysicsBodyForceContext): StreamPhysicsRegionVector | null;
31
31
  export declare function applyBodyForces(controls: PhysicsPipelineControlSurface, bodyForces: StreamPhysicsBodyForce | undefined, regionEffects: readonly StreamPhysicsRegionEffect[], regionState: Map<string, InternalStreamPhysicsBodyRegionState>, simulationState: PhysicsSimulationState, dtSeconds: number): boolean;
32
+ export interface PhysicsPostTickOutcome {
33
+ regionEffectsApplied: boolean;
34
+ bodyForcesApplied: boolean;
35
+ snapshot: ReturnType<PhysicsPipelineStore["snapshot"]>;
36
+ result: PhysicsPipelineTickResult;
37
+ }
38
+ /**
39
+ * How many settle → `onTick` → settle passes the reduced-motion path runs before
40
+ * giving up. Event-tape charts spawn bodies from `onTick`, so one pass is never
41
+ * enough; a small bound keeps a controller that always reports work from
42
+ * blocking the main thread.
43
+ */
44
+ export declare const REDUCED_MOTION_SETTLE_PASSES = 4;
45
+ /**
46
+ * The reduced-motion / snapshot render pass.
47
+ *
48
+ * Reduced motion never schedules a second frame, so any work a settle hands to
49
+ * `onTick` — an event tape spawning gate bodies, a capacity controller
50
+ * releasing queued items — would be enqueued and never simulated. Settle
51
+ * repeatedly while the store still reports pending work so the scene reaches
52
+ * the same end state an animated run would.
53
+ */
54
+ export declare function runPhysicsReducedMotionPasses(store: PhysicsPipelineStore, postTick: (result: PhysicsPipelineTickResult) => Omit<PhysicsPostTickOutcome, "result">, maxPasses?: number): PhysicsPostTickOutcome;
32
55
  /**
33
56
  * Shared post-tick pipeline: region forces → body forces → controllers → onTick.
34
57
  * Used by the main RAF path and the worker-fallback path (DRY + one snapshot).
@@ -0,0 +1,6 @@
1
+ import type { OrdinalSceneNode } from "./ordinalTypes";
2
+ import type { SceneNode } from "./types";
3
+ /** Restore XY marks to their authored target state after an intro is cancelled. */
4
+ export declare function snapXYIntroTargets(scene: SceneNode[]): void;
5
+ /** Restore ordinal marks to their authored target state after an intro is cancelled. */
6
+ export declare function snapOrdinalIntroTargets(scene: OrdinalSceneNode[]): void;
@@ -10,7 +10,7 @@
10
10
  * Dependencies: pipelineTransitionUtils (lerp, easing, ActiveTransition)
11
11
  * Consumed by: PipelineStore.computeScene (after decay/pulse)
12
12
  */
13
- import type { SceneNode, TransitionConfig } from "./types";
13
+ import type { SceneNode, TransitionConfig, Style } from "./types";
14
14
  import type { GlyphDef } from "./glyphDef";
15
15
  import type { ActiveTransition } from "./pipelineTransitionUtils";
16
16
  import type { Datum } from "../charts/shared/datumTypes";
@@ -51,6 +51,20 @@ export interface TransitionContext {
51
51
  * `_transitionKey` keeps exits stable across overlapping transitions.
52
52
  */
53
53
  export declare function getNodeIdentity(ctx: TransitionContext, node: SceneNode, index: number): string | null;
54
+ /**
55
+ * Effective paint alpha for fill-based marks.
56
+ *
57
+ * Matches the canvas renderer convention (`style.opacity ?? style.fillOpacity ?? 1`)
58
+ * used by points, glyphs, rects, heatcells, and candlesticks. Intro/update
59
+ * transitions must target this same value — otherwise a mark authored with
60
+ * only `fillOpacity: 0.7` animates toward 1, bakes `style.opacity = 1` on
61
+ * completion, and then "fades" back to 0.7 on the next dirty rebuild
62
+ * (e.g. tab-away → tab-back via FrameRuntime visibility resume).
63
+ *
64
+ * Line/area marks keep stroke alpha on `style.opacity` alone; their under-
65
+ * path fill uses `fillOpacity` independently and is not covered here.
66
+ */
67
+ export declare function resolveMarkOpacity(style?: Style | null): number;
54
68
  /**
55
69
  * Snapshot current scene node positions before rebuild.
56
70
  */
@@ -1,5 +1,5 @@
1
1
  /** Shared canvas primitives for fills, strokes, curves, and gradients. */
2
- import type { CurveType } from "../types";
2
+ import type { CurveType, Style } from "../types";
3
3
  import type { GradientConfig } from "../../charts/shared/gradient";
4
4
  import { type HatchFill } from "../../charts/shared/hatchFill";
5
5
  import type { CurveFactory } from "d3-shape";
@@ -35,12 +35,24 @@ export declare function resolveCanvasFill(ctx: CanvasRenderingContext2D, fill: s
35
35
  export declare function coerceCanvasFill(ctx: CanvasRenderingContext2D, fill: string | HatchFill | CanvasPattern | null | undefined): string | CanvasPattern | undefined;
36
36
  /**
37
37
  * Build a linear gradient from a normalized gradient config. Stops without a
38
- * color inherit the resolved mark color.
38
+ * color inherit the resolved mark color. Used for both fill gradients (bar,
39
+ * area fill) and stroke gradients (line, area stroke) — a canvas gradient
40
+ * object is equally valid as `fillStyle` or `strokeStyle`.
39
41
  *
40
42
  * The renderer is responsible for choosing the gradient axis (a bar
41
43
  * runs tip→base along its value axis; an area runs minTop→maxBottom
42
44
  * vertically).
43
45
  */
44
46
  export declare function buildLinearFillGradient(ctx: CanvasRenderingContext2D, fillGradient: GradientConfig, baseFill: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
45
- /** Build a linear stroke gradient along the caller-provided axis. */
46
- export declare function buildColorStopGradient(ctx: CanvasRenderingContext2D, strokeGradient: GradientConfig, baseStroke: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
47
+ /**
48
+ * Resolve and apply a network node's fill, then invoke `paint` (the
49
+ * renderer's own `fill()`/`fillRect()` call — the path or rect traced
50
+ * differs per shape, so painting stays with the caller).
51
+ */
52
+ export declare function paintNetworkFill(ctx: CanvasRenderingContext2D, style: Style, fallback: string, paint: () => void): void;
53
+ /**
54
+ * Resolve and apply a network node's stroke, then invoke `paint`. `"none"`
55
+ * is truthy as a string, so this guards it explicitly — canvas otherwise
56
+ * rejects `strokeStyle = "none"`, keeps the default black, and still strokes.
57
+ */
58
+ export declare function paintNetworkStroke(ctx: CanvasRenderingContext2D, style: Style, paint: () => void): void;
@@ -1,2 +1,6 @@
1
+ import type { NetworkSceneNode } from "../networkTypes";
1
2
  import type { StreamRendererFn } from "./types";
3
+ /** XY / ordinal painter (x/y-positioned symbol nodes). */
2
4
  export declare const symbolCanvasRenderer: StreamRendererFn;
5
+ /** Network painter (cx/cy-positioned symbol nodes). */
6
+ export declare function networkSymbolRenderer(ctx: CanvasRenderingContext2D, nodes: NetworkSceneNode[]): void;
@@ -1,3 +1,4 @@
1
+ import type { Datum } from "../charts/shared/datumTypes";
1
2
  /** Named glyph shapes a `symbol` scene node can request. */
2
3
  export type NetworkSymbolName = "circle" | "square" | "triangle" | "diamond" | "star" | "cross" | "wye" | "chevron";
3
4
  /** Pipeline-neutral alias — the symbol mark is shared by network, XY, and
@@ -22,3 +23,10 @@ export declare function symbolRadius(size: number): number;
22
23
  * measured from their path vertices; `circle` is the area formula.
23
24
  */
24
25
  export declare function symbolExtent(symbolType: NetworkSymbolName | string | undefined, size: number, customPath?: string): number;
26
+ /**
27
+ * Build a per-scene category→shape resolver for the `symbolBy` channel.
28
+ * Explicit `symbolMap` wins; unmapped categories auto-assign from
29
+ * `SYMBOL_SEQUENCE` in first-seen (deterministic) order. Shared by the XY
30
+ * and ordinal point scene builders so Scatterplot/SwarmPlot glyphs agree.
31
+ */
32
+ export declare function makeSymbolResolver(getSymbol: (d: Datum) => unknown, symbolMap: Record<string, SymbolName> | undefined): (d: Datum) => SymbolName;
@@ -96,6 +96,8 @@ export type RuntimeMode = "bounded" | "streaming";
96
96
  export interface Style {
97
97
  stroke?: string;
98
98
  strokeWidth?: number;
99
+ /** Opacity applied to the stroke independently of fill/mark opacity. */
100
+ strokeOpacity?: number;
99
101
  strokeDasharray?: string;
100
102
  strokeLinecap?: "butt" | "round" | "square";
101
103
  /**
@@ -235,6 +237,8 @@ export interface PointSceneNode {
235
237
  r: number;
236
238
  style: Style;
237
239
  datum: SceneDatum;
240
+ /** Whether this point participates in hit testing and spatial indexing. Set to false for decorative points. @default true */
241
+ interactive?: boolean;
238
242
  accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
239
243
  accessibility?: SceneAccessibilityMetadata["accessibility"];
240
244
  /** Optional unique identifier for point-anchored annotations */
@@ -35,6 +35,12 @@ export interface UseCanvasFrameHostInput<TStore extends object> {
35
35
  * mount-time invalidation while retaining dependency-change invalidation.
36
36
  */
37
37
  skipInitialCanvasPaintInvalidation?: boolean;
38
+ /**
39
+ * Optional repaint-only invalidator for families that synchronously rebuild
40
+ * retained scene geometry elsewhere. When omitted, dependency changes use
41
+ * the conservative `dirtyRef` full-rebuild path.
42
+ */
43
+ canvasPaintInvalidator?: () => void;
38
44
  /**
39
45
  * Values that require a data-canvas repaint. Keep this list family-owned:
40
46
  * it expresses paint semantics without teaching the host chart props or
@@ -13,10 +13,19 @@ interface SemanticFrameInteractionOptions<Hover extends HoverLike> {
13
13
  chartId?: string;
14
14
  chartType: string;
15
15
  }
16
- /** Add semantic observations around the legacy Stream Frame callbacks. */
16
+ /**
17
+ * Add semantic observations around the legacy Stream Frame callbacks.
18
+ *
19
+ * Returns `undefined` for hover/click when neither a user callback nor
20
+ * `onObservation` is present. Frames historically treated any truthy
21
+ * `customHoverBehavior` as “selection may have changed” and marked the
22
+ * scene dirty — which re-ran `computeScene` (and intro/data transitions)
23
+ * on every pointermove. Observation emission alone does not change the
24
+ * retained scene, so an always-present wrapper is the wrong signal.
25
+ */
17
26
  export declare function useSemanticFrameInteractions<Hover extends HoverLike>({ customHoverBehavior: customHoverBehaviorProp, customClickBehavior: customClickBehaviorProp, onObservation, chartId, chartType }: SemanticFrameInteractionOptions<Hover>): {
18
- customHoverBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
19
- customClickBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
27
+ customHoverBehavior: ((hover: Hover | null, context?: SemanticInteractionContext) => void) | undefined;
28
+ customClickBehavior: ((hover: Hover | null, context?: SemanticInteractionContext) => void) | undefined;
20
29
  hasClickBehavior: boolean;
21
30
  };
22
31
  export {};
@@ -32,6 +32,10 @@ export interface XYFrameAxisConfig {
32
32
  * custom strokeDasharray string. Applied to grid lines extending
33
33
  * from ticks across the chart area. */
34
34
  gridStyle?: "dashed" | "dotted" | string;
35
+ /** Set false to suppress grid lines emitted from this axis while retaining
36
+ * its ticks and baseline. For example, set the bottom axis to `false` for
37
+ * horizontal-only (y-axis) grid lines. */
38
+ grid?: boolean;
35
39
  /** Always include the domain max as a tick, even if d3 omits it. */
36
40
  includeMax?: boolean;
37
41
  /** Auto-rotate labels 45° when horizontal spacing is too tight. */
@@ -63,9 +63,25 @@ export interface LegendLayout {
63
63
  /**
64
64
  * Space between the plot and a left/right legend reserved for adjacent
65
65
  * chart chrome such as axis ticks and an axis title. Ignored for top/bottom
66
- * legends. The legend is placed outside this gutter.
66
+ * legends — see `axisGutter`. The legend is placed outside this gutter.
67
67
  */
68
68
  sideGutter?: number;
69
+ /**
70
+ * The top/bottom counterpart of `sideGutter`: space between the plot and a
71
+ * top/bottom legend reserved for that side's axis chrome (tick labels and
72
+ * an axis title).
73
+ *
74
+ * **Auto-measurement is bottom-axis only.** A bottom legend defaults to the
75
+ * measured chrome of the axis actually drawn, so it clears the tick labels
76
+ * instead of overdrawing them, and resolves to 0 when the chart has no
77
+ * bottom axis. Top axes are opt-in (`frameProps.axes` with
78
+ * `orient: "top"`), so a *top* legend defaults to 0 and needs this set
79
+ * explicitly to clear a top axis.
80
+ *
81
+ * Set explicitly to override either side, or `0` to opt out and anchor the
82
+ * legend directly to the plot edge.
83
+ */
84
+ axisGutter?: number;
69
85
  }
70
86
  export interface LegendProps {
71
87
  legendGroups?: LegendGroup[];
@@ -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-fg, #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-on-primary, #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
+ 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})]})}